Vehicles are Respawning or Destroying when drive
#1

Sorry for my bad English,

My problem is;

Vehicles respawning or destroying i dont know, when im driving a car. It is being in 1-2 min. And vehicles ids not same in MySQL. I can get again car with /spawncar cmd. How i can delete despawncar/spawncar and how fix that problem. I can upload video, if u dont understand.

this video;

https://www.youtube.com/watch?v=nWnw...ature=*********
Reply
#2

https://sampwiki.blast.hk/wiki/CreateVehicle

PHP код:
CreateVehicle(vehicletypeFloat:xFloat:yFloat:zFloat:rotationcolor1color2respawn_delayaddsiren=0
Example if you want no respawn car:

PHP код:
CreateVehicle(4112109.17631503.045332.288782.287311, -1
Reply
#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
#4

Add vehid before modelid, and change vehid = vehicleid
Reply
#5

https://www.youtube.com/watch?v=nWnw...ature=*********
Reply
#6

I did try your say but didnt change. That cars going to when im driving.
Reply
#7

Guys im tilted, how can i fix that problem?
Reply
#8

Do you have any kind of timer that respawn/destroy cars? Lets say you want to destroy admin spawned cars from time to time so you use a timer. Do you have any kind of this stuff? I had the same issue when i did such a timer
Reply
#9

remove destroyvehicle(playerid);
Reply
#10

Quote:
Originally Posted by Banditul18
Посмотреть сообщение
Do you have any kind of timer that respawn/destroy cars? Lets say you want to destroy admin spawned cars from time to time so you use a timer. Do you have any kind of this stuff? I had the same issue when i did such a timer
Thank you bro i checked it.


Quote:
Originally Posted by EzeGODezE
Посмотреть сообщение
remove destroyvehicle(playerid);
Thank you man, fixed with this.

Thanks all ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)