SA-MP Forums Archive
[Question] /ban /unban - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Question] /ban /unban (/showthread.php?tid=349249)



[Question] /ban /unban - mickos - 08.06.2012

Hey,

I got a question, namely:
How make an ban/unban FS?
That admins can do:

/ban <id> <reason> (/ban means ban ip adress, and name.)
/unban <ip> (/unban mean that the admin got unbanned the player ip adress inc name)

And admins can do it ingame.

Thanks


Re: [Question] /ban /unban - lewismichaelbbc - 08.06.2012

Код:
	if(strcmp(cmd,"/banip",true)==0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(IsPlayerAdmin(playerid))
			{
			    tmp = strtok(cmdtext,idx);
			    if(!strlen(tmp))
			    {
			        SendClientMessage(playerid,COLOR_WHITE,"USAGE: /banip [ip]");
			        return 1;
	   		    }
				format(string,sizeof(string),"banip %s",tmp);
				SendRconCommand(string);
				SendRconCommand("reloadbans");
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GRAD2, "   You are not authorized to use that command !");
			}
		}
		return 1;
	}



Re: [Question] /ban /unban - mickos - 08.06.2012

thank you man! +rep


Re: [Question] /ban /unban - AliHaider - 17.06.2012

CMD:unban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128];
if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [playername]");

if( PlayerInfo[playerid][pBan] >= 1 )
{
PlayerInfo[playerid][pBan] = 0;
print("OnPlayerOfflineLogin: Variables saved properly");
format(string, 128, "[ADMIN] %s (IP:%s) was unbanned by %s.", params, PlayerInfo[playerid][pIP], GetPlayerNameEx(playerid));
SendStaffMessage(COLOR_RED,string);
new year, month,day;
getdate(year, month, day);
new playa[MAX_PLAYER_NAME];
GetPlayerName(playerid, playa, MAX_PLAYER_NAME);
format(string, sizeof(string), "[ADMIN] %s : was unbanned by %s.", params, playa);
SendStaffMessage(COLOR_RED, string);
}
else
{
SendClientMessage( playerid, COLOR_WHITE, "Not a banned account or no such account was found!" );
}
}
return 1;
}