Raised This Month: $32 Target: $400
 8% 

Problem with the mysql ban plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stefanx
Member
Join Date: Feb 2018
Location: Romania
Old 05-28-2020 , 08:31   Problem with the mysql ban plugin
Reply With Quote #1

Hi, i use this plugin https://forums.alliedmods.net/showthread.php?p=1759904 a bit edited because is easier to learn/use than sourcebans and i have a problem.
When I give them banned with for example 9000 minutes it can go back on the server after 2 days.

Code:
public T_AuthCheck(Handle:owner, Handle:hndl, const String:error[], any:data) {
	new client;
 	decl ban_length;	
	decl String:steam_id[32];
	decl String:steam_id_admin[32];
 	decl String:ban_reason[100];
 	decl String:banned_by[32];
 	decl ban_remaining;
	decl String:query[255];
	decl String:timestamp[64];
		
	if ((client = GetClientOfUserId(data)) == 0) 
	{
		return;
	}

	GetClientAuthId(client, AuthId_Engine, steam_id, 32);
	GetClientAuthId(client, AuthId_Steam2, clientAuth, sizeof(clientAuth))

	new buffer_len = strlen(steam_id) * 2 + 1
	new String:v_steam_id[buffer_len];
	SQL_EscapeString(hDatabase, steam_id, v_steam_id, buffer_len)

	if (hndl == INVALID_HANDLE) 
	{
		LogError("[MYBans] Query failed! %s", error);
                KickClient(client, "error");
	}

	if (SQL_FetchRow(hndl)) {
		ban_length = SQL_FetchInt(hndl,0);
		SQL_FetchString(hndl,1,banned_by,sizeof(banned_by));
		SQL_FetchString(hndl,2,ban_reason,sizeof(ban_reason));
		SQL_FetchString(hndl,3,steam_id_admin,sizeof(steam_id_admin));
		SQL_FetchString(hndl,4,timestamp,sizeof(timestamp));

		if (ban_length == 0) {
			KickClient(client,"Ai Primit ban\nDurata Ban: Permanent\nMotiv: %s\nNume Admin: %s\nSteamID Admin: %s\nSteamID-ul tau: %s\nData si ora: %s\nwww.alphacs.ro", ban_reason, banned_by, steam_id_admin, steam_id, timestamp);
			return;
		}

		ban_remaining = SQL_FetchInt(hndl,5);
		if (ban_remaining <= ban_length) 
		{
			KickClient(client,"Ai Primit ban\nDurata Ban: %d minute\nMotiv: %s\nNume Admin: %s\nSteamID Admin: %s\nSteamID-ul tau: %s\nData si ora: %s\nwww.alphacs.ro", ban_length, ban_reason, banned_by, steam_id_admin, steam_id, timestamp);
		} 
		else {
			Format(query, sizeof(query), "DELETE FROM my_bans WHERE steam_id='%s'", v_steam_id);
			SQL_TQuery(hDatabase, T_MYUnBan, query);
			LogMessage("[MYBans] User %s has been unbanned by elapse of time.", v_steam_id);
		}
	}
}
I think this problem is here because in logs says [MYBans] User STEAM_X:X_XXX has been unbanned by elapse of time.
Can someone help me ?

Last edited by Stefanx; 05-28-2020 at 09:09.
Stefanx is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode