/whisper [ID] [message] help!
#4

Add this to get the players names;
Код:
stock GetName(playerid)
{
    new Name[MAX_PLAYER_NAME];

    if(IsPlayerConnected(playerid))
    {
		GetPlayerName(playerid, Name, sizeof(Name));
		strreplace(Name, '_', ' ');
	}
	else
	{
	    Name = "Disconnected/Nothing";
	}

	return Name;
}
Add these at the top of the script for the colors;
Код:
#define WHITE 			0xFFFFFFFF
#define SERVER            0xFF6347FF
#define YELLOW 			0xFFFF00FF
Command;
Код:
command(w, playerid, params[])
{
	new id, string[128], message[128];
	if(sscanf(params, "uz", id, message))
	{
		SendClientMessage(playerid, SERVER, "SERVER:{FFFFFF} /w(hisper) [Playerid] [Message]");
	}
	else
	{
 		if(IsPlayerConnectedEx(id) && GetDistanceBetweenPlayers(playerid, id))
		{
		    format(string, sizeof(string), "Whisper sent to %s: %s", GetName(id), message);
		    SendClientMessage(playerid, YELLOW, string);
		    format(string, sizeof(string), "%s whispers: %s", GetName(playerid), message);
		    SendClientMessage(id, YELLOW, string);
		}
		else
		{
		    SendClientMessage(playerid, WHITE, "You're too far away from that player.");
		}
	}
	return 1;
}
I'm also a beginner, sorry if it doesn't work right.
Reply


Messages In This Thread
/whisper [ID] [message] help! - by Imbalo - 15.03.2017, 04:19
Re: /whisper [ID] [message] help! - by Toroi - 15.03.2017, 06:33
Re: /whisper [ID] [message] help! - by Imbalo - 15.03.2017, 08:04
Re: /whisper [ID] [message] help! - by Kane - 15.03.2017, 08:14
Re: /whisper [ID] [message] help! - by Imbalo - 15.03.2017, 08:21
Re: /whisper [ID] [message] help! - by Flamehaze7 - 15.03.2017, 10:06
Re: /whisper [ID] [message] help! - by YouHack - 15.03.2017, 13:42
Re: /whisper [ID] [message] help! - by Imbalo - 15.03.2017, 15:40
Re: /whisper [ID] [message] help! - by Dayrion - 15.03.2017, 20:11
Re: /whisper [ID] [message] help! - by Dutheil - 15.03.2017, 22:26

Forum Jump:


Users browsing this thread: 5 Guest(s)