/pay command help
#1

So I got this at the minute.
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;
}
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?
Reply


Messages In This Thread
/pay command help - by Swarn - 05.01.2016, 20:24
Re: /pay command help - by Lucky13 - 05.01.2016, 20:43
Re: /pay command help - by K9IsGodly - 05.01.2016, 21:17
Re: /pay command help - by Lucky13 - 05.01.2016, 21:19
Re: /pay command help - by PrO.GameR - 06.01.2016, 09:39
Re: /pay command help - by Swarn - 06.01.2016, 15:51

Forum Jump:


Users browsing this thread: 1 Guest(s)