SA-MP Forums Archive
[SOLVED] CountDown.. - 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: [SOLVED] CountDown.. (/showthread.php?tid=85290)



[SOLVED] CountDown.. - borisblat - 06.07.2009

I've a drift script, that i made witch you can invite somebody to a drift.. after he confirm that
you teleport with him to some place and there is a count down

new Count = 6;

Код:
forward CountDown();
public CountDown()
{
	new String[256];
	for (new i = 0; i < MAX_PLAYERS; i++)
	{
		if (Drift[i] == 1)
		{
       format(String, 256,"~r~~h~%d",Count);
       GameTextForPlayer(i,String,1000,6);
       if (Count > 0)
       {
			   Count --;
			   CountDown();
	     }
       else
       {
         format(String, 256,"~g~~h~GO");
         GameTextForPlayer(i,String,1000,6);
       }
    }
  }
	UnFreeze();
	Count = 6;
}

forward UnFreeze();
public UnFreeze()
{
	for (new i = 0; i < MAX_PLAYERS; i++)
  {
		if (Drift[i] == 1)
    {
      TogglePlayerControllable(i, 1);
    }
	}
	Count = 6;
}
why the count down won't work?


Re: [Help] CountDown.. - dice7 - 06.07.2009

Try return 1; after Count --;
CountDown();


Re: [Help] CountDown.. - Jefff - 06.07.2009

Код:
forward CountDown();
public CountDown()
{
	new String[64];
	for(new i = 0; i < GetMaxPlayers(); i++) if(IsPlayerConnected(i))
	{
		if(Drift[i] == 1)
		{
			format(String, 64,"~r~~h~%d",Count);
			GameTextForPlayer(i,String,1000,6);
		}
	}
	Count--;
	if(Count > 0)
	{
		SetTimer("CountDown",1000,false);
	}
	else
	{
		format(String, 64,"~g~~h~GO");
		for(new i = 0; i < GetMaxPlayers(); i++)
		{
			if(Drift[i] == 1)
			{
				TogglePlayerControllable(i, 1);
				GameTextForPlayer(i,String,1000,6);
			}
		}
		Count = 6;
	}
}



Re: [Help] CountDown.. - borisblat - 06.07.2009

Well, it wasn't niether of this comments but i found the bug..
=]
SOLVED.