How to get position near vehicle?
#1

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...
Reply
#2

I used this to get right side of the vehicle.

pawn Код:
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 ));
}
usage would be

GetVehiclePos
GetXYRightOfCar(vehicleid,x,y,1.0) use negative to get left side.
Reply
#3

PHP код:
public GetPlayerclosetoveh(playerid)
{
 new 
Float:dis 99999999.0;
 new 
veh = -1;
 new 
Float:xFloat:yFloat:z;
 
GetPlayerPos(playeridxyz);
 for(new 
1MAX_VEHICLESi++)
 {
  new 
Float:distance GetVehicleDistanceFromPoint(ixyz);
     if(
distance dis)
     {
         
dis distance;
         
veh i;
  }
 }
 return 
veh;

If it didn't work, please tell me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)