SA-MP Forums Archive
Ban timer - 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: Ban timer (/showthread.php?tid=483159)



Ban timer - rakshith122 - 24.12.2013

Well, I'm currently running a Cops and Robbers on my server. In the ban system, When I input the command /ban, It bans the player and his IP permanently. So, I thought of asking you people on how to add ban timer to that ban system.
Ban command's pawn code :
Код:
dcmd_adban(playerid,params[])
{
	new string[128];
	new ID;
	new cmdreason[100];
	if(sscanf(params,"us[100]",ID,cmdreason))
	{
	    SendClientMessage(playerid,COLOR_ERROR,"USAGE: /adban (Player Name/ID) (Reason)");
	    return 1;
	}
	if(!IsPlayerConnected(ID))
	{
	    format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot ban them.",ID);
	    SendClientMessage(playerid,COLOR_ERROR,string);
	    return 1;
	}
	Banning[ID] =1;
	format(string,sizeof(string),"[ADMIN] Administrator has banned %s(%d) from the server. Reason: %s.",PlayerName(ID),ID,cmdreason);
	SendClientMessageToAll(COLOR_ADMIN,string);

	format(string,sizeof(string),"9[ADMIN] Administrator has banned %s(%d) from the server. Reason: %s.",PlayerName(ID),ID,cmdreason);
    IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
    if(PLAYERLIST_authed[ID] == 1)
    {
    	dUserSetINT(PlayerName(ID)).("Nameban",1);
	}
	SetTimer("BanPlayer",700,0);
	return 1;
}
The maximum ban timer shall be 2160 hours and I should be able to ban a player for 10 hours, 500 hours, etc.
I hope someone would help me out in this!
Thanks.


Re: Ban timer - SilentSoul - 24.12.2013

https://sampforum.blast.hk/showthread.php?tid=169309 - Use this include will help you to temp. ban a player if you want to follow your codes , you need to check the current time matching with the ban time every second.


Re: Ban timer - rakshith122 - 24.12.2013

But, Can't I edit do it on my gamemode's ban system?