Small Coding Help
#10

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:
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;
}

Reply


Messages In This Thread
Small Coding Help - by meD maN - 07.08.2011, 18:40
Re: Small Coding Help - by Backwardsman97 - 07.08.2011, 18:44
Re: Small Coding Help - by Kingunit - 07.08.2011, 18:48
Re: Small Coding Help - by Cypress - 07.08.2011, 19:45
Re: Small Coding Help - by Vince - 07.08.2011, 20:01
Re: Small Coding Help - by AndreT - 07.08.2011, 20:06
Re: Small Coding Help - by Cypress - 07.08.2011, 20:12
Re: Small Coding Help - by Sasino97 - 07.08.2011, 20:14
Re: Small Coding Help - by Scenario - 07.08.2011, 20:14
Re: Small Coding Help - by meD maN - 07.08.2011, 22:33

Forum Jump:


Users browsing this thread: 1 Guest(s)