Quote:
Originally Posted by dominik523
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:
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; }
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.
|
Thanks for the help, but on the contract its not just for a /me command, its also for automatic /me messages, you know? Like when you do /lock it automatically sends the *Bob Jim has unlocked his vehicle*. So I figured it would be quicker to make a function for it since I have OCD I HAVE to make my code as neat as possible. I will use your method since it basically does the same thing.