26.09.2009, 11:21
Код:
if(strcmp("/givecash",true,9) == 0) { new tmp[256], idx; tmp = strtok(params,idx); if(!strlen(tmp)) { SendClientMessage(playerid, 0xFF3333AA, "Use: /givecash [playerid] [amount]"); return true; } new pid = strval(tmp); if(!IsPlayerConnected(pid)) { SendClientMessage(playerid, 0xFF3333AA, "Incorrect playerid."); return true; } tmp = strtok(params,idx); if(!strlen(tmp)) { SendClientMessage(playerid, 0xFF3333AA, "Use: /givecash [playerid] [amount]"); return true; } if(GetPlayerMoney(playerid) < strval(tmp)) { SendClientMessage(playerid, 0xFF3333AA, "Use: /givecash [playerid] [amount]"); return true; } new amount = strval(tmp), string[256], string1[256], pname2[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname2, sizeof(pname2)); if(amount <= 0) return SendClientMessage(playerid, 0xFF3333AA, "Invalid amount to send."); format(string, sizeof(string), "%s sent you $%d", pname2, amount); format(string1, sizeof(string1), "You sent %s, $%d", pname2, amount); SendClientMessage(pid,0x33AA33AA, string); SendClientMessage(playerid,0x33AA33AA, string1); GivePlayerMoney(pid, amount); GivePlayerMoney(playerid, -amount); return true; }