03.09.2014, 21:43
How can i see if a player is near to the driver's door or the passenger door?
VEHICLE_MODEL_INFO_FRONTSEAT // Position of the front seat* VEHICLE_MODEL_INFO_REARSEAT // Position of the rear seat*
https://sampwiki.blast.hk/wiki/Vehicle_information_types
Код:
VEHICLE_MODEL_INFO_FRONTSEAT // Position of the front seat* VEHICLE_MODEL_INFO_REARSEAT // Position of the rear seat* |
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;
}
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);
O------O | D FS| | | | C | | | | BS | O-------O
https://sampforum.blast.hk/showthread.php?tid=529324
This is a thread that I posted in where a guy needed a function that got the position in front of each tire. You should use this function made by Mauzen to start: pawn Код:
pawn Код:
|