SA-MP Forums Archive
Timer issues.... - 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 issues.... (/showthread.php?tid=162616)



Timer issues.... - mastasquizy - 24.07.2010

Ok, real simple problem here. I wanna set a timer to do something in a given time (obviously...)

at the top I put:
Код:
forward Time();
Then here I put:
Код:
DropFlag(playerid)
{
	new str[256];
    if(PlayerStat[playerid][pflag])
	{
	    new Float:x,Float:y,Float:z;
	    GetPlayerPos(playerid,x,y,z);
	    DestroyObject(flag[PlayerStat[playerid][pflag]]);
		format(str,sizeof(str),"[%d]%s has dropped the flag! It will return to its orgin in 30 seconds.",playerid,PlayerName(playerid));
		SendClientMessageToAll(GetPlayerColor(playerid),str);
		dflag[PlayerStat[playerid][pflag]] = CreatePickup(2993,1,x,y,z,0);
		PlayerStat[playerid][pflag]=0;
		SetTimer("Time",3000,0);
	}
	return 1;
}
Then here goes..:
Код:
public Time()
{
	DropTimer();
}

DropTimer()
{
	if(drop[1])
	{
   		DestroyPickup(dflag[1]);
   		lsflag1 = CreatePickup(2993,1,2528.657715, -1666.986938, 14.863762);
                //code continues and is ended with no syntax errors, etc...........
The problem is simple.......THIS DOESN'T HAPPEN IN THE GAME....why?


Re: Timer issues.... - c-middia - 24.07.2010

SetTimer("DropTimer",1000,1); ?


Re: Timer issues.... - mastasquizy - 25.07.2010

Fixed........apperently my if statement weren't true to begin with. "Drop" wasn't assigned anything yet therefore it was still set to 0 xD