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



Speedtrap - Typhome - 14.10.2010

Hello, how i do make speedtrap? What functions or what?

If you drive 100 km/h and you cross up that speedtrap, then speedtrap caught you, and you get ticket.


Re: Speedtrap - Bessensap - 14.10.2010

Get dcallbacks (search forum), make the area,
pawn Код:
OnPlayerEnterArea(playerid,areaid)
{
     if(areaid == (yourareaidhere))
     {    
          new Float:vx,Float:vy,Float:vz;
          GetPlayerVelocity(playerid,vx,vy,vz);
          if(vx > yourmaxspeedhere || vy > yourmaxspeedhere)
         { //You do the math



Re: Speedtrap - Typhome - 14.10.2010

Quote:
Originally Posted by Bessensap
Посмотреть сообщение
Get dcallbacks (search forum), make the area,
pawn Код:
OnPlayerEnterArea(playerid,areaid)
{
     if(areaid == (yourareaidhere))
     {    
          new Float:vx,Float:vy,Float:vz;
          GetPlayerVelocity(playerid,vx,vy,vz);
          if(vx > yourmaxspeedhere || vy > yourmaxspeedhere)
         { //You do the math
What is vx and vy?


Re: Speedtrap - DeathOnaStick - 14.10.2010

Quote:
Originally Posted by Typhome
Посмотреть сообщение
What is vx and vy?
The velocity (speed) of the car.


Re: Speedtrap - Typhome - 14.10.2010

But why 2 thing's? Not 1 thing? (vx and vy)


Re: Speedtrap - Typhome - 15.10.2010

Quote:
Originally Posted by Typhome
Посмотреть сообщение
But why 2 thing's? Not 1 thing? (vx and vy)
So wich 2 thing is of speed?

up........


Re: Speedtrap - LarzI - 15.10.2010

The world isn't 1 dimensional, so you need 2 "things which is of speed".
The third dimension is unused (z) which is upwards.


Re: Speedtrap - BrunoHP - 22.10.2010

Sorry for refresh, but is this in miles or kilometres?


Re: Speedtrap - Typhome - 23.01.2011

Sorry, but i forgotted some stuff's, so how do make area..?

-----------

if(vx > yourmaxspeedhere || vy > yourmaxspeedhere)

If kilometers, then what i should put it? 50? or what? (I want max 50 km/h)


Re: Speedtrap - Conroy - 23.01.2011

You don't use the X/Y velocity without doing calculations. Your velocity on the X axis will only be the full velocity if you are going north/south, Y would be going east/west. If you are going north east, your velocity would get halved between the two. Find the GetPlayerSpeed function, use that. Areas aren't really required, just a simple coordinate in the middle of the road along with IsPlayerInRangeOfPoint.

Hope this helped,

-Conroy.