12.09.2016, 11:47
Actually in what a problem:
If just to start the server - The vehicle is loaded from is database, but it doesn't spawn 255 vehicle.
1...254 is spawned, 255 doesn't spawn, 256...306 spawned.
If to reboot /rcon gmx - that 255 vehicle is spawned.
In what there can be a problem?
P.S CreateVehicle I tried, but hasn't helped
If just to start the server - The vehicle is loaded from is database, but it doesn't spawn 255 vehicle.
1...254 is spawned, 255 doesn't spawn, 256...306 spawned.
If to reboot /rcon gmx - that 255 vehicle is spawned.
In what there can be a problem?
P.S CreateVehicle I tried, but hasn't helped
PHP Code:
enum tcarInfo
{
orgcID,
orgcFrac,
orgcRank,
orgcCity,
orgcModel,
Float:orgCarPos[4],
orgcColor1,
orgcColor2,
orgcInt,
orgcWorld,
Text3D:orgcNumber,
Text3D:orgcText,
orgcNumberColor,
orgcCar,
Float:orgcFuel,
bool:orgLightOnOff,
orgpLight,
Float:orgpMilage,
orgcLock,
bool:orgcMax,
orgcMaxSpeed,
orgcName[50],
orgSiren
}
new OrgCarInfo[MAX_VEHICLES][tcarInfo];
PHP Code:
LoadOrgCar()
{
new rows;
cache_get_row_count(rows);
new string2[30];
for(new idx = 1; idx <= rows; idx++)
{
if(idx > MAXORGCAR) break;
cache_get_value_name_int(idx-1,"ID",OrgCarInfo[idx][orgcID]);
cache_get_value_name_int(idx-1,"Frac",OrgCarInfo[idx][orgcFrac]);
cache_get_value_name_int(idx-1,"Rank",OrgCarInfo[idx][orgcRank]);
cache_get_value_name_int(idx-1,"City",OrgCarInfo[idx][orgcCity]);
cache_get_value_name_int(idx-1,"Model",OrgCarInfo[idx][orgcModel]);
cache_get_value_name_float(idx-1,"posX",OrgCarInfo[idx][orgCarPos][0]);
cache_get_value_name_float(idx-1,"posY",OrgCarInfo[idx][orgCarPos][1]);
cache_get_value_name_float(idx-1,"posZ",OrgCarInfo[idx][orgCarPos][2]);
cache_get_value_name_float(idx-1,"posA",OrgCarInfo[idx][orgCarPos][3]);
cache_get_value_name_int(idx-1,"Color1",OrgCarInfo[idx][orgcColor1]);
cache_get_value_name_int(idx-1,"Color2",OrgCarInfo[idx][orgcColor2]);
cache_get_value_name_int(idx-1,"Int",OrgCarInfo[idx][orgcInt]);
cache_get_value_name_int(idx-1,"World",OrgCarInfo[idx][orgcWorld]);
cache_get_value_name_int(idx-1,"Siren",OrgCarInfo[idx][orgSiren]);
OrgCarInfo[idx][orgcNumberColor] = FracColors[OrgCarInfo[idx][orgcFrac]];
OrgCarInfo[idx][orgcCar] = P_AddStaticVehicleEx(OrgCarInfo[idx][orgcModel],OrgCarInfo[idx][orgCarPos][0],OrgCarInfo[idx][orgCarPos][1],OrgCarInfo[idx][orgCarPos][2],OrgCarInfo[idx][orgCarPos][3],
OrgCarInfo[idx][orgcColor1],OrgCarInfo[idx][orgcColor2],1800,OrgCarInfo[idx][orgSiren],0);
//printf(" * idx = %d orgcCar = %d ",idx,OrgCarInfo[idx][orgcCar]);
new tmpobjid;
if(OrgCarInfo[idx][orgcModel] == 498)
{
tmpobjid = CreateDynamicObject(19420,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
AttachDynamicObjectToVehicle(tmpobjid, OrgCarInfo[idx][orgcCar], 0.000, 2.031, 2.009, 0.000, 0.000, 0.000);
tmpobjid = CreateDynamicObject(19482,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
SetDynamicObjectMaterialText(tmpobjid, 0, "S.W.A.T", 130, "Ariel", 80, 1, -1, 0, 1);
AttachDynamicObjectToVehicle(tmpobjid, OrgCarInfo[idx][orgcCar], 1.261, -1.000, 1.250, 0.000, 0.000, 0.000);
tmpobjid = CreateDynamicObject(19482,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
SetDynamicObjectMaterialText(tmpobjid, 0, "S.W.A.T", 130, "Ariel", 80, 1, -1, 0, 1);
AttachDynamicObjectToVehicle(tmpobjid, OrgCarInfo[idx][orgcCar], -1.261, -1.031, 1.300, 0.000, 0.000, 179.900);
tmpobjid = CreateDynamicObject(2937,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
SetDynamicObjectMaterial(tmpobjid, 0, 18996, "mattextures", "sampblack", 0);
AttachDynamicObjectToVehicle(tmpobjid, OrgCarInfo[idx][orgcCar], 1.144, -1.441, -0.396, 0.000, -91.199, 0.000);
tmpobjid = CreateDynamicObject(2937,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
SetDynamicObjectMaterial(tmpobjid, 0, 18996, "mattextures", "sampblack", 0);
AttachDynamicObjectToVehicle(tmpobjid, OrgCarInfo[idx][orgcCar], -1.114, -1.441, -0.397, 0.000, 91.199, 0.000);
}
if(OrgCarInfo[idx][orgcModel] == 552)
{
tmpobjid = CreateDynamicObject(11702,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
AttachDynamicObjectToVehicle(tmpobjid, OrgCarInfo[idx][orgcCar], 0.000, 0.550, 1.390, 0.000, 0.000, 0.000);
tmpobjid = CreateDynamicObject(19483,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
SetDynamicObjectMaterialText(tmpobjid, 0, "FIRE DEPT", 130, "Ariel", 35, 1, -1, 0, 1);
AttachDynamicObjectToVehicle(tmpobjid, OrgCarInfo[idx][orgcCar], 1.261, -2.512, 0.540, 0.000, 0.000, 0.000);
tmpobjid = CreateDynamicObject(19483,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
SetDynamicObjectMaterialText(tmpobjid, 0, "FIRE DEPT", 130, "Ariel", 35, 1, -1, 0, 1);
AttachDynamicObjectToVehicle(tmpobjid, OrgCarInfo[idx][orgcCar], -1.261, -2.512, 0.540, 0.000, 0.000, 179.399);
}
//OnVehicleSpawn(OrgCarInfo[idx][orgcCar]);
if(OrgCarInfo[idx][orgcInt] > 0) LinkVehicleToInterior(OrgCarInfo[idx][orgcCar],OrgCarInfo[idx][orgcInt]);
if(OrgCarInfo[idx][orgcWorld] > 0) SetVehicleVirtualWorld(OrgCarInfo[idx][orgcCar],OrgCarInfo[idx][orgcWorld]);
switch(OrgCarInfo[idx][orgcCity])
{
case 1: format(string2,sizeof(string2),"[LA%dUS]",idx);
case 2: format(string2,sizeof(string2),"[SF%dUS]",idx);
case 3: format(string2,sizeof(string2),"[LV%dUS]",idx);
case 4: format(string2,sizeof(string2),"[CA%dUS]",idx);
}
SetVehicleNumberPlate(OrgCarInfo[idx][orgcCar],string2);
OrgCarInfo[idx][orgcNumber] = CreateDynamic3DTextLabel(string2,0xAFAFAF90,0,0,0.0,15.0,INVALID_PLAYER_ID,OrgCarInfo[idx][orgcCar],1);
if(OrgCarInfo[idx][orgcFrac] == 15)
{
format(string2,sizeof(string2),"%s",OrgInfo[OrgCarInfo[idx][orgcFrac]][orgName]);
OrgCarInfo[idx][orgcText] = CreateDynamic3DTextLabel(string2,0xFFA500FF,0,0,1.25,15.0,INVALID_PLAYER_ID,OrgCarInfo[idx][orgcCar],1);
}
Fuel[idx] = VehicleParams[OrgCarInfo[idx][orgcModel]-400][vMaxFuel];
Engine[idx] = false;
Light[idx] = false;
OrgCarInfo[idx][orgLightOnOff] = false;
OrgCarInfo[idx][orgpLight] = 0;
OrgCarInfo[idx][orgpMilage] = 0;
OrgCarInfo[idx][orgcLock] = 0;
OrgCarInfo[idx][orgcMax] = false;
Door[idx] = OrgCarInfo[idx][orgcLock];
TOTALORGCAR = idx;
}
printf(" * [Load System] : %d.",TOTALORGCAR);
return true;
}
PHP Code:
P_AddStaticVehicleEx(model,Float:x,Float:y,Float:z,Float:a,color_1,color_2,spawntime = 99999, siren, Float:health = 1000.0)
{
new vid = AddStaticVehicleEx(model, x, y, z, a, color_1, color_2,spawntime,siren);
if(health > 0) ACVehInfo[vid][acVHealth] = health;
else ACVehInfo[vid][acVHealth] = 1000.0;
return vid;
}