/pay command help
#2

Код:
CMD:pay(playerid, params[])
{
  new otherid,cash,string[128],namez[MAX_PLAYER_NAME], namez1[MAX_PLAYER_NAME];
  if (sscanf(params, "ui", otherid, cash)) SendClientMessage(playerid, -1, "{5CFF6F}USAGE: {FFFFFF}/pay [ID] [Amount]");
  else
  {
    if(GetPlayerMoney(playerid) < cash) return SendClientMessage(playerid, -1, "{FF6347}ERROR: {FFFFFF}You don't have that much!");
    else if(!IsPlayerConnected(otherid)) return SendClientMessage(playerid, -1, "{FF6347}ERROR: {FFFFFF}That desired ID is not connected.");
    else if(otherid == playerid) return SendClientMessage(playerid, -1, "{FF6347}ERROR: {FFFFFF}You can't pay yourself.");
    else
    {
	    GivePlayerMoney(playerid, -cash);
		GetPlayerName(otherid,namez1,sizeof(namez1));
		format(string,sizeof(string),"{5CFF6F}NOTICE: {FFFFFF}You have sent {5CFF6F}$%d {FFFFFF}to {5CFF6F}%s{FFFFFF}.",cash,namez1);
		SendClientMessage(playerid,-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 should work
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)