samp.directory
← Betikler ve kütüphaneler

hpq-dev/bigInt

bigInt for sa-mp

Kütüphane★ 8Nis 2022 güncellendiLisans yokPawn
GitHub’da aç

Bu deponun lisans dosyası yok. Okumak için herkese açık, ama bu tek başına yeniden kullanma izni vermez.

README.md

BIGINT for SAMP!

Installation

Include in your code and begin using the library:

#include <BigInt>

Usage

To create a variable

new BigInt:var_name;

This function adds numbers in bigint (max 2147483647/callback)

addBytes32(var_name, 1231231231);

With this function you can add over the limit of 2147483647. It is recommended to use this function only when large numbers are needed.

addBytes64(var_name, #3453453453453525534);

This function formats your bigint variable.

formatBytes(var_name);

output example:
// 312.123.512.523

This function sets the variable to 0.

resetBigInt(var_name);

This function returns the number as a string.

valueBigInt(var_name);

This function converts from 64 bits to 32 bits.

bytes32(var_name);

With this function you can do some operations for the bigint variable.

OPByte(var_name, operator, oper1);

// Operators:
>=
<=
==
!=
<
>

// example:
if(OPByte(var_name, <=, #10000)) return true;

This function checks for string numbers.

isBigInt(const string[]);

This function transforms from a string to bigint. (be careful there are numbers in that string!).

converBytes(var_name, const string[]);

These functions are compatible on mysql r41-4 and r-39-6

cache_get_value_name_bigint(var_name, row, column[]); // r41-4
cache_get_field_content_bigint(var_name, row, column[]); // r39-6

To make it compatible with a money system:

new BigInt:cash[MAX_PLAYERS];

#define GivePlayerCash(%0,%1) addBytes32(cash[%0],%1)
#define GetPlayerCash(%0) bytes32(cash[%0])

// show money
new str[50];
format(str, sizeof str, "%s", formatBytes(cash[playerid]));

// login
cache_get_value_name_bigint(cash[playerid],0,"Money");

// disconect save
public OnPlayerDisconect(playerid) {
    new query[128];
    mysql_format(handle, query, "UPDATE `users` SET `Money` = '%s' ...", valueBigInt(cash[playerid]));
    mysql_tquery(handle, query);
    return true;
}

Bu sayfa GitHub’ın depo hakkında yayımladıklarından oluşturulur. samp.directory kodu barındırmaz. Bu ilanla ilgili bir sorun bildir