GetVehicleZAngle - SetVehicleZAngle
#1

Estoy usando estas funciones para este comando:
pawn Код:
dcmd_parkvehicle(playerid, params[])
{
    #pragma unused params
    new Float:Pos[4], vehicleid = GetPlayerVehicleID(playerid);
    if(pInfo[playerid][VehiclesOwned] < 0) return Message(playerid, RED, " » You don't own a vehicle");
    else if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return Message(playerid, RED, " » You're not driving a vehicle");
    else
    {
        if(VehicleID[playerid][0] == vehicleid || VehicleID[playerid][1] == vehicleid || VehicleID[playerid][2] == vehicleid || VehicleID[playerid][3] == vehicleid)
        {
            GetVehiclePos(vehicleid, Pos[0], Pos[1], Pos[2]);
            GetVehicleZAngle(vehicleid, Pos[3]);
            Message(playerid, GREEN, " » Your vehicle has been parked at your current position");
            dini_FloatSet(VFile(vehicleid), "PosX", Pos[0]);
            dini_FloatSet(VFile(vehicleid), "PosY", Pos[1]);
            dini_FloatSet(VFile(vehicleid), "PosZ", Pos[2]);
            dini_FloatSet(VFile(vehicleid), "Angle", Pos[3]);
            VehicleInfo[vehicleid][X] = Pos[0];
            VehicleInfo[vehicleid][Y] = Pos[1];
            VehicleInfo[vehicleid][Z] = Pos[2];
            VehicleInfo[vehicleid][Angle] = Pos[3];
        }
        else return Message(playerid, RED, " » This isn't your vehicle");
    }
    return 1;
}
Para que cuando el vehнculo explote aparezca en esa posiciуn, y aquн esta el cуdigo en OnVehicleSpawn:
pawn Код:
public OnVehicleSpawn(vehicleid)
{
    SetVehiclePos(vehicleid, VehicleInfo[vehicleid][X], VehicleInfo[vehicleid][Y], VehicleInfo[vehicleid][Z]);
    SetVehicleZAngle(vehicleid, VehicleInfo[vehicleid][Angle]);
    return 1;
}
No se si algo este mal, pero siempre aparece en otro angulo.
Reply
#2

Destrъyelo y crйalo de nuevo.
pawn Код:
public OnVehicleSpawn(vehicleid)
{
    new color1 = random(126), color2 = random(126), modelo = 400 + random(211);
    DestroyVehicle(vehicleid);
    CreateVehicle(modelo, VehicleInfo[vehicleid][X], VehicleInfo[vehicleid][Y], VehicleInfo[vehicleid][Z], VehicleInfo[vehicleid][Angle], color1, color2, 60000);
    return 1;
}
Reply
#3

O dale el angulo y luego la posiciуn.
Reply
#4

Ahora leyendo un poco, mirб: http://forum.sa-mp.com/showpost.php?...&postcount=122. Es un bug de samp.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)