15.01.2017, 13:45
Guys i need help..Im having problem in my bank system..my /withdraw cmd is bugged...whenever i enter /withdraw at bank..it shows "unkown command"..Help me Pls
Here are my code..Im adding my deposit code ttoo..maybe u guys can spot any problem
Here are my code..Im adding my deposit code ttoo..maybe u guys can spot any problem
Код:
CMD:withdraw(playerid, params[]){ if(AdminDuty[playerid] == 1) { SendClientMessage(playerid,COLOR_WHITE, "You can't use this command while on-duty as admin."); return 1; } if(!IsPlayerInRangeOfPoint(playerid, 2477.9370,2376.9744,-39.3672)) { SendClientMessage(playerid, COLOR_GREY, "You're not at the bank!"); return 1; } new string[128], amount; if(sscanf(params, "d", amount)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /withdraw [amount]"); format(string, sizeof(string), " You have $%d in your account.", PlayerInfo[playerid][pBank]); SendClientMessage(playerid, COLOR_GRAD3, string); return 1; } if(amount > PlayerInfo[playerid][pBank] || amount < 1) { SendClientMessage(playerid, COLOR_GRAD2, " You don't have that much!"); return 1; } GivePlayerCash(playerid,amount); PlayerInfo[playerid][pBank]=PlayerInfo[playerid][pBank]-amount; format(string, sizeof(string), " You have withdrawn $%d from your account. Current balance: $%d ", amount,PlayerInfo[playerid][pBank]); SendClientMessage(playerid, COLOR_YELLOW, string); return 1; } CMD:deposit(playerid, params[]) { if(AdminDuty[playerid] == 1) { SendClientMessage(playerid,COLOR_WHITE, "You can't use this command while on-duty as admin."); return 1; } if(!IsPlayerInRangeOfPoint(playerid, 10.0, 2477.9370,2376.9744,-39.3672)) { SendClientMessage(playerid, COLOR_GREY, "You're not at the bank!"); return 1; } new string[128], amount; if(sscanf(params, "d", amount)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deposit [amount]"); format(string, sizeof(string), " You have $%d in your account.", PlayerInfo[playerid][pBank]); SendClientMessage(playerid, COLOR_GRAD3, string); return 1; } if(amount > GetPlayerCash(playerid) || amount < 1) { SendClientMessage(playerid, COLOR_GRAD2, " You don't have that much."); return 1; } GivePlayerCash(playerid,-amount); new curfunds = PlayerInfo[playerid][pBank]; PlayerInfo[playerid][pBank]=amount+PlayerInfo[playerid][pBank]; SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATMENT ___|"); format(string, sizeof(string), " Old Balance: $%d", curfunds); SendClientMessage(playerid, COLOR_GRAD2, string); format(string, sizeof(string), " Deposit: $%d",amount); SendClientMessage(playerid, COLOR_GRAD4, string); SendClientMessage(playerid, COLOR_GRAD6, "|-----------------------------------------|"); format(string, sizeof(string), " New Balance: $%d", PlayerInfo[playerid][pBank]); SendClientMessage(playerid, COLOR_WHITE, string); return 1; }