14.05.2016, 17:48
(
Последний раз редактировалось thaKing; 14.05.2016 в 18:16.
Причина: made a solution
)
found a solution!
PHP код:
#function
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;
}
#vars
x,y,z and x2, y2, z2
#getting door pos
GetVehicleModelInfo(car[id][carModel], VEHICLE_MODEL_INFO_FRONTSEAT, cX, cY, cZ);
GetVehicleRelativePos(car[id][carVehicleID], cX2, cY2, cZ2, -cX - 0.5, cY, cZ);
#checking if near driver's door
if (!IsPlayerInRangeOfPoint(playerid, 1.0, cX2, cY2, cZ2))
return SendErrorMsg(playerid, "You are not near driver's door.");