Detect vehicle angle
#1

Hi, I've already searched the whole forum for this, but found nothing that really I needed.

Can someone show me a small example of how to detect if a vehicle is on it's roof?
Reply
#2

GetVehicleZAngle
https://sampwiki.blast.hk/wiki/GetVehicleZAngle
Reply
#3

Quote:
Originally Posted by sim_sima
Посмотреть сообщение
Yes i've seen that, but can you show me an example of how to use it?

Like ehh, how to detect if it's on its roof?
Reply
#4

You'd need to get the X and Y angle for that, which is not possible with that function. Look into using GetVehicleRotationQuat.
Reply
#5

* To late *
Reply
#6

Thanks guys, maybe an example? I'm new to this function, never used it really.
Reply
#7

Quote:
Originally Posted by Funtime
Посмотреть сообщение
Thanks guys, maybe an example? I'm new to this function, never used it really.
Maybe that topic helps, its a mess that JernejL and his tutorial disapeared

But there is an include about GetVehicleRotationQuat released (just search for it)
Reply
#8

[Copyd from Wiki] Try to search better next time
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
     if(strcmp(cmdtext, "/vehrot", true) == 0)
     {
          new currentveh;
          new Float:z_rot;
          new message[32];
 
          currentveh = GetPlayerVehicleID(playerid);
 
          GetVehicleZAngle(currentveh, z_rot);
 
          format(message, sizeof(message), "The current vehicle rotation is: %f", z_rot);
 
          SendClientMessage(playerid, 0xFFFFFFFF, message);
 
          return 1;
     }
 
     return 0;
}
Reply
#9

Quote:
Originally Posted by Markx
Посмотреть сообщение
[Copyd from Wiki] Try to search better next time
pawn Код:
//bunch of code


He wants to know how to detect if a vehicle is on its roof, which - as I already said - is not possible with GetVehicleZAngle.
Reply
#10

Well, if your trying to make a flip command/function in your server, you should simply just get the vehicle position in a variable, and then set the vehicle position to that variable, and then the vehicle will flip onto its wheels again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)