Banning through MySQL and checking if player is banned
#1

I got an anti weapon hacks that bans:

Код:
public WeaponHackBan(playerid)
{
	new str[256], string[256], gName[256], query[256], IP[100];
	FreezePlayer(playerid, 1);
	GetWeaponName(GetPlayerWeapon(playerid),gName,sizeof(gName));
	GetPlayerIp(playerid, IP, sizeof(IP));
	format(str, sizeof(str), "AdmCmd: %s was banned by SYSTEM, reason: Weapon Hacks, Spawned %s.", GetName(playerid), gName);
	PlayerInfo[playerid][pBanned] = 1;
	format(string, sizeof(string), "<Weapon Hacks-Spawned %s>", gName);
	format(query, sizeof(query), "INSERT INTO `bans` (name, reason, playerIP) VALUES ('%s', '%s', '%s')", GetName(playerid),string,IP);
	mysql_function_query(dbHandle, query, true, "", "");
	KickWithMSG(playerid, str);
	return 1;
}
It sets pBanned to 1, and updated `bans` table.
how do I check when the player connects if he is banned?
Reply
#2

Do it when they try to login

pawn Код:
if(PlayerInfo[playerid][pBanned] >= 1 )
    {
        SendClientMessage( playerid, COLOR_LIGHTRED, "SERVER: You're banned from this server." );
        Kick(playerid);
        return 1;
    }
Now remember that because 0.3x makes it so you can't send messages to the person while they are being kicked. You need to find a way around this.

I recommend this post by Kalcor. it is VERY useful. I have gotten it to work.
http://forum.sa-mp.com/showpost.php?...2&postcount=14
Reply
#3

I know already, anyway doesn't work.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)