SA-MP Forums Archive
[HELP] Problem with unfreezing - 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: [HELP] Problem with unfreezing (/showthread.php?tid=94590)



[HELP] Problem with unfreezing - arnutisz - 30.08.2009

I created drag filterscript. When drag starts, countdown shows up for player in drag. But only one of players is unfrozen, and when countdown reaches "0" instead of "GO GO GO" comes up "6" and I don't know why. Here is code:

pawn Код:
forward CountAndStart();
public CountAndStart()
{
    count--;
    new string[15];
    for(new i; i<MAX_PLAYERS; i++)
    {
      if(IsPlayerConnected(i))
    {
            if(InRace[i] == true)
            {
              if(count > 0)
              {
                format(string, 15, "~y~%d", count);
                PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
              }
              else
              {
                    TogglePlayerControllable(i, true);
                    format(string, 15, "~g~GO GO GO");
                PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
                count = 6;
                KillTimer(timer);
              }
              GameTextForPlayer(i, string, 1000, 3);
            }
        }
    }
}



Re: [HELP] Problem with unfreezing - Chaprnks - 30.08.2009

count = 6; shouldn't be in that location. The count will -- then go back to 6.


Re: [HELP] Problem with unfreezing - arnutisz - 30.08.2009

But this don't solve problem.


Re: [HELP] Problem with unfreezing - JR ! - 30.08.2009

If you're Gamemode is something where they have an option whether they want to be in the race or not, then I might have a solution, but I'm made new timers because I just retyped it real quick.. I'm sure you'll know what I've done, I tested it and it worked on my pc I'll just cut the bits that you need.


Код:
//forwards
OneSecondTimer();
OnRaceStart(playerid);

new count;
new InRace[MAX_PLAYERS];

//OnGameModeInit
SetTimer("OneSecondTimer", 1000, true);

//Where ever you set the players stats to "0" Most likely OnPlayerConnect
InRace[playerid] = 0;



public OnRaceStart(playerid)
{
	if(InRace[playerid] == 1)
	{
	  TogglePlayerControllable(playerid, false);
		count = 6;
	}
	return 1;
}

//I just made another one second timer because you didn't put SetTimer, so I assumed there is more //coding to this.
public OneSecondTimer()
{
  new string[64];
  for(new i; i<MAX_PLAYERS; i++)
  {
	  if(IsPlayerConnected(i))
	  {
	    if(InRace[i] == 1)
	    {
			if(count > 0)
			{
			  count -= 1;
			  format(string, 15, "~y~%d", count - 1);
    		  PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
			}
		 	if(count == 1)
 		 	{
    		  TogglePlayerControllable(i, true);
	  	      format(string, 15, "~g~GO GO GO");
	 	      PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
			}
			GameTextForPlayer(i, string, 1000, 3);
		 }
	  }
   }
   return 1;
}