score help rep+
#1

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 ++)
Reply
#2

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.
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)