02.08.2014, 06:25
This is a command that I made, it shows you an example of how you might find the coordinates you need to get an offset of the tires. This of course uses the function 'GetVehicleRelativePos' which is credited to Mauzen. First you need this stock:
Then you would use the following:
Where 'veh' is the ID of the vehicle you want to set the checkpoint on.
EDIT:
Example of what this would look like, with the '0.5' offset.
pawn Код:
stock GetVehicleRelativePos(vehicleid, &Float:x, &Float:y, &Float:z, Float:xoff= 0.0, Float:yoff= 0.0, Float:zoff= 0.0)
{
new Float:rot;
GetVehicleZAngle(vehicleid, rot);
rot = 360 - rot;
GetVehiclePos(vehicleid, x, y, z);
x = floatsin(rot, degrees) * yoff + floatcos(rot, degrees) * xoff + x;
y = floatcos(rot, degrees) * yoff - floatsin(rot, degrees) * xoff + y;
z = zoff + z;
}
pawn Код:
new Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2;
//For the front left tyre:
GetVehicleModelInfo(GetVehicleModel(veh), VEHICLE_MODEL_INFO_WHEELSFRONT, x, y, z);
GetVehicleRelativePos(veh, x2, y2, z2, -x - 0.5, y, z);
SetPlayerCheckpoint(playerid, x2, y2, z2, 0.5);
//For the front right tyre...
GetVehicleModelInfo(GetVehicleModel(veh), VEHICLE_MODEL_INFO_WHEELSFRONT, x, y, z);
GetVehicleRelativePos(veh, x2, y2, z2, x + 0.5, y, z);
SetPlayerCheckpoint(playerid, x2, y2, z2, 0.5);
//For the Back left tyre...
GetVehicleModelInfo(GetVehicleModel(veh), VEHICLE_MODEL_INFO_WHEELSREAR, x, y, z);
GetVehicleRelativePos(veh, x2, y2, z2, -x - 0.5, y, z);
SetPlayerCheckpoint(playerid, x2, y2, z2, 0.5);
//For the Back right tyre...
GetVehicleModelInfo(GetVehicleModel(veh), VEHICLE_MODEL_INFO_WHEELSREAR, x, y, z);
GetVehicleRelativePos(veh, x2, y2, z2, x + 0.5, y, z);
SetPlayerCheckpoint(playerid, x2, y2, z2, 0.5);
EDIT:
Example of what this would look like, with the '0.5' offset.