Banning through MySQL and checking if player is banned - 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: Banning through MySQL and checking if player is banned (
/showthread.php?tid=416052)
Banning through MySQL and checking if player is banned -
PaulDinam - 15.02.2013
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?
Re: Banning through MySQL and checking if player is banned -
[TC]XxJuggaloxX - 15.02.2013
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
Re: Banning through MySQL and checking if player is banned -
PaulDinam - 15.02.2013
I know already, anyway doesn't work.