/GIVECASH PROBLEM
#1

Hello guys,

I made a /givecash command for my script. I want this:

/givecash Player1 100

If I send a player money I see in the chat:

* You sent $100 to player1

and the player see in the chat:

* You have received $100 from player2

If I dont have amount money:

* Sorry, invalid transaction... you dont have $100.

If I try to give myself money:

* Sorry, you cannot give cash to yourself!

If I typed the command wrong:

** Usage: /givecash <PlayerID/PlayerName> <MoneyAmount>
* Gives the specified amount of your money to the player specified.

My Command:

Код:
CMD:givecash(playerid, params[])
{
	new player, amount,name1[24], name2[24], string[128];
	if(!sscanf(params, "ui",player,amount))
	{
	    if(playerid != player)
	    {
	        if(GetPlayerMoney(playerid) >= amount)
	        {
				GetPlayerName(playerid, name1, 24);
				GetPlayerName(player, name2, 24);
				format(string, sizeof(string), "* You send $%d to %s",amount,name2);
				SendClientMessage(playerid, COLOR_GREY2, string);
				format(string, sizeof(string), "* You have received $%d from %s", amount, name1);
				SendClientMessage(player, COLOR_GREY2, string);
				GivePlayerMoney(playerid, -amount);
				GivePlayerMoney(player, amount);
	        }
	        else return
	        format(string, sizeof(string), "* Sorry, invalid transaction... you dont have $%d!",amount);
		SendClientMessage(playerid, COLOR_ERROR_YELLOW, string);
	    }
	    else return SendClientMessage(playerid, COLOR_ERROR_YELLOW,"* Sorry, you cannot give cash to yourself!");
	}
	else return
	SendClientMessage(playerid, COLOR_ERROR_YELLOW,"** Usage: /givecash <PlayerID/PlayerName> <MoneyAmount>");
 	SendClientMessage(playerid, COLOR_ERROR_YELLOW,"* Gives the specified amount of your money to the player specified.");
	return 1;
}
There is only a problem with the SendClientMessages.
Reply


Messages In This Thread
/GIVECASH PROBLEM - by AwokenNeoX - 31.10.2015, 13:54
AW: /GIVECASH PROBLEM - by AwokenNeoX - 31.10.2015, 14:10
Re: /GIVECASH PROBLEM - by thaKing - 31.10.2015, 14:10
AW: /GIVECASH PROBLEM - by AwokenNeoX - 31.10.2015, 14:19
Re: /GIVECASH PROBLEM - by Matess - 31.10.2015, 14:30
AW: /GIVECASH PROBLEM - by AwokenNeoX - 31.10.2015, 14:37

Forum Jump:


Users browsing this thread: 1 Guest(s)