Vehicle's petrolcap pos
#1

Is it possibly to get any vehicle's petrolcap positions?
I have found few scripts that can make it, but they aren't working on unoccupied vehicles because they use GetVehicleRotationQuat function which is give fake info if the vehicle updated by a player and there is no one in it.

Thanks in advance.
Reply
#2

This might work:

pawn Код:
new Float: modelX, Float: modelY, Float: modelZ,
    Float: X, Float: Y, Float: Z, Float: R;

GetVehiclePos(vehicleid, X, Y, Z);
GetVehicleZAngle(vehicleid, R);
GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_PETROLCAP, modelX, modelY, modelZ);
                   
Z += modelZ;

X += (modelY * floatsin(-R, degrees));
Y += (modelY * floatcos(-R, degrees));

R += 270.0;
X += (modelX * floatsin(-R, degrees));
Y += (modelX * floatcos(-R, degrees));
R -= 270.0;
                   
if(IsPlayerInRangeOfPoint(playerid, 1.0, X, Y, Z))
{
    // Player is at (or atleast very close to) the petrolcap
}
Reply
#3

Quote:
Originally Posted by Infra
Посмотреть сообщение
This might work:

pawn Код:
new Float: modelX, Float: modelY, Float: modelZ,
    Float: X, Float: Y, Float: Z, Float: R;

GetVehiclePos(vehicleid, X, Y, Z);
GetVehicleZAngle(vehicleid, R);
GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_PETROLCAP, modelX, modelY, modelZ);
                   
Z += modelZ;

X += (modelY * floatsin(-R, degrees));
Y += (modelY * floatcos(-R, degrees));

R += 270.0;
X += (modelX * floatsin(-R, degrees));
Y += (modelX * floatcos(-R, degrees));
R -= 270.0;
                   
if(IsPlayerInRangeOfPoint(playerid, 1.0, X, Y, Z))
{
    // Player is at (or atleast very close to) the petrolcap
}
Thank you very much, this is working!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)