Rcon commands (DCMD)
#3

You mean,

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;
}
Like that?
Reply


Messages In This Thread
Rcon commands (DCMD) - by Niixie - 29.11.2009, 18:19
Re: Rcon commands (DCMD) - by Finn - 29.11.2009, 18:21
Re: Rcon commands (DCMD) - by Niixie - 29.11.2009, 18:24
Re: Rcon commands (DCMD) - by Correlli - 29.11.2009, 18:25
Re: Rcon commands (DCMD) - by Niixie - 29.11.2009, 18:29
Re: Rcon commands (DCMD) - by dice7 - 29.11.2009, 18:38
Re: Rcon commands (DCMD) - by Niixie - 29.11.2009, 18:40
Re: Rcon commands (DCMD) - by Finn - 29.11.2009, 18:41
Re: Rcon commands (DCMD) - by Niixie - 29.11.2009, 18:45
Re: Rcon commands (DCMD) - by Correlli - 29.11.2009, 18:49

Forum Jump:


Users browsing this thread: 4 Guest(s)