SA-MP Forums Archive
Endless teleporting? - 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)
+--- Thread: Endless teleporting? (/showthread.php?tid=532203)



Endless teleporting? [RESOLVED] - Aerotactics - 17.08.2014

This timer is teleporting me back and forth repeatedly.




Re: Endless teleporting? - [KHK]Khalid - 17.08.2014

Is Portal_Timer called by a repeating timer?


Re: Endless teleporting? - Aerotactics - 17.08.2014

Quote:
Originally Posted by [KHK]Khalid
Посмотреть сообщение
Is Portal_Timer called by a repeating timer?
Yes. Which is why I created the boolean Portalled to tell if they had already went through the portal. Once they leave the portal range (currently 3 (feet?)) then it changes to tell that the player can portal again once entering. Corrected a typo up top.


Re: Endless teleporting? - ]Rafaellos[ - 17.08.2014

Is it teleporting for the Point1 to the Point2 then from the Point2 to the Point1 and repeating?


Re: Endless teleporting? - Aerotactics - 17.08.2014

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
Is it teleporting for the Point1 to the Point2 then from the Point2 to the Point1 and repeating?
Yup. Which is why the boolean should have been preventing endless teleporting.


Re: Endless teleporting? - [KHK]Khalid - 17.08.2014

So your script is supposed to handle too many portals (as the loop tells), isn't it? Well, I bet that this loop can never check any other portals than ID (i) 0 due to the way you use return inside the loop. Simply remove the return in else statement, this might not solve your main problem though, but it will surely make it check other portals.


Re: Endless teleporting? - Aerotactics - 17.08.2014

Quote:
Originally Posted by [KHK]Khalid
Посмотреть сообщение
So your script is supposed to handle too many portals (as the loop tells), isn't it? Well, I bet that this loop can never check any other portals than ID (i) 0 due to the way you use return inside the loop. Simply remove the return in else statement, this might not solve your main problem though, but it will surely make it check other portals.
Right. I should be using break rather.

EDIT: Resolved, thanks guys.


Re: Endless teleporting? - [KHK]Khalid - 17.08.2014

Quote:
Originally Posted by Aerotactics
Посмотреть сообщение
Right. I should be using break rather.
On the else statement? No, don't use break or return. You should let the loop continue checking other portals (tell me if you don't get this part). On if or else-if statements, it doesn't matter since you have no code after the loop so break or return both of them will get the job done.


Re: Endless teleporting? - Aerotactics - 17.08.2014

Quote:
Originally Posted by [KHK]Khalid
Посмотреть сообщение
On the else statement? No, don't use break or return. You should let the loop continue checking other portals (tell me if you don't get this part). On if or else-if statements, it doesn't matter since you have no code after the loop so break or return both of them will get the job done.
Yup, worked this part out on my own.