Speedtrap
#1

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.
Reply
#2

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
Reply
#3

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?
Reply
#4

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

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

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

up........
Reply
#7

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

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

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)
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)