05.01.2016, 20:24
So I got this at the minute.
This code does work but when I pay people any amount, it doesn't tell me I payed them but if they pay me, it tells me I was payed and I sent this amount of cash which shouldn't happen. Any help?
pawn Код:
CMD:pay(playerid, params[])
{
new otherid,cash,string[128],namez[MAX_PLAYER_NAME];
if (sscanf(params, "dd", otherid, cash)) SendClientMessage(playerid, -1, "{5CFF6F}USAGE: {FFFFFF}/pay [ID] [Amount]");
else
{
if(GetPlayerMoney(playerid) < cash) SendClientMessage(playerid, -1, "{FF6347}ERROR: {FFFFFF}You don't have that much!");
else if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, -1, "{FF6347}ERROR: {FFFFFF}That desired ID is not connected.");
else if(otherid == playerid) SendClientMessage(playerid, -1, "{FF6347}ERROR: {FFFFFF}You can't pay yourself.");
else
{
GivePlayerMoney(playerid, -cash);
GetPlayerName(playerid,namez,sizeof(namez));
format(string,sizeof(string),"{5CFF6F}NOTICE: {FFFFFF}You have sent {5CFF6F}$%d {FFFFFF}to {5CFF6F}%s{FFFFFF}.",cash,namez);
SendClientMessage(otherid,-1,string);
}
{
GivePlayerMoney(otherid, cash);
GetPlayerName(playerid,namez,sizeof(namez));
format(string,sizeof(string),"{5CFF6F}NOTICE: {FFFFFF}You have recieved {5CFF6F}$%d {FFFFFF}from {5CFF6F}%s{FFFFFF}.",cash,namez);
SendClientMessage(otherid,-1,string);
}
}
return 1;
}