SendClientMessage
#1

Hello.. I got a command /setmoney, it sets the player money, but I can't get it working that it send me a message 'You have set ***'s money to *** and the person which I setted the money gets a message Admin *** has set your money to ***.

This is my code:
Код:
	if(strcmp(cmd, "/setmoney", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setmoney [playerid/PartOfName] [amount]");
				return 1;
			}
			new playa;
			new money;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setmoney [playerid/PartOfName] [amount]");
				return 1;
			}
			money = strvalEx(tmp);
			if(PlayerInfo[playerid][pAdmin] >= 4)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
			            GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						ResetPlayerMoney(playa);
						PlayerInfo[playa][pCash] = money;
						GivePlayerMoney(playa, money);
						format(string, sizeof(string), "You have setted %s's money to $%d.",PlayerName(giveplayerid), money);
						SendClientMessage(giveplayerid, COLOR_BLUE, string);
						format(string, sizeof(string), "Admin %s Has set your money to $%d.", PlayerName(playerid), money);
						SendClientMessage(playerid, COLOR_BLUE, string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
			}
		}
		return 1;
	}
How do I fix it lol.
Reply


Messages In This Thread
SendClientMessage - by whando - 20.05.2013, 15:18
Re: SendClientMessage - by BenTaylorUK - 20.05.2013, 15:24
Re: SendClientMessage - by whando - 20.05.2013, 15:39

Forum Jump:


Users browsing this thread: 1 Guest(s)