SA-MP Forums Archive
Temp Ban! rep+ - 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: Temp Ban! rep+ (/showthread.php?tid=577493)



Temp Ban! rep+ - OscarJohnson - 11.06.2015

Hai, Im looking for Temp ban system like /ban [playerid] [days] [reason] Im using script with mysql


Re: Temp Ban! rep+ - Bingo - 11.06.2015

Check this out.

https://sampforum.blast.hk/showthread.php?pid=1205522#pid1205522

Hope helps.


Re: Temp Ban! rep+ - Prokill911 - 12.06.2015

Код:
public BanPlayer(playerid, reason[], bannerid, expiretime) {
	query[0] = 0;//[256];
	new ip[16];
	new bannersqlid;
	new systemban[126] = "SYSTEM";
	new admin[126];
	if(bannerid == -1) {
		admin = systemban;
		bannersqlid = 0;
	} else {
		bannersqlid = GetPVarInt(bannerid, "AccountID");	
		GetPVarString(bannerid, "Accountname", admin, sizeof(admin));		
	}
	GetPlayerIpEx(playerid, ip, sizeof(ip));
	new reason_esc[(128*2)+1];
	mysql_real_escape_string(reason,reason_esc);
	new timestamp[128];
	if(expiretime != 0) {
		format(timestamp, sizeof(timestamp), "DATE_ADD(CURRENT_TIMESTAMP(), INTERVAL %d SECOND)", expiretime);
	} else {
		format(timestamp, sizeof(timestamp), "TIMESTAMP(0)");
	}
	format(query,sizeof(query),"INSERT INTO `bans` (`accountid`,`banned`,`GPCI`,`ip`,`bannerid`,`admin`,`reason`,`expiretime`) VALUES (%d,\"%s\",\"%s\",INET_ATON(\"%s\"),%d,\"%s\",\"%s\",%s)",GetPVarInt(playerid,"AccountID"),GetPlayerNameEx(playerid, ENameType_CharName),GPCI,ip,bannersqlid,admin,reason_esc,timestamp);
	mysql_function_query(g_mysql_handle, query, true, "EmptyCallback", "");
	Kick(playerid);
	return 1;
}
Thats an example of my old tempban
before I majorly updated