30.08.2009, 17:23
try this:
Untested.
Код:
dcmd_givecash(playerid, params[]) { new tmp[256], tmp2[256],Index; tmp = strtok(params,Index); tmp2 = strtok(params,Index); new otherid = strval(tmp); new amount = strval(tmp2); if (strlen(tmp) && strlen(tmp2)) { if (IsPlayerConnected(otherid)) { if (GetPlayerMoney(playerid) >= amount) { new string[256], string2[256], name[MAX_PLAYER_NAME], oname[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); GetPlayerName(otherid, oname, sizeof(oname)); GivePlayerMoney(playerid, GetPlayerMoney(playerid)-amount); GivePlayerMoney(otherid, amount); format(string, sizeof(string), "You have sent %s $%d.", oname, amount); format(string2, sizeof(string2), "%s has sent you $%d.", name, amount); SendClientMessage(playerid, COLOR, string); SendClientMessage(otherid, COLOR, string2); } else { SendClientMessage(playerid, COLOR, "You dont have that amount of cash."); } } else { SendClientMessage(playerid, COLOR, "Invalid player id."); } } else { SendClientMessage(playerid, COLOR, "USAGE: /givecash [playerid] [amount]"); } }