06.11.2014, 17:54
I would suggest you to only use SendLocalMessage because you are using SendMeMessage in only /me command, right? So you can simply write something like this:
SendLocalMessage is used in more than one command, so we are making function for it, while SendMeMessage is used only in /me so it's not that special to create it's own function.
pawn Code:
stock ReturnName(playerid)
{
new string[MAX_PLAYER_NAME];
GetPlayerName(playerid, string, sizeof(string));
return string;
}
SendLocalClientMessage(playerid, Float:range, color, str[])
{
if (IsPlayerConnected(playerid))
{
new Float:ppos[3];
GetPlayerPos(playerid, ppos[0], ppos[1], ppos[2]);
foreach(Player, i)
{
if(IsPlayerInRangeOfPoint(i, range, ppos[0], ppos[1], ppos[2]))
{
SendClientMessage(i, color, str);
}
}
return 1;
}
return 0;
}
CMD:me(playerid, params[])
{
if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /me [action]");
new string[128];
format(string, sizeof(string), "* %s: %s", ReturnName(playerid), params);
SendLocalClientMessage
return 1;
}