Vehicles are Respawning or Destroying when drive
#3

@Libbyphay

I did try respawndelay -1 but didnt change anything. Everytime when im driving car, that car is respawning or destroying. This script using StaticVehicleEx i can show you veh codes;

PHP код:
CMD:veh(playeridparams[])
{
    new 
model[20], modelidcolor1color2Float:xFloat:yFloat:zFloat:avehicleid;
    if(
PlayerInfo[playerid][pAdmin] < 3)
    {
        return 
SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    }
    if(!
PlayerInfo[playerid][pAdminDuty] && PlayerInfo[playerid][pAdmin] < 6)
    {
        return 
SendClientMessage(playeridCOLOR_GREY"This command requires you to be on admin duty. /aduty to go on duty.");
    }
    if(
sscanf(params"s[20]I(-1)I(-1)"modelcolor1color2))
    {
        return 
SendClientMessage(playeridCOLOR_GREY3"[Usage]: /veh [modelid/name] [color1 (optional)] [color2 (optional)]");
    }
    if((
modelid GetVehicleModelByName(model)) == 0)
    {
        return 
SendClientMessage(playeridCOLOR_GREY"Invalid vehicle model.");
    }
    if(!(-
<= color1 <= 255) || !(-<= color2 <= 255))
    {
        return 
SendClientMessage(playeridCOLOR_GREY"Invalid color. Valid colors range from -1 to 255.");
    }
    
GetPlayerPos(playeridxyz);
    
GetPlayerFacingAngle(playerida);
    
vehicleid AddStaticVehicleEx(modelidxyzacolor1color2, -1);
    if(
vehicleid == INVALID_PLAYER_ID)
    {
        return 
SendClientMessage(playeridCOLOR_GREY"Cannot spawn vehicle. The vehicle pool is currently full.");
    }
    
adminVehicle{vehicleid} = true;
    
vehicleFuel[vehicleid] = 100;
    
vehicleColors[vehicleid][0] = color1;
    
vehicleColors[vehicleid][1] = color2;
    
SetVehicleVirtualWorld(vehicleidGetPlayerVirtualWorld(playerid));
    
LinkVehicleToInterior(vehicleidGetPlayerInterior(playerid));
    
PutPlayerInVehicle(playeridvehicleid0);
    
SendAdminMessage(COLOR_LIGHTRED"AdmCmd: %s spawned a %s."GetPlayerRPName(playerid), GetVehicleName(vehicleid));
    
SendClientMessageEx(playeridCOLOR_WHITE"** %s (ID %i) spawned. Use '/savevehicle %i' to save this vehicle to the database."GetVehicleName(vehicleid), vehicleidvehicleid);
    return 
1;
}
CMD:savevehicle(playeridparams[])
{
    new 
vehicleidgangidtypedelayFloat:xFloat:yFloat:zFloat:a;
    if(
PlayerInfo[playerid][pAdmin] < 3)
    {
        return 
SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    }
    if(
sscanf(params"iiii"vehicleidgangidtypedelay))
    {
        
SendClientMessage(playeridCOLOR_GREY3"[Usage]: /savevehicle [vehicleid] [gangid (-1 = none)] [faction type] [respawn delay (seconds)]");
        
SendClientMessage(playeridCOLOR_GREY3"List of types: (0) None (1) Police (2) Medic (3) News (4) Government (5) Hitman (6) Federal");
        return 
1;
    }
    if(!
IsValidVehicle(vehicleid) || !adminVehicle{vehicleid})
    {
        return 
SendClientMessage(playeridCOLOR_GREY"The vehicle specified is either invalid or not an admin spawned vehicle.");
    }
    if(!(-
<= gangid MAX_GANGS) || (gangid >= && !GangInfo[gangid][gSetup]))
    {
        return 
SendClientMessage(playeridCOLOR_GREY"Invalid gang.");
    }
    if(!(
<= type <= 7))
    {
        return 
SendClientMessage(playeridCOLOR_GREY"Invalid type.");
    }
    
SendClientMessageEx(playeridCOLOR_WHITE"** %s saved. This vehicle will now spawn here from now on."GetVehicleName(vehicleid));
    
GetVehiclePos(vehicleidxyz);
    
GetVehicleZAngle(vehicleida);
    
mysql_format(connectionIDqueryBuffersizeof(queryBuffer), "INSERT INTO vehicles (modelid, pos_x, pos_y, pos_z, pos_a, color1, color2, gangid, factiontype, respawndelay) VALUES(%i, '%f', '%f', '%f', '%f', %i, %i, %i, %i, %i)"GetVehicleModel(vehicleid), xyzavehicleColors[vehicleid][0], vehicleColors[vehicleid][1], gangidtypedelay);
    
mysql_tquery(connectionIDqueryBuffer);
    
mysql_tquery(connectionID"SELECT * FROM vehicles WHERE id = LAST_INSERT_ID()""OnQueryFinished""ii"THREAD_LOAD_VEHICLES0);
    
adminVehicle{vehicleid} = false;
    
DestroyVehicle(vehicleid);
    return 
1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)