playertopoint ? - 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: playertopoint ? (
/showthread.php?tid=73692)
playertopoint ? -
madman227 - 17.04.2009
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;
}
Re: playertopoint ? -
Joe Staff - 17.04.2009
EDIT* Misread script. You are letting the loop run again after the timers are killed. put 'return 1;' or 'break;' after your last function
Re: playertopoint ? -
Backwardsman97 - 17.04.2009
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.
Re: playertopoint ? -
madman227 - 17.04.2009
backwardsman97 how would i go about doing that?
Re: playertopoint ? -
Backwardsman97 - 17.04.2009
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.
Re: playertopoint ? -
madman227 - 17.04.2009
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