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(playerid, params[])
{
new model[20], modelid, color1, color2, Float:x, Float:y, Float:z, Float:a, vehicleid;
if(PlayerInfo[playerid][pAdmin] < 3)
{
return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
}
if(!PlayerInfo[playerid][pAdminDuty] && PlayerInfo[playerid][pAdmin] < 6)
{
return SendClientMessage(playerid, COLOR_GREY, "This command requires you to be on admin duty. /aduty to go on duty.");
}
if(sscanf(params, "s[20]I(-1)I(-1)", model, color1, color2))
{
return SendClientMessage(playerid, COLOR_GREY3, "[Usage]: /veh [modelid/name] [color1 (optional)] [color2 (optional)]");
}
if((modelid = GetVehicleModelByName(model)) == 0)
{
return SendClientMessage(playerid, COLOR_GREY, "Invalid vehicle model.");
}
if(!(-1 <= color1 <= 255) || !(-1 <= color2 <= 255))
{
return SendClientMessage(playerid, COLOR_GREY, "Invalid color. Valid colors range from -1 to 255.");
}
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
vehicleid = AddStaticVehicleEx(modelid, x, y, z, a, color1, color2, -1);
if(vehicleid == INVALID_PLAYER_ID)
{
return SendClientMessage(playerid, COLOR_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(vehicleid, GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid, vehicleid, 0);
SendAdminMessage(COLOR_LIGHTRED, "AdmCmd: %s spawned a %s.", GetPlayerRPName(playerid), GetVehicleName(vehicleid));
SendClientMessageEx(playerid, COLOR_WHITE, "** %s (ID %i) spawned. Use '/savevehicle %i' to save this vehicle to the database.", GetVehicleName(vehicleid), vehicleid, vehicleid);
return 1;
}
CMD:savevehicle(playerid, params[])
{
new vehicleid, gangid, type, delay, Float:x, Float:y, Float:z, Float:a;
if(PlayerInfo[playerid][pAdmin] < 3)
{
return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
}
if(sscanf(params, "iiii", vehicleid, gangid, type, delay))
{
SendClientMessage(playerid, COLOR_GREY3, "[Usage]: /savevehicle [vehicleid] [gangid (-1 = none)] [faction type] [respawn delay (seconds)]");
SendClientMessage(playerid, COLOR_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(playerid, COLOR_GREY, "The vehicle specified is either invalid or not an admin spawned vehicle.");
}
if(!(-1 <= gangid < MAX_GANGS) || (gangid >= 0 && !GangInfo[gangid][gSetup]))
{
return SendClientMessage(playerid, COLOR_GREY, "Invalid gang.");
}
if(!(0 <= type <= 7))
{
return SendClientMessage(playerid, COLOR_GREY, "Invalid type.");
}
SendClientMessageEx(playerid, COLOR_WHITE, "** %s saved. This vehicle will now spawn here from now on.", GetVehicleName(vehicleid));
GetVehiclePos(vehicleid, x, y, z);
GetVehicleZAngle(vehicleid, a);
mysql_format(connectionID, queryBuffer, sizeof(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), x, y, z, a, vehicleColors[vehicleid][0], vehicleColors[vehicleid][1], gangid, type, delay);
mysql_tquery(connectionID, queryBuffer);
mysql_tquery(connectionID, "SELECT * FROM vehicles WHERE id = LAST_INSERT_ID()", "OnQueryFinished", "ii", THREAD_LOAD_VEHICLES, 0);
adminVehicle{vehicleid} = false;
DestroyVehicle(vehicleid);
return 1;
}