Agian Timer Problems! [NEED HELP] -
matthewdriftking - 05.08.2010
Ok, So today i add a new command and i dont know why this wont work. I've got some other's teleports with Timer and they are working, I'll copy the same code to this and this doesnt work :/
Here's the code
pawn Код:
on top of script
new stunt2timer;
pawn Код:
and on playerdissconnect
KillTimer(stunt2timer);
pawn Код:
if(strcmp("/stunt2", cmdtext, true, 10) == 0)
{
SetPlayerInterior(playerid,0);
GameTextForPlayer(playerid, "Objects Loading..", 1000, 1);
stunt2timer = SetTimerEx("FreezeTimer",3000,0,"d",playerid);
SetPlayerPos(playerid, 465.7092,-2250.7974,24.2511);
SendClientMessage(playerid, COLOR_YELLOW, "You have been teleported!");
return 1;
It just do nothing, The GameTextForPlayer appear and the timer doesnt work
Re: Agian Timer Problems! [NEED HELP] -
[MWR]Blood - 05.08.2010
pawn Код:
//top of script:
new stunt2timer;
//under ongamemodeinit:
stunt2timer = SetTimerEx("FreezeTimer",3000,0,"d",playerid);
if(strcmp("/stunt2", cmdtext, true, 10) == 0)
{
SetPlayerInterior(playerid,0);
GameTextForPlayer(playerid, "Objects Loading..", 1000, 1);
SetTimerEx("FreezeTimer",3000,0,"d",playerid);
SetPlayerPos(playerid, 465.7092,-2250.7974,24.2511);
SendClientMessage(playerid, COLOR_YELLOW, "You have been teleported!");
return 1;
}
Re: Agian Timer Problems! [NEED HELP] -
matthewdriftking - 05.08.2010
Quote:
Originally Posted by ikarus
pawn Код:
//top of script: new stunt2timer; //under ongamemodeinit: stunt2timer = SetTimerEx("FreezeTimer",3000,0,"d",playerid);
if(strcmp("/stunt2", cmdtext, true, 10) == 0) { SetPlayerInterior(playerid,0); GameTextForPlayer(playerid, "Objects Loading..", 1000, 1); SetTimerEx("FreezeTimer",3000,0,"d",playerid); SetPlayerPos(playerid, 465.7092,-2250.7974,24.2511); SendClientMessage(playerid, COLOR_YELLOW, "You have been teleported!"); return 1; }
|
Should I delete the timer from the cmd?
Re: Agian Timer Problems! [NEED HELP] -
JaTochNietDan - 05.08.2010
Why do you even need to store the timers ID, it's not repeating so you won't be needing to kill it.
Can we see public FreezeTimer function please? Also shouldn't that teleport be more like
pawn Код:
if(strcmp("/stunt2", cmdtext, true, 10) == 0)
{
SetPlayerInterior(playerid,0);
GameTextForPlayer(playerid, "Objects Loading..", 1000, 1);
TogglePlayerControllable(playerid,false);
SetTimerEx("FreezeTimer",3000,0,"d",playerid);
SetPlayerPos(playerid, 465.7092,-2250.7974,24.2511);
SendClientMessage(playerid, COLOR_YELLOW, "You have been teleported!");
return 1;
}
Since I assume you're trying to freeze them for 3 seconds then unfreeze them with FreezeTimer...?
There's no need for stunt2timer variable for this timer.
Re: Agian Timer Problems! [NEED HELP] -
matthewdriftking - 05.08.2010
pawn Код:
public FreezeTimer(playerid)
{
TogglePlayerControllable(playerid,1);
return 1;
}
Re: Agian Timer Problems! [NEED HELP] -
JaTochNietDan - 05.08.2010
Quote:
Originally Posted by matthewdriftking
pawn Код:
public FreezeTimer(playerid) { TogglePlayerControllable(playerid,1); return 1; }
|
Then all you need is this
pawn Код:
if(strcmp("/stunt2", cmdtext, true, 10) == 0)
{
SetPlayerInterior(playerid,0);
GameTextForPlayer(playerid, "Objects Loading..", 1000, 1);
TogglePlayerControllable(playerid,false);
SetTimerEx("FreezeTimer",3000,0,"d",playerid);
SetPlayerPos(playerid, 465.7092,-2250.7974,24.2511);
SendClientMessage(playerid, COLOR_YELLOW, "You have been teleported!");
return 1;
}
Forget about KillTimer and new stunt2timer.
Re: Agian Timer Problems! [NEED HELP] -
matthewdriftking - 05.08.2010
Quote:
Originally Posted by JaTochNietDan
Then all you need is this
pawn Код:
if(strcmp("/stunt2", cmdtext, true, 10) == 0) { SetPlayerInterior(playerid,0); GameTextForPlayer(playerid, "Objects Loading..", 1000, 1); TogglePlayerControllable(playerid,false); SetTimerEx("FreezeTimer",3000,0,"d",playerid); SetPlayerPos(playerid, 465.7092,-2250.7974,24.2511); SendClientMessage(playerid, COLOR_YELLOW, "You have been teleported!"); return 1; }
Forget about KillTimer and new stunt2timer.
|
Oh Thanks alot man, Only kill the timers when i have SetTimer(...); only?
Re: Agian Timer Problems! [NEED HELP] -
JaTochNietDan - 05.08.2010
Quote:
Originally Posted by matthewdriftking
Oh Thanks alot man, Only kill the timers when i have SetTimer(...); only?
|
You only really need to kill timers if they repeat or are quite long.