16.02.2012, 09:42
i'm making my first admin system.
How to check if the reason is empty so it will send to everyone like this
"PlayerName has been kicked by AdminName | Reason: N/A"
also tell me if the command is correct its untested
How to check if the reason is empty so it will send to everyone like this
"PlayerName has been kicked by AdminName | Reason: N/A"
pawn Код:
CMD:kick(playerid, params[])
{
new string[128],
pname[MAX_PLAYER_NAME],
victimname[MAX_PLAYER_NAME],
victimid,
reason[30];
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerName(victimid, victimname, sizeof(victimname));
if(pInfo[playerid][alevel] > 1)
{
if(sscanf(params, "us", victimid, reason)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /kick <playername/id> <reason>");
if(victimid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid-ID!");
if(victimid == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot kick yourself!");
format(string, sizeof(string), "You kicked %s(ID:%d) | Reason: %s", victimname, victimid, reason);
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "%s(ID:%d) has been kicked by %s(ID:%d) | Reason: %s", victimname, victimid, pname, playerid, reason);
SendClientMessageToAll(COLOR_RED, string);
format(string, sizeof(string), "You have been kicked by %s(ID:%d) | Reason: %s", pname, playerid, reason);
SendClientMessage(victimid, COLOR_RED, string);
Kick(victimid);
}
else return SendClientMessage(playerid, COLOR_RED, "You must be Administrator Level 1 or higher to use this command!");
return 1;
}