Trunk system
#2

Quote:
Originally Posted by MP2
Посмотреть сообщение
You could make use of the new GetVehicleModelInfo and the custom GetXYBehindVehicle function. This is a function I use:

pawn Код:
stock GetPosBehindVehicle(vehicleid, &Float:x, &Float:y, &Float:z, Float:offset=0.5)
{
    new Float:vehicleSize[3], Float:vehiclePos[3];
    GetVehiclePos(vehicleid, vehiclePos[0], vehiclePos[1], vehiclePos[2]);
    GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, vehicleSize[0], vehicleSize[1], vehicleSize[2]);
    GetXYBehindVehicle(vehicleid, vehiclePos[0], vehiclePos[1], (vehicleSize[1]/2)+offset);
    x = vehiclePos[0];
    y = vehiclePos[1];
    z = vehiclePos[2];
    return 1;
}

GetXYBehindVehicle(vehicleid, &Float:q, &Float:w, Float:distance)
{
    new Float:a;
    GetVehiclePos(vehicleid, q, w, a);
    GetVehicleZAngle(vehicleid, a);
    q += (distance * -floatsin(-a, degrees));
    w += (distance * -floatcos(-a, degrees));
}
Then just check if they are in range of 1.0 unit, and it will check if they are at the back of the vehicle, not at the sides like just using IsPlayerInRangeOfPoint would do.
Use the 'search' button next time...
Reply


Messages In This Thread
Trunk system - by Xenforox - 08.07.2014, 00:24
Re: Trunk system - by Threshold - 08.07.2014, 00:34
Re : Re: Trunk system - by Xenforox - 08.07.2014, 00:36
Re: Trunk system - by ABKPot - 08.07.2014, 00:49

Forum Jump:


Users browsing this thread: 4 Guest(s)