09.01.2011, 17:54
I wrote up this code but I can't get the /taxdeposit to work which will take money from the player and put it into the Government's tax vault. I know this code is right since it doesn't give errors but when I type /taxdeposit 1, it says there is not enough in the treasury. I need it to be taken from the players money and go into the vault.
Код:
if(strcmp(cmd, "/taxdeposit", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pLeader] != 6) { SendClientMessage(playerid, COLOR_GREY, " You are not the Governor !"); return 1; } if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2308.8071,-13.2485,26.7422)) { SendClientMessage(playerid, COLOR_GREY, " You are not at the bank !"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /taxdeposit [amount]"); format(string, sizeof(string), " There is currently $%d in the Treasury.", TaxValue); SendClientMessage(playerid, COLOR_GRAD3, string); return 1; } new cashdeposit = strvalEx(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /taxdeposit [amount]"); format(string, sizeof(string), " There is currently $%d in the Treasury.", TaxValue); SendClientMessage(playerid, COLOR_GRAD3, string); return 1; } if(cashdeposit > TaxValue || cashdeposit < 1) { SendClientMessage(playerid, COLOR_GRAD2, " There is not enough in the Treasury !"); return 1; } PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+cashdeposit; GivePlayerMoney(playerid, -cashdeposit); TaxValue = TaxValue+cashdeposit; format(string, sizeof(string), " You have deposited $%d to the Treasury, Total: $%d ", cashdeposit, TaxValue); SendClientMessage(playerid, COLOR_YELLOW, string); SaveStuff(); } return 1; }