03.06.2018, 20:24
PHP Code:
CrearAuto(playerid, modelid)
{
new Auto, Float: X, Float: Y, Float: Z, Float: Angulo;
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
Auto = GetPlayerVehicleID(playerid);
GetVehiclePos(Auto, X, Y, Z);
GetVehicleZAngle(Auto, Angulo);
DestroyVehicle(Auto);
}
else
{
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angulo);
}
if(Car[playerid] != 0) DestroyVehicle(Car[playerid]);
Car[playerid] = CreateVehicle(modelid, X, Y, Z, Angulo, -1,-1, -1,-1);
PutPlayerInVehicle(playerid, Car[playerid], 0);
LinkVehicleToInterior(Auto, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(Auto, GetPlayerVirtualWorld(playerid));
return 1;
}
The second last parameter of this function is assumed when it is -1 to prevent it from respawning, but it does not work.
PHP Code:
CreateVehicle(modelid, X, Y, Z, Angulo, -1,-1, -1,-1);