Bank limit (Using y_ini) -
OldDirtyBastard - 24.03.2011
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.
Re: Bank limit (Using y_ini) -
Zh3r0 - 24.03.2011
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
Re: Bank limit (Using y_ini) -
OldDirtyBastard - 24.03.2011
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.
Re: Bank limit (Using y_ini) -
Zh3r0 - 24.03.2011
Well, what i told you says pretty much everything, right? Equals or it's higher than amount in bank.
Re: Bank limit (Using y_ini) -
OldDirtyBastard - 24.03.2011
Ok i solved it.
pawn Код:
if(GetPVarInt(playerid, "Bank") + params[0] > 100000)
Re: Bank limit (Using y_ini) -
xir - 24.03.2011
Nice explained Zh3ro, I will save those examples, thank you
Re: Bank limit (Using y_ini) -
Hiddos - 24.03.2011
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.
Re: Bank limit (Using y_ini) -
OldDirtyBastard - 24.03.2011
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;
}