SA-MP Forums Archive
OnVehicleSpeed - 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: OnVehicleSpeed (/showthread.php?tid=511137)



OnVehicleSpeed - Trynda - 04.05.2014

Hello,

where do i put some explosions when the vehicle speed is 30 KpH ??

thanks


Re: OnVehicleSpeed - Yazzu - 04.05.2014

OnPlayerUpdate


Re: OnVehicleSpeed - RajatPawar - 04.05.2014

Quote:
Originally Posted by Yazzu
Посмотреть сообщение
OnPlayerUpdate
You don't know what you are talking about, OPU gets called a very large and unpredictable number of times per second, which is unnecessary for this. (Imagine calculating speed of vehicles 20 - 30 times per second)

You need to calculate the speed of the vehicle under a per second timer (I don't really see a 500ms timer required)
and then check if the speed is more than 30, if yes, get the position and create explosions where necessary. You can look at this thread for information about vehicle speeds.


Re: OnVehicleSpeed - Trynda - 04.05.2014

Quote:
Originally Posted by RajatPawar
Посмотреть сообщение
You don't know what you are talking about, OPU gets called a very large and unpredictable number of times per second, which is unnecessary for this. (Imagine calculating speed of vehicles 20 - 30 times per second)

You need to calculate the speed of the vehicle under a per second timer (I don't really see a 500ms timer required)
and then check if the speed is more than 30, if yes, get the position and create explosions where necessary. You can look at this thread for information about vehicle speeds.
Can you please elaborate?

I dont understand some of those variables,

I want the vehicle explode when it reach 30 KmPh


Re: OnVehicleSpeed - EpicDutchie - 04.05.2014

I'm sure this will get you in the right way:
https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/GetVehicleVelocity
https://sampwiki.blast.hk/wiki/CreateExplosion
And this thread for getting the right speed


Re: OnVehicleSpeed - Trynda - 04.05.2014

Quote:
Originally Posted by EpicDutchie
Посмотреть сообщение
So, why to do i need timer?