Code:
public OnRconCommand(playerid, cmd[])
{
dcmd(kick, 4, cmd);
dcmd(kill, 4, cmd);
dcmd(ban, 3, cmd);
return 1;
}
dcmd_kick(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
{
new
id;
if (sscanf(params, "u", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else
{
SendClientMessage(id, 0x00FF00AA, "You've been kicked from the server [by: %s]", playerid);
SendClientMessage(playerid, 0x00FF00AA, "Player kicked");
Kick(id);
}
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "You're not RCON admin!");
}
}
dcmd_kill(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
{
new
id;
if (sscanf(params, "u", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/kill <playerid>\"");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else
{
SendClientMessage(id, 0x00FF00AA, "You've been killed [by: %s]", playerid);
SendClientMessage(playerid, 0x00FF00AA, "Player killed");
SetPlayerHealth(id, 0.00);
}
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "You're not RCON admin!");
}
}
dcmd_ban(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
{
new
id;
new
reason[64];
if (sscanf(params, "uz", id, reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage:\"/ban <playerid> <reason>\"");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else
{
BanEx(id, reason);
format(reason, sizeof(reason), "You have been banned%s%s.", reason[0] ? (" for: ") : (""), reason);
SendClientMessage(id, 0xFF0000AA, reason);
SendClientMessage(playerid, 0x00FF00AA, "Player banned");
}
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "You're not RCON admin!");
}
return 1;
}