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



Speed Cameras? - Luis- - 01.11.2010

Hello, I am wondering how I can make a Speed Camera so when a player passes it at a speed of say 120 MP/H the Camera will flash and show this "%s has been caught speeding at %d in a 70mp/h area"

If someone could make me a template I will be really great full.

Thank you, Regards Luis


Re: Speed Cameras? - Mauzen - 01.11.2010

rough template:

Create a timer/area

In the timer func:
loop through players
check if they are in the area
get their speed with getcehiclevelocity
calculate the speed to mph/kmh (search the forum on what values you need)
if speed is greater: call OnPlayerExceedSpeedLimit or so

This all can be done well with an array for all areas and an enum in it, that stores the stuff like the are pos, speed limit, timer id,...


Re: Speed Cameras? - Luis- - 01.11.2010

I suck at timers but i'll try it out tomorrow


Re: Speed Cameras? - Zamaroht - 01.11.2010

You could give a try to Incognito's streamer plugin, it includes some area functions. They will save you a lot of work, and they are very efficient. Then, you would just need to do the speed checks, etc inside OnPlayerEnterArea.


Re: Speed Cameras? - Luis- - 01.11.2010

Quote:
Originally Posted by Zamaroht
Посмотреть сообщение
You could give a try to Incognito's streamer plugin, it includes some area functions. They will save you a lot of work, and they are very efficient. Then, you would just need to do the speed checks, etc inside OnPlayerEnterArea.
I just got the Plugin now I'ma try it!