SetTimer Problem - 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: SetTimer Problem (
/showthread.php?tid=598136)
SetTimer Problem -
SpikY_ - 09.01.2016
Hi, I have a Problem with SetTimer.
This Timer is of 5 minute, When this timer gets over. a New Timer gets set "
NexMode" which is set to 14 seconds. but its getting load before 14 seconds.
Код:
public OnGameModeInit()
{
Timer2 = SetTimer("NoExplode",300000,false);
return 1;
}
Код:
forward NoExplode(playerid);
public NoExplode(playerid)
{
SetTimer("NexMode", 14000, false);
SendClientMessageToAll(-1, "{E1CC2B}» Employers have successfully defended their Ship from being attacked by terrorist.");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == TEAM_ARMY)
{
MissionPassed(i);
GivePlayerMoney(i, 4000);
SetPlayerScore(i,GetPlayerScore(i)+3);
SendClientMessage(i,-1,"{7C7C7C}» You've Recieved 3 Points and $4,000 for Completing the mission Objective.");
PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
}
else if(gTeam[i] == TEAM_TERRIOST)
{
MissionFailed(i);
PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
GivePlayerMoney(i, -2000);
SendClientMessage(i,-1,"{FF0000}» You've Lost -$2000 Money for not completing the Mission Objective.");
}
}
}
return 1;
}
its like when 5 minutes passed, The Nexmode loads suddenly instead of waiting 14 seconds.
Re: SetTimer Problem -
valych - 09.01.2016
Show us your MissionPassed and MissionFailed functions please.
Re: SetTimer Problem -
SpikY_ - 09.01.2016
Код:
MissionPassed(playerid)
{
TextDrawShowForPlayer(playerid, Textdraw50);
TextDrawShowForPlayer(playerid, Textdraw51);
TextDrawShowForPlayer(playerid, Textdraw52);
TextDrawShowForPlayer(playerid, Textdraw53);
TextDrawShowForPlayer(playerid, Textdraw54);
TextDrawShowForPlayer(playerid, Textdraw55);
TextDrawShowForPlayer(playerid, Textdraw58);
}
MissionFailed(playerid)
{
TextDrawShowForPlayer(playerid, Textdraw60);
TextDrawShowForPlayer(playerid, Textdraw61);
TextDrawShowForPlayer(playerid, Textdraw62);
TextDrawShowForPlayer(playerid, Textdraw63);
TextDrawShowForPlayer(playerid, Textdraw64);
TextDrawShowForPlayer(playerid, Textdraw65);
TextDrawShowForPlayer(playerid, Textdraw68);
}
now? -.-
Re: SetTimer Problem -
xTURBOx - 09.01.2016
erm, try it after other things
PHP код:
public NoExplode(playerid)
{
SendClientMessageToAll(-1, "{E1CC2B}» Employers have successfully defended their Ship from being attacked by terrorist.");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == TEAM_ARMY)
{
MissionPassed(i);
GivePlayerMoney(i, 4000);
SetPlayerScore(i,GetPlayerScore(i)+3);
SendClientMessage(i,-1,"{7C7C7C}» You've Recieved 3 Points and $4,000 for Completing the mission Objective.");
PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
}
else if(gTeam[i] == TEAM_TERRIOST)
{
MissionFailed(i);
PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
GivePlayerMoney(i, -2000);
SendClientMessage(i,-1,"{FF0000}» You've Lost -$2000 Money for not completing the Mission Objective.");
}
}
}
SetTimer("NexMode", 14000, false);
return 1;
}
Re: SetTimer Problem -
SpikY_ - 09.01.2016
Still same.
Re: SetTimer Problem -
SecretBoss - 09.01.2016
Try to kill the timer
It will may not help since Timers are bugged from samp, what you can do is like creating a variable and set it to 14 then after 1 sec passes decrease 1 from the variable, so when it is 0 means that 14 seconds passed