SA-MP Forums Archive
score help rep+ - 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: score help rep+ (/showthread.php?tid=363532)



score help rep+ - Dare Devil..... - 27.07.2012

Hey I need help making a score command like after a player have played 6 hours in the server his score increases and agin if player have played .six hours his score invrease by 1 more but I want that when a player logsout and come back his time starts again from where he left please help (rep ++)


Re: score help rep+ - Kitten - 27.07.2012

I wouldn't do it this way but i would use a timer when a player connects then i would create a variable attached tot that timer, then i convert 6 hours into milliseconds (21600000) then set that timer for that players with that much amount of milliseconds then use SetPlayerScore(playerid,GetPlayerScore(playerid)+1 );

Make sure you create a callback with that timer running into.

Example:
pawn Код:
new playedtimer[MAX_PLAYERS];
forward TimeOnServer(playerid);

public OnPlayerConnect(playerid)
{
    playedtimer[playerid] = SetTimerEx("TimeOnServer", 21600000, 1, "i", playerid);
        return 1;
}

public TimeOnServer(playerid) return SetPlayerScore(playerid,GetPlayerScore(playerid) +1); // use KillTimer(playedtimer); to stop the timer mostly used for when a player disconnects.



Re: score help rep+ - Dare Devil..... - 28.07.2012

I want the timer continues if a player even log off when he get back the timer continues from there.