18.08.2011, 23:12
Estoy usando estas funciones para este comando:
Para que cuando el vehнculo explote aparezca en esa posiciуn, y aquн esta el cуdigo en OnVehicleSpawn:
No se si algo este mal, pero siempre aparece en otro angulo.
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;
}
pawn Код:
public OnVehicleSpawn(vehicleid)
{
SetVehiclePos(vehicleid, VehicleInfo[vehicleid][X], VehicleInfo[vehicleid][Y], VehicleInfo[vehicleid][Z]);
SetVehicleZAngle(vehicleid, VehicleInfo[vehicleid][Angle]);
return 1;
}