SA-MP Forums Archive
MySQL creates 13 rows in the database? - 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: MySQL creates 13 rows in the database? (/showthread.php?tid=425591)



MySQL creates 13 rows in the database? - FunnyBear - 26.03.2013

Hey, I added this to my OnPlayerUpdate for JetPack hacks, but when I get banned for it, it creates 13 rows in the table when its only supposed to be 1! Please help

pawn Код:
new
            query[315], IP[16], Name[MAX_PLAYER_NAME];
        GetPlayerIp(playerid, IP, sizeof(IP));

        GetPlayerName(playerid, Name, sizeof(Name));

        format(Dialog, sizeof(Dialog), "{FF0000}You are banned from this server! Ban details:\n\n{FF0000}Name:{FFFFFF} %s \n{FF0000}IP:{FFFFFF} %s\n{FF0000}Reason:{FFFFFF} Jetpack Hacks \n{FF0000}Banned By:{FFFFFF} Anti - Cheat\n\n{FF0000}You will never unbanned!\n\n{FF0000}If you think this ban is unfair, you can apply for an unban appeal at our forums\n{FF0000}Note - We do not unban hackers, or people who lie in their appeal", Name, IP);
        ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "{FF0000}Banned!", Dialog, "Close", "");

        format(query,sizeof(query), "INSERT INTO bans (Name, IP, Reason, BannedBy, Date, Status) VALUES('%s', '%s', 'Jetpack Hacks', 'Anti - Cheat', NOW(), '1')", GetName(playerid), IP, gettime());
        mysql_query(query);



Re: MySQL creates 13 rows in the database? - Macluawn - 26.03.2013

OnPlayerUpdate is called a few times after they are banned.


Re: MySQL creates 13 rows in the database? - FunnyBear - 26.03.2013

So what do I change it to to stop it from creating 13 rows


Re: MySQL creates 13 rows in the database? - Macluawn - 26.03.2013

pawn Код:
public OnPlayerUpdate(playerid)
{
    //don't need to keep checking if they are banned
    //they may send some more updates while they are being kicked
    if(GetPVarInt(playerid,"banned")) return 1;
    //...
}
(taken from anti cheat tips)


Re: MySQL creates 13 rows in the database? - Vince - 26.03.2013

Don't use OnPlayerUpdate if you don't know what it's used for. Certainly don't do I/O in OPU.