Drift System
#1

I really dont know where to ask.

I searched and didnt find anything.

I saw on some servers when you drift you get points.

Like a textdraw that shows how many points you got for drifting is there any available.

If not can someone explain me a bit how am i supposed to make it.

Thanks
Reply
#2

I think it's a matter of comparing the angle of the car with the direction someone is going in.. for example if the angle is 90 (facing east), but the car's 'y-position' changes positively (car is moving north) that person is drifting
Reply
#3

Quote:
Originally Posted by Rav
I think it's a matter of comparing the angle of the car with the direction someone is going in.. for example if the angle is 90 (facing east), but the car's 'y-position' changes positively (car is moving north) that person is drifting
Can you please show me some examples, because i dont have any idea how to make it.

and i also saw in a server when you get nos it stays only for like 1-2 seconds after it stops but its infinity.
how to make that also?

Thanks
Reply
#4

Well, it would be quite a big script, so I'm just going to give you a small scheme you can work off

Код:
// make some variable for each player
Float: LastVehiclePos[MAX_PLAYERS][3];

// foward timer function
forward CheckDrift(playerid);

// OnPlayerConnect
SetTimerEx("CheckDrift"477, 0, "i", playerid);
LastVehiclePos[playerid][0] = 0.0;
LastVehiclePos[playerid][1] = 0.0;
LastVehiclePos[playerid][2] = 0.0;

// custom function
public CheckDrift(playerid)
{
   // sometimes the entire idea of running the timer is useless
   if (!IsPlayerConnected(playerid))
      return 1;
   if (!IsPlayerInAnyVehicle(playerid))
      return 1;

   // the timer isn't automatically repeated, so lets set a new timer now
   SetTimerEx("CheckDrift"477, 0, "i", playerid);

   new vid = GetPlayerVehicleID(playerid);
   new Float: angle;
   GetVehicleZAngle (vid, angle); // stores the angle of the car in a variable

   // now comes the tricky bit.. which I suck at.. and that is maths.. 
   // you need to take the position of the car, how it's moved and convert it radially (make it an angle)
   // this way you can compare the vehicle angle and the driving angle

   // compare the absolute (always positive) value of the angles, if they're more than 30 degrees apart, someone is drifting
   if (floatabs(DrivingAngle-Angle) > 30)
   {
      // you need to do something here, 1 check isn't enough to see a full drift, could just be someone turning their car etc..
   }

   // save new position of the car
   GetVehiclePos(vid, LastVehiclePos[playerid][0], LastVehiclePos[playerid][1], LastVehiclePos[playerid][2]);
}
Reply
#5

Quote:
Originally Posted by Rav
Well, it would be quite a big script, so I'm just going to give you a small scheme you can work off

Код:
// make some variable for each player
Float: LastVehiclePos[MAX_PLAYERS][3];

// foward timer function
forward CheckDrift(playerid);

// OnPlayerConnect
SetTimerEx("CheckDrift"477, 0, "i", playerid);
LastVehiclePos[playerid][0] = 0.0;
LastVehiclePos[playerid][1] = 0.0;
LastVehiclePos[playerid][2] = 0.0;

// custom function
public CheckDrift(playerid)
{
   // sometimes the entire idea of running the timer is useless
   if (!IsPlayerConnected(playerid))
      return 1;
   if (!IsPlayerInAnyVehicle(playerid))
      return 1;

   // the timer isn't automatically repeated, so lets set a new timer now
   SetTimerEx("CheckDrift"477, 0, "i", playerid);

   new vid = GetPlayerVehicleID(playerid);
   new Float: angle;
   GetVehicleZAngle (vid, angle); // stores the angle of the car in a variable

   // now comes the tricky bit.. which I suck at.. and that is maths.. 
   // you need to take the position of the car, how it's moved and convert it radially (make it an angle)
   // this way you can compare the vehicle angle and the driving angle

   // compare the absolute (always positive) value of the angles, if they're more than 30 degrees apart, someone is drifting
   if (floatabs(DrivingAngle-Angle) > 30)
   {
      // you need to do something here, 1 check isn't enough to see a full drift, could just be someone turning their car etc..
   }

   // save new position of the car
   GetVehiclePos(vid, LastVehiclePos[playerid][0], LastVehiclePos[playerid][1], LastVehiclePos[playerid][2]);
}
Sorry, i dont know how to make it...

EDIT :I found this, can it help me?

http://forum.sa-mp.com/index.php?topic=87047.0
Reply
#6

well, I don't do entire scripts on request, sorry..
Reply
#7

I found this, can it help me?

http://forum.sa-mp.com/index.php?topic=87047.0
Reply
#8

doesn't look like it..
Reply
#9

and how about this

i saw in a server when you get nos it stays only for like 1-2 seconds after it stops but its infinity.
how to make that?
Reply
#10

Quote:
Originally Posted by plɹoʍ ʎʇɹǝqıl
and how about this

i saw in a server when you get nos it stays only for like 1-2 seconds after it stops but its infinity.
how to make that?
http://forum.sa-mp.com/index.php?action=search;advanced
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)