Timer 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Timer problem (
/showthread.php?tid=181395)
Timer problem -
nejc001 - 05.10.2010
When i write /lol after 5 seconds it should teleport me to some position i set.
Check this.
Code:
forward loltimer(); // at top
if(!strcmp(cmdtext, "/lol", true)) // in "public OnPlayerCommandText(playerid, cmdtext[])"
{
SetTimer("loltimer", 5000, false);
return 1;
}
return 1;
}
public loltimer()
{
SetPlayerPos(playerid,2482.2227,-1646.2852,18.3521);
return 1;
}
I get error that "playerid" in "SetPlayerPos" line is not defined. I Dont Know what to do.
Re: Timer problem -
Matej_ - 05.10.2010
Try this:
pawn Code:
new loltimer; // at the top
forward loltimer(); // at top
if(!strcmp(cmdtext, "/lol", true)) // in "public OnPlayerCommandText(playerid, cmdtext[])"
{
loltimer = SetTimer("loltimer", 5000, false);
return 1;
}
public loltimer()
{
SetPlayerPos(playerid,2482.2227,-1646.2852,18.3521);
return 1;
}
Re: Timer problem -
Bumbis - 05.10.2010
pawn Code:
forward loltimer(playerid);
if(!strcmp(cmdtext,"/lol",true))
{
SetTimerEx("loltimer", 5000, false,"i",playerid);
return 1;
}
public loltimer(playerid)
{
SetPlayerPos(playerid,2482.2227,-1646.2852,18.3521);
return 1;
}
Re: Timer problem -
nejc001 - 05.10.2010
OK, tnx, works.