Vehicle Respawn help
#1

Hi , i have a small problem , when i do /park it's say "The vehicle will be respawned here next time" , but when i respawn all vehicles , the vehicle will respawned at the default positions, if anyone can help :


ParkVehicles fonction
PHP код:
stock parkVehicles(vehicleidintvw)
{
    new 
Float:xFloat:yFloat:z;
    
GetVehiclePos(Vehicles[vehicleid][vehicleData], xyz);
    
GetVehicleZAngle(Vehicles[vehicleid][vehicleData], Vehicles[vehicleid][vehPos][3]);
    
Vehicles[vehicleid][vehPos][0] = x;
    
Vehicles[vehicleid][vehPos][1] = y;
    
Vehicles[vehicleid][vehPos][2] = z;
    
Vehicles[vehicleid][vehInt] = int;
    
Vehicles[vehicleid][vehVW]    = vw;
    
saveVehicles(vehicleid);
    return 
1;

PHP код:
new Player[playerid][carVCP];
                        
parkVehicles(iGetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
                        
Server(playerid"Your Vehicle will be spawned here next time."); 
Reply
#2

Check if a vehicle is marked as "parkable" in OnVehicleSpawn callback and if so, set the position; interior and virtual world.
Reply
#3

Quote:

new car[MAX_PLAYERS];
new Float, Float:y, Float:z,Floatrot;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid,Floatrot);
car[playerid] = AddStaticVehicle(493, x, y, z, xrot,-1, -1);

This can be help ful for you
Reply
#4

this is a false syntax i have the same problem with '' Vehicles[vehicleid][vehPos][0] = x ''
just create Vehicles[vehicleid][vehPosX] Vehicles[vehicleid][vehPosY] Vehicles[vehicleid][vehPosZ]
Reply
#5

Quote:
Originally Posted by Azula
Посмотреть сообщение
this is a false syntax i have the same problem with '' Vehicles[vehicleid][vehPos][0] = x ''
just create Vehicles[vehicleid][vehPosX] Vehicles[vehicleid][vehPosY] Vehicles[vehicleid][vehPosZ]
As long as you set the position of the vehicle to:
pawn Код:
SetVehiclePos(vehicleid, Vehicles[vehicleid][vehPos][0], Vehicles[vehicleid][vehPos][1], Vehicles[vehicleid][vehPos][2]);
there will not be any issue.
Reply
#6

Okay, i will try.
Reply
#7

Fixed, i have destroy the vehicle and recreate in fonction parkVehicle so it's like this :

PHP код:
stock parkVehicles(vehicleidintvw)
{
    new 
Float:xFloat:yFloat:z;
    
GetVehiclePos(Vehicles[vehicleid][vehicleData], xyz);
    
GetVehicleZAngle(Vehicles[vehicleid][vehicleData], Vehicles[vehicleid][vehPos][3]);
    
Vehicles[vehicleid][vehPos][0] = x;
    
Vehicles[vehicleid][vehPos][1] = y;
    
Vehicles[vehicleid][vehPos][2] = z;
    
Vehicles[vehicleid][vehInt] = int;
    
Vehicles[vehicleid][vehVW]    = vw;
    
    
DestroyVehicle(Vehicles[vehicleid][vehicleData]);
    
Vehicle_AddStatic(Vehicles[vehicleid][vehModel], Vehicles[vehicleid][vehPos][0], Vehicles[vehicleid][vehPos][1], Vehicles[vehicleid][vehPos][2], Vehicles[vehicleid][vehPos][3], Vehicles[vehicleid][vehColor][0], Vehicles[vehicleid][vehColor][1], 360000);
    
saveVehicles(vehicleid);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)