GetXYZOfVehiclePart(vehicleid, part, &Float:x, &Float:y, &Float:z, Float:offset = 0.5)
* vehicleid - Id of vehicle * part - Part (https://github.com/Ino42O/VehiclePar...sition.inc#L43), * &Float:x - Out var * &Float:y - Out var * &Float:z - Out var * Float:offset = 0.5 - Side offset with default value
new car; CMD:car(playerid, params[]) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); car = CreateVehicle(strval(params), x, y+5.0, z, 0.0, -1, -1, 0); return 1; }
CMD:part(playerid, params[]) { new Float:x, Float:y, Float:z; GetXYZOfVehiclePart(car, strval(params), x, y, z); SetPlayerPos(playerid, x, y, z); return 1; }
if vehicle is rotated on X or Y axis, then this function won't return the correct position. (eg: up-side down or driving up a hill)
|
And what about the flight transport? For example the hood Make adjustments to the coordinates for each vehicle
|
Update
Now support if vehicle is not on flat ground require ColAndreas |
You could use this function instead of ColAndreas
http://forum.sa-mp.com/showpost.php?...postcount=3972 |
In my opinion colandreas is better, but I will not say i'm 100% correct
|
You could use this function instead of ColAndreas
http://forum.sa-mp.com/showpost.php?...postcount=3972 |
// left front door
new Float:offXD;
GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_FRONTSEAT, offX, offY, offZ);
GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, offXD, offZ, offZ); // You'll never use OffZ value, so it's an "unused" var :D
fX += ( ( (offX + (offXD/2.5) + offset) * floatsin( -A - 90.0, degrees ) ) + ( ( offY * floatsin( -A, degrees ) ) ) );
fY += ( ( (offX + (offXD/2.5) + offset) * floatcos( -A - 90.0, degrees ) ) + ( ( offY * floatcos( -A, degrees ) ) ) );
// left back door
new Float:offXD;
GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_REARSEAT, offX, offY, offZ);
GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, offXD, offZ, offZ);
fX += ( ( (offX + (offXD/2.5) + offset) * floatsin( -A - 90.0, degrees ) ) + ( ( offY * floatsin( -A, degrees ) ) ) );
fY += ( ( (offX + (offXD/2.5) + offset) * floatcos( -A - 90.0, degrees ) ) + ( ( offY * floatcos( -A, degrees ) ) ) );