Problem with timer
#1

Top:
PHP код:
new statstimer
OnPlayerSpawn:
PHP код:
    statstimer SetTimerEx("statsrefresh"1001"i"playerid); 
OnPlayerDisconnect:
PHP код:
KillTimer(statstimer); 
So the timer works correctly, but it doesnt kill the timer for the ID that disconnected..
Reply
#2

PHP код:
// At the top of your script
new statstimer[MAX_PLAYERS];
// --
statstimer[playerid] = SetTimerEx("statsrefresh"1001"i"playerid);
KillTimer(statstimer[playerid]); 
Edited:
Whenever the player spawns, another timer for the same player will activate.. so you will have tons of timers running and it may cause lag. You should consider moving this on player connect.

But why do you refresh stats like this at all?
Reply
#3

Quote:
Originally Posted by kovac
Посмотреть сообщение
PHP код:
// At the top of your script
new statstimer[MAX_PLAYERS];
// --
statstimer[playerid] = SetTimerEx("statsrefresh"1001"i"playerid);
KillTimer(statstimer[playerid]); 
Edited:
Whenever the player spawns, another timer for same player will activate.. so you will have tons of timers running, you may consinder moving this on player connect.

But why do you refresh stats like this at all?
A timer is the way since OnPlayerUpdate can be easily gets corrupted and lag the server, i wont show it on the connection because
Reply
#4

Why don't you simply save the player statistic on player disconnect and load it on player connect/login? You don't need any timers nor anything similar.
Reply
#5

Quote:
Originally Posted by kovac
Посмотреть сообщение
Why don't you simply save the player statistic on player disconnect and load it on player connect/login?
These are TD's refreshing showing your stats on screen, i save it throught mysql and load it aswell with these 2 callbacks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)