SA-MP Forums Archive
Vehicle Respawn help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle Respawn help (/showthread.php?tid=574020)



Vehicle Respawn help - AlexBlack - 12.05.2015

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."); 



Re: Vehicle Respawn help - Konstantinos - 12.05.2015

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


Re: Vehicle Respawn help - tantri - 12.05.2015

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


Re: Vehicle Respawn help - Azula - 12.05.2015

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]


Re: Vehicle Respawn help - Konstantinos - 12.05.2015

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.


Re : Vehicle Respawn help - AlexBlack - 12.05.2015

Okay, i will try.


Re : Vehicle Respawn help - AlexBlack - 12.05.2015

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;