playertopoint ?
#1

i made a race filterscript and when one player enters the point it works correctly but when two players enter at the same time like if theres a passenger in the car it makes the timers go crazy so the question is is it possable to set the playertopoint so that if two players enter at the same time it will only activate once?

Below is my starting point of the race

Код:
public Exrace2Start ()
{
  
  for(new i=0; i<MAX_PLAYERS; i++)
  {
  if (IsPlayerConnected(i)) {
  new Float:x, Float:y, Float:z;
  GetPlayerPos(i, Float:x, Float:y, Float:z);
  if (PlayerToPoint(9.0, i, -3159.6648,-804.7092,10.4532)) 
  {
  print("Exrace2Start");
  GameTextForAll("~g~The Race Will Now Be Starting",3000,3);
  KillTimer(StartCheck);
  KillTimer (RestartRace);
  KillTimer (MasterReset);
  KillTimer(EnableMasterReset5);
  SetTimer("StartCountDown", 4000, 0);
  StartInTheLead1 = SetTimer("InTheLead1",200, 1);
  EnableMasterReset1 = SetTimer("RaceReset",120000 , 0);
  }
  }
 }
  return 1;
}
Reply
#2

EDIT* Misread script. You are letting the loop run again after the timers are killed. put 'return 1;' or 'break;' after your last function
Reply
#3

Wow that's a lot of timers. You can create a global boolean variable to represent if the timer has been set yet. Yay 1337 post count.
Reply
#4

backwardsman97 how would i go about doing that?
Reply
#5

It was cool having 1337 posts but now I gotta help :P

pawn Код:
public Exrace2Start ()
{
  for(new i=0; i<MAX_PLAYERS; i++)
  {
    if (PlayerToPoint(9.0, i, -3159.6648,-804.7092,10.4532))
    {
      print("Exrace2Start");
      GameTextForAll("~g~The Race Will Now Be Starting",3000,3);
      KillTimer(StartCheck);
      KillTimer (RestartRace);
      KillTimer (MasterReset);
      KillTimer(EnableMasterReset5);
      SetTimer("StartCountDown", 4000, 0);
      StartInTheLead1 = SetTimer("InTheLead1",200, 1);
      EnableMasterReset1 = SetTimer("RaceReset",120000 , 0);
      return 1;
    }
  }
  return 1;
}
Just do it like that how huntr said.
Reply
#6

ok thanks ill try that and yes alot of timers but only two are runing at one time lol

Edit Thanks guyes that fixed it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)