02.01.2017, 00:10
PHP код:
COMMAND:pay(playerid, params[])
{
new otherid, cash;
if (sscanf(params, "dd", otherid, cash)) SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}/pay [ID] [Amount]");
else
{
if(GetPlayerMoney(playerid) < cash) SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}You don't have that much!");
else if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}Invalid ID (Player not connected)");
else if(otherid == playerid) SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}Invalid ID (You can't pay yourself)");
else
{
GivePlayerMoney(playerid, -cash);
GivePlayerMoney(otherid, cash);
}
}
return 1;
}