30.08.2009, 14:40
Hello... i have bug here.
How i tyoe /givecash (id) 100 i send to player 100$ no? is works, but i type /givecash (id) -100 i steal to the other player 100$
How i can fixed this?
Help me please
Код:
dcmd_givecash(playerid,params[]) { new tmp[256], idx; tmp = strtok(params,idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOUR_RED, "Use: /givecash [playerid] [amount]"); return true; } new pid = strval(tmp); if(!IsPlayerConnected(pid)) { SendClientMessage(playerid, COLOUR_RED, "Incorrect playerid."); return true; } tmp = strtok(params,idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOUR_RED, "Use: /givecash [playerid] [amount]"); return true; } new amount = strval(tmp), string[256], string1[256], pname2[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname2, sizeof(pname2)); format(string, sizeof(string), "%s sent you $%d", pname2, amount); format(string1, sizeof(string1), "You sent %s, $%d", pname2, amount); SendClientMessage(pid,COLOUR_GREEN, string); SendClientMessage(playerid,COLOUR_GREEN, string1); GivePlayerMoney(pid, amount); GivePlayerMoney(playerid, -amount); return true; }
How i can fixed this?
Help me please