FuelcapXY
#1

How can I get the position of a fuelcap from this?

pawn Код:
stock TrunkXY(playerid, &Float:x2, &Float:y2, Float:distance)
{
    new
        Float:a,
        Float:z
    ;
    GetPlayerPos(playerid, x2, y2, z);
    GetPlayerFacingAngle(playerid, a);
    if(GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    x2 += (distance * floatsin(-a+180, degrees));
    y2 += (distance * floatcos(-a+180, degrees));

    SetPlayerCheckpoint(playerid, x2, y2, z, 1.0);
}
Thanks!
Reply
#2

GetVehicleModelInfo with VEHICLE_MODEL_INFO_PETROLCAP. This returns offsets, so you'll need to add them to the current vehicle's positions.
Reply
#3

I tried that Vince, but I don't know how to do it.

Would it be:

pawn Код:
command(cap, playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new Float:x, Float:y, Float:z, Float:cX, Float:cY, Float:cZ;
        GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
        GetVehicleModelInfo(GetVehicleModel(GetPlayerVehicleID(playerid), VEHICLE_MODEL_INFO_PETROLCAP, cX, cY, xZ);
        SetPlayerCheckpoint(playerid, x+cX, y+cY, z+cZ, 1.0);
    }
    else return SendClientMessage(playerid, WHITE, "You aren't in a vehicle.");
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)