08.06.2010, 22:20
How to make that the bank account remained at an exit of the player?
enum Info { Bank } new PlayerInfo[MAX_PLAYERS][Info]; |
if (strcmp(cmd, "/deposit", true) == 0) { new pmoney; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /deposit [Amount]"); pmoney=strval(tmp); pmoney = dini_IntSet(file, "Bank", (GetPlayerMoney(playerid)); GivePlayerMoney(playerid,-pmoney); return 1; } |
if (strcmp(cmd, "/withdraw", true) == 0) { new pmoney; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /withdraw [Amount]"); pmoney=strval(tmp); pmoney = dini_Int(file, "Bank"); if(dini_Int(file, "Bank",) < pmoney) { SendClientMessage(playerid,COLOR_WHITE,"You don't have enough cash!"); } else { GivePlayerMoney(playerid,pmoney); } return 1; } |
new pBank[MAX_PLAYERS];
#undef MAX_PLAYERS #define MAX_PLAYERS 30 // if your server has 30 slots, how less how better.