26.10.2010, 06:46
Use zcmd. It's a lot easier to use, and it's more efficient.
Excuse the name for strings and whatnot, it's the coding style I use, but zcmd is pretty simple to use. That's literally all you have to add for your /me command, other than '#include <zcmd>' at the top of your script.
pawn Код:
CMD:me(playerid, params[]) { // Creating the command.
if(isnull(params)) { // Checking if the player added anything after '/me'
// They didn't. We'll show them the usage of the command
SendClientMessage(playerid, 0xFF0000FF, "Usage: /me [action]"); // Sending them the usage as a message
}
else { // They did the opposite here. They did type something.
new
_playerNameSz[MAX_PLAYER_NAME], // Creating a variable to get the players name
_msgSz[128]; // 128 is the maximum limit of text per line
GetPlayerName(playerid, _playerNameSz, MAX_PLAYER_NAME); // Get the players name
format(_msgSz, sizeof(_msgSz), "* %s %s", _playerNameSz, _msgSz); // Format the message
SendClientMessageToAll(0xFF0000FF, _msgSz); // Send the /me message to everyone
}
return 1; // Return 1 so zcmd acknowledges that the command worked
}