CMD:me(params[], playerid) {
// if(isnull(params)) {
// SendClientMessageToAll(COLOR_ME, "Usage: /me [action]");
// return 1;
// }
// else {
// new string[256],
// name[MAX_PLAYER_NAME + 1];
// GetPlayerName(playerid, name, sizeof(name));
// format(string, sizeof(string), "%s %s", name, params);
// SendClientMessageToAll(COLOR_ME, string);
// return 1;
// }
new action[256],
name[MAX_PLAYER_NAME + 1],
string[256];
if (sscanf(params, "sz", action)) {
return SendClientMessageToAll(0xC4C4C4FF, "Usage: /me [action]");
}
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s %s", name, action);
SendClientMessageToAll(COLOR_ME, string);
return 1;
}
CMD:me(params[], playerid) {
new action[256],
name[MAX_PLAYER_NAME + 1],
string[256];
if (sscanf(params, "s[250]", action)) {
return SendClientMessage(0xC4C4C4FF, "Usage: /me [action]");
}
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s %s", name, action);
SendClientMessageToAll(COLOR_ME, string);
return 1;
}
|
PHP код:
|
CMD:me(params[], playerid) {
new action[256],
name[MAX_PLAYER_NAME + 1],
string[256];
if (sscanf(params, "s[250]", action)) {
return SendClientMessage(playerid, 0xC4C4C4FF, "Usage: /me [action]");
}
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s %s", name, action);
SendClientMessageToAll(COLOR_ME, string);
return 1;
}
CMD:me(playerid, params[])
CMD:me(playerid, params[])
{
if(strlen(params) == 0) return SendClientMessage(playerid, 0xC4C4C4FF, "Usage: /me [action]");
new string[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s %s", name, params);
SendClientMessageToAll(COLOR_ME, string);
return 1;
}
CMD:me(playerid, params[])
{
if(strlen(params) == 0) return SendClientMessage(playerid, 0xC4C4C4FF, "Usage: /me [action]");
new string[128], name[MAX_PLAYER_NAME], Float: Pos[3];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
format(string, sizeof(string), "%s %s", name, params);
foreach(Player, i)
{
if(IsPlayerInRangeOfPoint(i, /*30 is a good range but you can decrease/increase*/30.0, Pos[0], Pos[1], Pos[2]))
{
SendClientMessage(i, COLOR_ME, string);
}
}
return 1;
}
foreach(new i : Player)
|
isnull is better than strlen as it checks the first character only whereas strlen count all of them.
Deprecated syntax, new syntax is: pawn Код:
|