07.11.2018, 13:45
So is this better
Or
Command Example with GetName
In this command would the first example be better or the second one?
PHP код:
new playerName[MAX_PLAYERS][MAX_PLAYER_NAME];
public OnPlayerConnect(playerid)
{
GetPlayerName(playerid, Player_Name[playerid], MAX_PLAYER_NAME);
return 1;
} // Don't mind not reseting it I know just giving an example
PHP код:
stock GetName(playerid)
{
new Nick[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nick, sizeof(Nick));
return Nick;
}
PHP код:
CMD:kick(playerid, params[])
{
new
id,
reason[100];
if (sscanf(params, "rs[100]", id, reason)) return // syntax..
// ...
new
string[128],
ip[16];
GetPlayerIp(id, ip, 16);
format(string, sizeof (string), "You have been kicked by %s. Reason: %s", GetName(playerid), reason);
SendClientMessage(id, -1, string);
format(string, sizeof (string), "You kicked %s. Reason: %s", GetName(id), reason);
SendClientMessage(playerid, -1, string);
format(string, sizeof (string), "%s kicked %s. Reason: %s", GetName(playerid), GetName(id), reason);
SendClientMessageToAll(id, -1, string);
format(string, sizeof (string), "%s kicked %s [IP: %s]. Reason: %s", GetName(playerid), GetName(id), ip, reason);
SendMessageToAdmins(-1, string);
// kick player..
return 1;
}