Question regarding Timers
#1

Hey guys, I used to build both Server timers or player timers, but I need you to tell me what do you think is better
While scripting my jail CMD I thought what's better, PlayerTimer which will be called when the time ends
Example:
time = minutes in prison
time * 60000 = minutes in milliseconds
SetTimerEx("PrisonTimer", time * 60000, 0, "i", playerb);

or shall I use server timer:
OnGameModeInit:
SetTimer("PrisonTimer, 1000, 1);
Which will be called every second

or shall I use server timer per minute, not per second:
SetTimer("PrisonTimer, 60000, 1);

What's the best way ?
Reply
#2

In my opinion its better to use a player based Timer.

That would also be easier to save of the player disconnects while he has to sit some time in prison. So of he has to sitin there for 30 minutes bu already where 17 of Thema in prison, you can load the other 13 minutes directly from bis database-entry/userfile.

(Written with phones autocorrection , f#ck)
Reply
#3

Well i think A playerbased timer on gamemodeint
(the reason is you can use this timer to check for several things)
Reply
#4

@xTURBOx
OnGameModeInit dosnt even have the option (usualy) to use playerid a parameter. Also i can not recommend to start a global timer for MAX_PLAYERS in OnGameModeInit.
Reply
#5

Quote:
Originally Posted by GangstaSunny
Посмотреть сообщение
@xTURBOx
OnGameModeInit dosnt even have the option (usualy) to use playerid a parameter. Also i can not recommend to start a global timer for MAX_PLAYERS in OnGameModeInit.
GetPlayerPoolSize
Reply
#6

@xTURBOx
GetPlayerPoolSize does just get the highest playerid which is connected to the server. OnGameModeInit only starts once the server starts, at this moment there are no players connected.
Reply
#7

I remember ****** once saying that multiple timers with smaller code are better than 1 timer with a lot of code.
Reply
#8

@GangstaSunny
you made me wonder, what GetPlayerPoolSize returns when no player is connected

@Stinged
Could be true,
I think i the best to find out is by conducting tests
Reply
#9

@xTURBOx
obv. 0
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)