21.03.2012, 14:34
Edit: While waiting for the response that you got it made
How can I do to be able to send money only if the player who is sending money ahead of you.
How can I do to be able to send money only if the player who is sending money ahead of you.
Код:
dcmd_pay(playerid, params[]) { new otherid,cash,str[128],namez[MAX_PLAYER_NAME]; if (sscanf(params, "ud", otherid, cash)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /pay [ID] [Cash]"); else { if(GetPlayerMoney(playerid) < cash) SendClientMessage(playerid, COLOR_RED, "You don't have that much!"); if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, COLOR_RED, "That PlayerID is not connected!"); if(otherid == playerid) SendClientMessage(playerid, COLOR_RED, "It is pointless to pay yourself.."); if(cash < 1) SendClientMessage(playerid, COLOR_RED, "You can not give less than 1 dollar!"); else { GivePlayerMoney(playerid, -cash); GetPlayerName(playerid,namez,sizeof(namez)); format(str,sizeof(str),"You have gained $%d from %s",cash,namez); SendClientMessage(otherid,COLOR_YELLOW,string); } { GivePlayerMoney(otherid, cash); GetPlayerName(playerid,namez,sizeof(namez)); format(str,sizeof(str),"You have gained $%d from %s",cash,namez); SendClientMessage(otherid,COLOR_YELLOW,string); } } return 1; }