Bank limit (Using y_ini)
#1

Alright so i am currently making banks and i need a statement...a bank limit,
but the problem is im completly clueless how should i make it, i gues i need to
use calcualtion or something...
I was trying to look into some scripts like gamemodes and filterscripts here on the forum,
but i didnt found anything that could help me.
So far i have this:

pawn Код:
if(GetPVarInt(playerid, "Bank") // == < > params[0] ? no idea what next :(
Please give me some tips if you can.
Thanks, regards.
Reply
#2

X < Y X is smaller than Y and Y is bigger than X
X > Y | X is bigger than Y and Y is smaller than X
X == Y | X equals Y
X <= Y | X is smaller or equals Y
X >= Y | X is bigger of equals Y
Reply
#3

I know that, i actualy WAS educated in math.
But thats not the solution its the bank limit that is stated, the maximum value of money the user can have in his bank.
Reply
#4

Well, what i told you says pretty much everything, right? Equals or it's higher than amount in bank.
Reply
#5

Ok i solved it.

pawn Код:
if(GetPVarInt(playerid, "Bank") + params[0] > 100000)
Reply
#6

Nice explained Zh3ro, I will save those examples, thank you
Reply
#7

Quote:
Originally Posted by OldDirtyBastard
Посмотреть сообщение
Ok i solved it.

pawn Код:
if(GetPVarInt(playerid, "Bank") + params[0] > 100000)
Use 'strval(params)' instead of 'params[0]', as strval returns the actual value in the string, and params[x] only returns the (ASCII-) value of the given character.
Reply
#8

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
Use 'strval(params)' instead of 'params[0]', as strval returns the actual value in the string, and params[x] only returns the (ASCII-) value of the given character.
Thanks for the hint il use it, but now i got a little problem with my code,
as i wanna deposit the same amount twice, it wont write the value in the file, my code:

pawn Код:
CMD:deposit(playerid, params[])
{
    //statements etc...
    new PlayerFile[13 + MAX_PLAYER_NAME];
    format(PlayerFile, sizeof PlayerFile, "Accounts/%s.ini", Encode(PlayaName(playerid)));
    new INI:PlayerAcc = INI_Open(PlayerFile);
    INI_WriteInt(PlayerAcc, "BANK", GetPVarInt(playerid, "Bank") + strval(params));
    INI_Close(PlayerAcc);
    GivePlayerMoney(playerid,-strval(params));
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)