Timer Problem -
Blackazur - 06.05.2013
Hello, i have an Timer Problem with this, i think this is the problem, when players joining the server etc all works but when all log off and logging again in the time duplicate and the timer counts 2-3 seconds and not more 1 second and very fast, why is that so? Can you fix it, please? Thanks.
Код:
TimeConvert(time)
{
new minutes;
new seconds;
new string[128];
if(time > 59){
minutes = floatround(time/60);
seconds = floatround(time - minutes*60);
if(seconds>9)format(string,sizeof(string),"%d:%d",minutes,seconds);
else format(string,sizeof(string),"%d:0%d",minutes,seconds);
}
else{
seconds = floatround(time);
if(seconds>9)format(string,sizeof(string),"0:%d",seconds);
else format(string,sizeof(string),"0:0%d",seconds);
}
return string;
}
AW: Timer Problem -
Blackazur - 06.05.2013
someone?
AW: Timer Problem -
Nero_3D - 06.05.2013
It looks like that you start at OnPlayerConnect with SetTimerEx for each player one timer
But you never kill them at OnPlayerDisconnect?
AW: Timer Problem -
Blackazur - 06.05.2013
No i dont have any timer on onplayerconnect but this problem still happen, and i dont know why. Can you help me please?
AW: Timer Problem -
Nero_3D - 06.05.2013
It has to do something with the timer that increased your time variable
Check where you start that timer, maybe it gets called any other way around twice ?
If you say that that only happens if player reconnects you should look into OnPlayerConnect again, their is no other reason :/
pawn Код:
TimeConvert(time) {
new
string[8]
;
format(string, sizeof string, "%d:%02d", time / 60, time % 60);
return string;
}
AW: Timer Problem -
Blackazur - 07.05.2013
My OnPlayerConnect:
Код:
public OnPlayerConnect(playerid)
{
ShowPlayerDialog(playerid,-1, 0, " ", " ", " ", " ");
RemoveBuildingForPlayer(playerid, 1231, 2435.4688, 1642.1406, 12.5391, 0.25);
RemoveBuildingForPlayer(playerid, 1231, 2397.3750, 1663.2266, 12.6719, 0.25);
RemoveBuildingForPlayer(playerid, 1231, 2435.4688, 1682.6094, 12.5469, 0.25);
RemoveBuildingForPlayer(playerid, 1215, 2447.4922, 1668.6172, 10.3516, 0.25);
RemoveBuildingForPlayer(playerid, 1231, 2453.3359, 1663.2266, 12.5391, 0.25);
RemoveBuildingForPlayer(playerid, 1231, 2477.3984, 1663.2266, 12.6719, 0.25);
new playername[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid,PlayerName(playerid),MAX_PLAYER_NAME);
GetPlayerName(playerid, playername, sizeof(playername)); {}
format(str, sizeof(str), "» Player %s (%d) has joined the server.", playername,playerid);
SendClientMessageToAll(0xAAAAAAFF, str);
PlayAudioStreamForPlayer(playerid,"http://1in.kz/s/music/1309492045_zombie-nation-kernkraft-400.mp3");
SendClientMessage(playerid,-1,""chat""COL_GOLD" |__________ Welcome to ZombieMod-X™! __________|");
SendClientMessage(playerid,-1,""chat""COL_ORANGE" Make Sure You Read The Rules /rules!");
SendClientMessage(playerid,-1,""chat""COL_LGREEN" Visit Our Site: www.zombiemod-x.tk!");
SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" Add the Server to the Favourites: 84.200.21.45:23520!");
SendClientMessage(playerid,-1,""chat""COL_LGREEN" |__________________________________________ _|");
oPlayers++;
ResetVars(playerid);
new Query[300],string[128],pname[24],escpname[24];
GetPlayerName(playerid,pname,24);
mysql_real_escape_string(pname, escpname);
format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `Username` = '%s'", escpname);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
format(string,sizeof(string),""chat" Welcome back %s to "NAME"!\nPlease login to continue.",PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_BLUE"{00FF00}Login"COL_WHITE" Panel",string,"Login","Quit");
}
else
{
format(string,sizeof(string),""chat" Welcome %s to "NAME"!\nPlease register to continue.",PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_RED"Register"COL_WHITE" Panel",string,"Register","Quit");
}
mysql_free_result();
return 1;
}
AW: Timer Problem -
Blackazur - 07.05.2013
Please help me...
AW: Timer Problem -
Nero_3D - 07.05.2013
Looks fine, could it be that you start a timer in the login dialog ?
Where do you start the timer which increased the time variable ?
AW: Timer Problem -
Blackazur - 07.05.2013
All my timers on ongamemodeinit:
Код:
SetTimer("OnUpdatePlayer",1000,true);
SetTimer("RandomMessages",59000,true);
SetTimer("CheckVars",1500,true);
SetTimer("pausecheck", 3000, true);
and other timers:
Код:
SetTimer("EndMap",MAX_END_TIME,false);
Код:
#define MAX_END_TIME 10000
AW: Timer Problem -
Blackazur - 07.05.2013
or how to make that the timer stops when 0 players on the server? ^^