26.03.2011, 08:58
Hello, i have a little bug in my bank system, it doesnt writes the correct ammount of money.
First time it writes the correct one, but the second time it goes kinda messsy and it isnt calculating
the ammounts and etc..
Could anyone please take a look at it and tell me what could be wrong?
Thanks regards.
First time it writes the correct one, but the second time it goes kinda messsy and it isnt calculating
the ammounts and etc..
Could anyone please take a look at it and tell me what could be wrong?
Thanks regards.
pawn Код:
CMD:bank(playerid, params[])
{
//Statements like sscanf, Insufficient Funds and etc...
new PlayerFile[13 + MAX_PLAYER_NAME];
format(PlayerFile, sizeof PlayerFile, "Accounts/%s.ini", Encode(PlayaName(playerid)));
if(GetPVarInt(playerid, "Bank") + strval(params) > 100000)
{
SendClientMessage(playerid, -1, ""COL_RED"ERROR:{FFFFFF} Your bank account can only hold 100 000$");
}
else
{
new INI:PlayerAcc = INI_Open(PlayerFile);
INI_WriteInt(PlayerAcc,"BANK",GetPVarInt(playerid, "Bank") + strval(params));
INI_Close(PlayerAcc);
GivePlayerMoney(playerid,-strval(params));
new string[128];
format(string,sizeof(string),"You have successfully banked %d$ into your bank account.",strval(params));
SendClientMessage(playerid,COLOR_GREEN,string);
}
return 1;
}
pawn Код:
if(!strcmp(name,"BANK"))SetPVarInt(playerid,"Bank",strval(value));