SA-MP Forums Archive
MySQL save while Kick/Ban - 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 save while Kick/Ban (/showthread.php?tid=673529)



MySQL save while Kick/Ban - MichiCZ - 29.03.2020

Hello guys, can u please help me with my problem?

Using MySQL for saving stats, everythinks work fine while normal disconnect, but when i call Kick or Ban player, his account didnt save (save with 0 value). Any solutions?


Re: MySQL save while Kick/Ban - SiaReyes - 29.03.2020

Actually, I have an idea. Delay the ban/kick and save the player data before kick/ban.


Re: MySQL save while Kick/Ban - Nuginity - 30.03.2020

hmmm try to "UPDATE" or "INSERT INTO" banned database, everytime you ban the player. Actually this method its very safe than saving ban data every player disconnect


Re: MySQL save while Kick/Ban - brianrestup - 30.03.2020

Why not try to, Make a timer when the player will be kicked or banned, before that save the call save account


Re: MySQL save while Kick/Ban - GeorgeLimit - 30.03.2020

Maybe this can solved
Code:
new kickuser;
CMD:kick(playerid, params[])
{
    if(params != INVALID_PLAYER_ID || params != playerid)
    {
        if(sscanf(params, "i", kickuser)){
            //Your save Callback or Code
            SetTimerEx("KickUser",10000,0,"i",kickuser); //10 Second is better with callback
        }
     }
     return 1;
}
forward KickUser(kickuser);
public KickUser(kickuser)
{
     Kick(kickuser);
     return 1;
}