SA-MP Forums Archive
Help With MySqL - 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: Help With MySqL (/showthread.php?tid=482823)



Help With MySqL - donhu789 - 23.12.2013

Guys , Can Anyone help me With Automatic Save Stats With 15 Mins

my Code Are SaveStats(playerid);


i need a Timer to make it SaveStats Automatic becoz player do /savestats kind boring please help


Re: Help With MySqL - [DK]Dark_Knight - 23.12.2013

pawn Код:
//Under OnGamemodeInt
SetTimer("FifteenMinuteTimer", 900000, true);

forward FifteenMinuteTimer();
public FifteenMinuteTimer()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            SaveStats(i);
        }
    }
}



Re: Help With MySqL - donhu789 - 23.12.2013

can i make it each 10 seconds ?


Re: Help With MySqL - [DK]Dark_Knight - 23.12.2013

Yes you can, but its probably not recomended. I would make it so it saves player stats when they disconnect or get killed.

change
pawn Код:
SetTimer("FifteenMinuteTimer", 900000, true);
to
pawn Код:
SetTimer("FifteenMinuteTimer", 10000, true);



Re: Help With MySqL - donhu789 - 23.12.2013

ya can you make is whent day get killed or Disconnect please that what i wanted


and also please help with this

https://sampforum.blast.hk/showthread.php?tid=482825


Re: Help With MySqL - [DK]Dark_Knight - 23.12.2013

Very demanding.

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    SaveStats(playerid);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    SaveStats(playerid);
    SaveStats(killerid);
    return 1;
}



Re: Help With MySqL - donhu789 - 23.12.2013

Ty you Are Greet i gonna add your credits in my server