07.08.2011, 22:33
I just want the command to be 'secure' and not to mix in with any other commands that start with '/me' and for it to also be compiled easily. Plus I'd like to know how to do it for other Commands like Text Messages, and please also explain me how you done this and how I can do this. Thanks
Code:
Code:
Quote:
#define COLOR_ME 0xFFFFFF // What is the color going to be for the sent message? Currently, it's set to white. CMD:me(playerid, params[]) { if(isnull(params)) // Did they enter an action? return SendClientMessage(playerid, 0xFFFFFF, "SYNTAX: /me [action]"); if(strlen(params) > 124) // Is the action too long (aka. will it fit in a single message)? return SendClientMessage(playerid, 0xFFFFFF, "SYSTEM: Your /me action is too long."); new szString[128]; format(szString, sizeof(szString), "* %s %s", GetName(playerid), params); // formatting the string SendClientMessage(playerid, COLOR_ME, szString); return 1; } stock GetName(playerid) // This function is quite useful. { new szName[25]; GetPlayerName(playerid, szName, sizeof(szName)); return szName; } |