26.12.2015, 21:35
Can anyone explain me how can I get the position near vehicle? for example: trunk, bumpers, doors... Just around the veh... I think it's something with floatsin, floatcos but I don't understand that...
stock GetXYRightOfCar(vehicleid,&Float:x,&Float:y,Float:distance)
{
new Float:a;
GetVehiclePos( vehicleid, x, y, a );
GetVehicleZAngle( vehicleid, a );
x += ( distance * floatsin( -a+90, degrees ));
y += ( distance * floatcos( -a+90, degrees ));
}
public GetPlayerclosetoveh(playerid)
{
new Float:dis = 99999999.0;
new veh = -1;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i = 1; i < MAX_VEHICLES; i++)
{
new Float:distance = GetVehicleDistanceFromPoint(i, x, y, z);
if(distance < dis)
{
dis = distance;
veh = i;
}
}
return veh;
}