My functions used OnGameModeInit so you may get an idea where the problem is coming from;
Ignore the bad indentation, It somehow became like that after I copy pasted these in the forum and yeah about the Query failed thing, I never received any warning.
PHP код:
stock Plant_Load(i)
{
new
DBResult:dbresult,
query[128],
field[20]
;
format(query, sizeof(query), "SELECT * FROM `plants` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "type", field, sizeof(field)); PlantInfo[i][plantType] = strval(field);
db_get_field_assoc(dbresult, "drugs", field, sizeof(field)); PlantInfo[i][plantDrugs] = strval(field);
db_get_field_assoc(dbresult, "x", field, sizeof(field)); PlantInfo[i][plantPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); PlantInfo[i][plantPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); PlantInfo[i][plantPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "a", field, sizeof(field)); PlantInfo[i][plantPos][3] = floatstr(field);
db_get_field_assoc(dbresult, "interior", field, sizeof(field)); PlantInfo[i][plantInterior] = strval(field);
db_get_field_assoc(dbresult, "world", field, sizeof(field)); PlantInfo[i][plantWorld] = strval(field);
PlantInfo[i][plantExists] = true;
ServerInfo[total_plants] ++;
Plant_Refresh(i);
}
db_free_result(dbresult);
return 1;
}
stock LoadDealership(i)
{
new
DBResult:dbresult,
query[128],
field[20]
;
format(query, sizeof(query), "SELECT * FROM `dealership` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "owner", field, sizeof(field)); DealershipInfo[i][dealerOwner] = strval(field);
db_get_field_assoc(dbresult, "price", field, sizeof(field)); DealershipInfo[i][dealerPrice] = strval(field);
db_get_field_assoc(dbresult, "name", field, sizeof(field)); format(DealershipInfo[i][dealerName], 64, field);
db_get_field_assoc(dbresult, "earnedcash", field, sizeof(field)); DealershipInfo[i][dealerCash] = strval(field);
db_get_field_assoc(dbresult, "x", field, sizeof(field)); DealershipInfo[i][dealerPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); DealershipInfo[i][dealerPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); DealershipInfo[i][dealerPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "sx", field, sizeof(field)); DealershipInfo[i][dealerSpawnPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "sy", field, sizeof(field)); DealershipInfo[i][dealerSpawnPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "sz", field, sizeof(field)); DealershipInfo[i][dealerSpawnPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "sa", field, sizeof(field)); DealershipInfo[i][dealerSpawnPos][3] = floatstr(field);
ServerInfo[total_dealerships] ++;
DealershipInfo[i][dealerExist] = true;
RefreshDealership(i);
}
db_free_result(dbresult);
return 1;
}
stock LoadDealershipVehicle(i)
{
new
DBResult:dbresult,
query[128],
field[20]
;
format(query, sizeof(query), "SELECT * FROM `dvehicles` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "dealershipid", field, sizeof(field)); DVehicleInfo[i][dealershipID] = strval(field);
db_get_field_assoc(dbresult, "model", field, sizeof(field)); DVehicleInfo[i][dealerModel] = strval(field);
db_get_field_assoc(dbresult, "price", field, sizeof(field)); DVehicleInfo[i][dvehiclePrice] = strval(field);
db_get_field_assoc(dbresult, "x", field, sizeof(field)); DVehicleInfo[i][dvehiclePos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); DVehicleInfo[i][dvehiclePos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); DVehicleInfo[i][dvehiclePos][2] = floatstr(field);
db_get_field_assoc(dbresult, "a", field, sizeof(field)); DVehicleInfo[i][dvehiclePos][3] = floatstr(field);
DVehicleInfo[i][dvehicleExist] = true;
RefreshDealershipVehicle(i);
}
db_free_result(dbresult);
return 1;
}
stock LoadATM(i)
{
new
DBResult:dbresult,
query[128],
field[20]
;
format(query, sizeof(query), "SELECT * FROM `atm` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "x", field, sizeof(field)); ATMInfo[i][atmPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); ATMInfo[i][atmPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); ATMInfo[i][atmPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "a", field, sizeof(field)); ATMInfo[i][atmPos][3] = floatstr(field);
db_get_field_assoc(dbresult, "interior", field, sizeof(field)); ATMInfo[i][atmInterior] = strval(field);
db_get_field_assoc(dbresult, "world", field, sizeof(field)); ATMInfo[i][atmWorld] = strval(field);
ServerInfo[total_atms] ++;
ATMInfo[i][atmExist] = true;
RefreshATM(i);
}
db_free_result(dbresult);
return 1;
}
stock Detector_Load(i)
{
new
DBResult:dbresult,
query[128],
field[20]
;
format(query, sizeof(query), "SELECT * FROM `detectors` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "x", field, sizeof(field)); MetalDetectors[i][detectorPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); MetalDetectors[i][detectorPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); MetalDetectors[i][detectorPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "a", field, sizeof(field)); MetalDetectors[i][detectorPos][3] = floatstr(field);
db_get_field_assoc(dbresult, "interior", field, sizeof(field)); MetalDetectors[i][detectorInterior] = strval(field);
db_get_field_assoc(dbresult, "world", field, sizeof(field)); MetalDetectors[i][detectorWorld] = strval(field);
MetalDetectors[i][detectorExists] = true;
ServerInfo[total_detectors] ++;
Detector_Refresh(i);
}
db_free_result(dbresult);
return 1;
}
stock LoadRepairGarage(i)
{
new
DBResult:dbresult,
query[128],
field[20]
;
format(query, sizeof(query), "SELECT * FROM `repairgarage` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "x", field, sizeof(field)); RepairInfo[i][repairPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); RepairInfo[i][repairPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); RepairInfo[i][repairPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "cost", field, sizeof(field)); RepairInfo[i][repairCost] = strval(field);
ServerInfo[total_repair] ++;
RefreshRepairGarage(i);
}
db_free_result(dbresult);
return 1;
}
stock LoadGarbage(i)
{
new
DBResult:dbresult,
query[128],
field[20]
;
format(query, sizeof(query), "SELECT * FROM `garbage` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "model", field, sizeof(field)); GarbageInfo[i][garbageModel] = strval(field);
db_get_field_assoc(dbresult, "capacity", field, sizeof(field)); GarbageInfo[i][garbageCapacity] = strval(field);
db_get_field_assoc(dbresult, "x", field, sizeof(field)); GarbageInfo[i][garbagePos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); GarbageInfo[i][garbagePos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); GarbageInfo[i][garbagePos][2] = floatstr(field);
db_get_field_assoc(dbresult, "a", field, sizeof(field)); GarbageInfo[i][garbagePos][3] = floatstr(field);
db_get_field_assoc(dbresult, "interior", field, sizeof(field)); GarbageInfo[i][garbageInterior] = strval(field);
db_get_field_assoc(dbresult, "world", field, sizeof(field)); GarbageInfo[i][garbageWorld] = strval(field);
ServerInfo[total_garbages] ++;
GarbageInfo[i][garbageExists] = true;
RefreshGarbage(i);
}
db_free_result(dbresult);
return 1;
}
stock LoadTower(i)
{
new
DBResult:dbresult,
query[128],
field[20]
;
format(query, sizeof(query), "SELECT * FROM `towers` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "x", field, sizeof(field)); TowerInfo[i][towerX] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); TowerInfo[i][towerY] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); TowerInfo[i][towerZ] = floatstr(field);
db_get_field_assoc(dbresult, "rx", field, sizeof(field)); TowerInfo[i][towerRX] = floatstr(field);
db_get_field_assoc(dbresult, "ry", field, sizeof(field)); TowerInfo[i][towerRY] = floatstr(field);
db_get_field_assoc(dbresult, "rz", field, sizeof(field)); TowerInfo[i][towerRZ] = floatstr(field);
db_get_field_assoc(dbresult, "interior", field, sizeof(field)); TowerInfo[i][towerInterior] = strval(field);
db_get_field_assoc(dbresult, "world", field, sizeof(field)); TowerInfo[i][towerWorld] = strval(field);
ServerInfo[total_towers] ++;
RefreshTower(i);
}
db_free_result(dbresult);
return 1;
}
stock Speed_Load(i)
{
new
DBResult:dbresult,
query[128],
field[20]
;
format(query, sizeof(query), "SELECT * FROM `speedcam` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "x", field, sizeof(field)); SpeedInfo[i][speedPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); SpeedInfo[i][speedPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); SpeedInfo[i][speedPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "a", field, sizeof(field)); SpeedInfo[i][speedPos][3] = floatstr(field);
db_get_field_assoc(dbresult, "range", field, sizeof(field)); SpeedInfo[i][speedRange] = floatstr(field);
db_get_field_assoc(dbresult, "limit", field, sizeof(field)); SpeedInfo[i][speedLimit] = floatstr(field);
ServerInfo[total_speedcam] ++;
Speed_Refresh(i);
}
db_free_result(dbresult);
return 1;
}
stock LoadVehicleDamage(i)
{
new
DBResult:dbresult,
query[128],
field[32]
;
format(query, sizeof(query), "SELECT * FROM `cardamage` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(!IsValidVehicle(DynamicVehicle[i][vID]))
return printf("[LoadVehicleDamage()] Vehicle for Dynamic Vehicle #%d hasn't been spawned.", i);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "health", field, sizeof(field)); DynamicVehicle[i][vHealth] = floatstr(field);
db_get_field_assoc(dbresult, "panel", field, sizeof(field)); DynamicVehicle[i][vDamages][0] = strval(field);
db_get_field_assoc(dbresult, "door", field, sizeof(field)); DynamicVehicle[i][vDamages][1] = strval(field);
db_get_field_assoc(dbresult, "lights", field, sizeof(field)); DynamicVehicle[i][vDamages][2] = strval(field);
db_get_field_assoc(dbresult, "tires", field, sizeof(field)); DynamicVehicle[i][vDamages][3] = strval(field);
SetVehicleHealth(DynamicVehicle[i][vID], DynamicVehicle[i][vHealth]);
UpdateVehicleDamageStatus(DynamicVehicle[i][vID], DynamicVehicle[i][vDamages][0], DynamicVehicle[i][vDamages][1], DynamicVehicle[i][vDamages][2], DynamicVehicle[i][vDamages][3]);
}
db_free_result(dbresult);
return 1;
}
stock LoadVehicleStorage(i)
{
new
DBResult:dbresult,
query[128],
field[20],
var[32]
;
format(query, sizeof(query), "SELECT * FROM `carstorage` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
for(new x = 0; x < 20; x++)
{
format(var, 32, "caritemname%d", x + 1);
db_get_field_assoc(dbresult, var, field, sizeof(field)); format(CarItem[i][x][carItemName], 32, field);
format(var, 32, "caritemquantity%d", x + 1);
db_get_field_assoc(dbresult, var, field, sizeof(field)); CarItem[i][x][carItemQuantity] = strval(field);
SetCarInventory(i, x, CarItem[i][x][carItemName], CarItem[i][x][carItemQuantity]);
}
}
db_free_result(dbresult);
return 1;
}
stock LoadVehicle(i)
{
new
DBResult:dbresult,
query[128],
field[20],
var[32]
;
format(query, sizeof(query), "SELECT * FROM `vehicles` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "owner", field, sizeof(field)); DynamicVehicle[i][vOwner] = strval(field);
db_get_field_assoc(dbresult, "type", field, sizeof(field)); DynamicVehicle[i][vType] = strval(field);
db_get_field_assoc(dbresult, "model", field, sizeof(field)); DynamicVehicle[i][vModel] = strval(field);
db_get_field_assoc(dbresult, "x", field, sizeof(field)); DynamicVehicle[i][vPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); DynamicVehicle[i][vPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); DynamicVehicle[i][vPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "a", field, sizeof(field)); DynamicVehicle[i][vPos][3] = floatstr(field);
db_get_field_assoc(dbresult, "interior", field, sizeof(field)); DynamicVehicle[i][vInterior] = strval(field);
db_get_field_assoc(dbresult, "world", field, sizeof(field)); DynamicVehicle[i][vWorld] = strval(field);
db_get_field_assoc(dbresult, "color1", field, sizeof(field)); DynamicVehicle[i][vColor1] = strval(field);
db_get_field_assoc(dbresult, "color2", field, sizeof(field)); DynamicVehicle[i][vColor2] = strval(field);
db_get_field_assoc(dbresult, "paintjob", field, sizeof(field)); DynamicVehicle[i][vPaintjob] = strval(field);
db_get_field_assoc(dbresult, "locked", field, sizeof(field)); DynamicVehicle[i][vLocked] = strval(field);
db_get_field_assoc(dbresult, "impound", field, sizeof(field)); DynamicVehicle[i][vImpounded] = strval(field);
db_get_field_assoc(dbresult, "impoundprice", field, sizeof(field)); DynamicVehicle[i][vImpoundPrice] = strval(field);
db_get_field_assoc(dbresult, "faction", field, sizeof(field)); DynamicVehicle[i][vFaction] = strval(field);
for(new x = 0; x < 14; x++)
{
format(var, 32, "mod%d", x + 1);
db_get_field_assoc(dbresult, var, field, sizeof(field)); DynamicVehicle[i][vMods][x] = strval(field);
}
DynamicVehicle[i][vExist] = true;
switch(DynamicVehicle[i][vType])
{
case 0: ServerInfo[total_pvehicle] ++;
case 1: ServerInfo[total_fvehicle] ++;
}
SpawnDynamicVehicle(i);
LoadVehicleDamage(i);
}
db_free_result(dbresult);
return 1;
}
stock LoadGas(i)
{
new
DBResult:dbresult,
query[128],
field[20]
;
format(query, sizeof(query), "SELECT * FROM `gas` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "x", field, sizeof(field)); GasInfo[i][gasPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); GasInfo[i][gasPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); GasInfo[i][gasPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "business", field, sizeof(field)); GasInfo[i][gasBusiness] = strval(field);
db_get_field_assoc(dbresult, "supply", field, sizeof(field)); GasInfo[i][gasFuel] = strval(field);
GasInfo[i][gasExist] = true;
Gas_Refresh(i);
ServerInfo[total_gas]++;
}
db_free_result(dbresult);
return 1;
}
stock LoadDroppedWeapon(i)
{
new
DBResult:dbresult,
query[128],
field[20]
;
format(query, sizeof(query), "SELECT * FROM `dropped` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "id", field, sizeof(field)); DroppedItems[i][droppedID] = strval(field);
db_get_field_assoc(dbresult, "itemname", field, sizeof(field)); format(DroppedItems[i][droppedItem], 32, field);
db_get_field_assoc(dbresult, "itemplayer", field, sizeof(field)); format(DroppedItems[i][droppedPlayer], 32, field);
db_get_field_assoc(dbresult, "itemmodel", field, sizeof(field)); DroppedItems[i][droppedModel] = strval(field);
db_get_field_assoc(dbresult, "itemweapon", field, sizeof(field)); DroppedItems[i][droppedWeapon] = strval(field);
db_get_field_assoc(dbresult, "itemammo", field, sizeof(field)); DroppedItems[i][droppedAmmo] = strval(field);
db_get_field_assoc(dbresult, "itemx", field, sizeof(field)); DroppedItems[i][droppedPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "itemy", field, sizeof(field)); DroppedItems[i][droppedPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "itemz", field, sizeof(field)); DroppedItems[i][droppedPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "itemint", field, sizeof(field)); DroppedItems[i][droppedInt] = strval(field);
db_get_field_assoc(dbresult, "itemworld", field, sizeof(field)); DroppedItems[i][droppedWorld] = strval(field);
ServerInfo[total_weapons] ++;
if (IsWeaponModel(DroppedItems[i][droppedModel]))
{
DroppedItems[i][droppedObject] = CreateDynamicObject(DroppedItems[i][droppedModel], DroppedItems[i][droppedPos][0], DroppedItems[i][droppedPos][1], DroppedItems[i][droppedPos][2], 93.7, 120.0, 120.0, DroppedItems[i][droppedWorld], DroppedItems[i][droppedInt]);
}
DroppedItems[i][droppedText3D] = CreateDynamic3DTextLabel(DroppedItems[i][droppedItem], COLOR_CYAN, DroppedItems[i][droppedPos][0], DroppedItems[i][droppedPos][1], DroppedItems[i][droppedPos][2], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, DroppedItems[i][droppedWorld], DroppedItems[i][droppedInt]);
}
db_free_result(dbresult);
return 1;
}
stock Arrest_Load(id)
{
new
query[128],
DBResult:dbresult,
field[20],
string[120]
;
format(query, sizeof(query), "SELECT * FROM `arrestpoints` WHERE `id` = %d", id);
dbresult = db_query(database, string);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "x", field, sizeof(field)); ArrestData[id][arrestPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); ArrestData[id][arrestPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); ArrestData[id][arrestPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "interior", field, sizeof(field)); ArrestData[id][arrestInterior] = strval(field);
db_get_field_assoc(dbresult, "world", field, sizeof(field)); ArrestData[id][arrestWorld] = strval(field);
db_get_field_assoc(dbresult, "type", field, sizeof(field)); ArrestData[id][arrestType] = strval(field);
format(string, sizeof(string), "[Arrest %d]\n{FFFFFF}/arrest to arrest the suspect.", id);
ArrestData[id][arrestPickup] = CreateDynamicPickup(1247, 23, ArrestData[id][arrestPos][0], ArrestData[id][arrestPos][1], ArrestData[id][arrestPos][2], ArrestData[id][arrestWorld], ArrestData[id][arrestInterior]);
ArrestData[id][arrestText3D] = CreateDynamic3DTextLabel(string, COLOR_DARKBLUE, ArrestData[id][arrestPos][0], ArrestData[id][arrestPos][1], ArrestData[id][arrestPos][2], 10.0, INVALID_VEHICLE_ID, INVALID_PLAYER_ID, 0, ArrestData[id][arrestWorld], ArrestData[id][arrestInterior]);
ServerInfo[total_arrests] ++;
}
db_free_result(dbresult);
return 1;
}
stock LoadImpounds(i)
{
new
DBResult:dbresult,
query[128],
field[20],
text[120]
;
format(query, sizeof(query), "SELECT * FROM `impounds` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "x", field, sizeof(field)); ImpoundInfo[i][impoundLot][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); ImpoundInfo[i][impoundLot][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); ImpoundInfo[i][impoundLot][2] = floatstr(field);
db_get_field_assoc(dbresult, "rx", field, sizeof(field)); ImpoundInfo[i][impoundRelease][0] = floatstr(field);
db_get_field_assoc(dbresult, "ry", field, sizeof(field)); ImpoundInfo[i][impoundRelease][1] = floatstr(field);
db_get_field_assoc(dbresult, "rz", field, sizeof(field)); ImpoundInfo[i][impoundRelease][2] = floatstr(field);
db_get_field_assoc(dbresult, "ra", field, sizeof(field)); ImpoundInfo[i][impoundRelease][3] = floatstr(field);
DestroyDynamic3DTextLabel(ImpoundInfo[i][impoundText3D][0]);
DestroyDynamic3DTextLabel(ImpoundInfo[i][impoundText3D][1]);
DestroyDynamicPickup(ImpoundInfo[i][impoundPickup]);
format(text, sizeof(text), "[ Impound #%d ]\n{FFFFFF}/impound to impound a vehicle.", i);
ImpoundInfo[i][impoundText3D][0] = CreateDynamic3DTextLabel(text, COLOR_DARKBLUE, ImpoundInfo[i][impoundLot][0], ImpoundInfo[i][impoundLot][1], ImpoundInfo[i][impoundLot][2], 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0);
format(text, sizeof(text), "[ {AFAFAF}Impound # %d Release Point{FFFFFF} ]", i);
if(ImpoundInfo[i][impoundRelease][0] != 0.0 && ImpoundInfo[i][impoundRelease][1] != 0.0)
{
ImpoundInfo[i][impoundText3D][1] = CreateDynamic3DTextLabel(text, -1, ImpoundInfo[i][impoundRelease][0], ImpoundInfo[i][impoundRelease][1], ImpoundInfo[i][impoundRelease][2], 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0);
}
ImpoundInfo[i][impoundPickup] = CreateDynamicPickup(1239, 23, ImpoundInfo[i][impoundLot][0], ImpoundInfo[i][impoundLot][1], ImpoundInfo[i][impoundLot][2]);
ServerInfo[total_impounds]++;
}
db_free_result(dbresult);
return 1;
}
stock LoadBiz(i)
{
new
query[128],
DBResult:dbresult,
field[130]
;
format(query, sizeof(query), "SELECT * FROM `business` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "name", field, sizeof(field)); format(BizInfo[i][bName], 32, field);
db_get_field_assoc(dbresult, "owner", field, sizeof(field)); BizInfo[i][bOwner] = strval(field);
db_get_field_assoc(dbresult, "message", field, sizeof(field)); format(BizInfo[i][bMessage], 128, field);
db_get_field_assoc(dbresult, "type", field, sizeof(field)); BizInfo[i][bType] = strval(field);
db_get_field_assoc(dbresult, "price", field, sizeof(field)); BizInfo[i][bPrice] = strval(field);
db_get_field_assoc(dbresult, "forsale", field, sizeof(field)); BizInfo[i][bForSale] = strval(field);
db_get_field_assoc(dbresult, "x", field, sizeof(field)); BizInfo[i][bPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); BizInfo[i][bPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); BizInfo[i][bPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "a", field, sizeof(field)); BizInfo[i][bPos][3] = floatstr(field);
db_get_field_assoc(dbresult, "ix", field, sizeof(field)); BizInfo[i][bInt][0] = floatstr(field);
db_get_field_assoc(dbresult, "iy", field, sizeof(field)); BizInfo[i][bInt][1] = floatstr(field);
db_get_field_assoc(dbresult, "iz", field, sizeof(field)); BizInfo[i][bInt][2] = floatstr(field);
db_get_field_assoc(dbresult, "ia", field, sizeof(field)); BizInfo[i][bInt][3] = floatstr(field);
db_get_field_assoc(dbresult, "dx", field, sizeof(field)); BizInfo[i][bDeliver][0] = floatstr(field);
db_get_field_assoc(dbresult, "dy", field, sizeof(field)); BizInfo[i][bDeliver][1] = floatstr(field);
db_get_field_assoc(dbresult, "dz", field, sizeof(field)); BizInfo[i][bDeliver][2] = floatstr(field);
db_get_field_assoc(dbresult, "interior", field, sizeof(field)); BizInfo[i][bInterior] = strval(field);
db_get_field_assoc(dbresult, "exteriorint", field, sizeof(field)); BizInfo[i][bExteriorInt] = strval(field);
db_get_field_assoc(dbresult, "exteriorvw", field, sizeof(field)); BizInfo[i][bExteriorVW] = strval(field);
db_get_field_assoc(dbresult, "locked", field, sizeof(field)); BizInfo[i][bLocked] = strval(field);
db_get_field_assoc(dbresult, "vault", field, sizeof(field)); BizInfo[i][bVault] = strval(field);
db_get_field_assoc(dbresult, "supply", field, sizeof(field)); BizInfo[i][bProducts] = strval(field);
new var[32];
for(new c = 0; c < 20; c++)
{
format(var, 32, "bizprice%d", c+1);
db_get_field_assoc(dbresult, var, field, sizeof(field)); BizInfo[i][bizPrice][c] = strval(field);
}
BizInfo[i][bDeliveryType] = -1;
BizInfo[i][bNeededStock] = 0;
BizInfo[i][bNeedsDelivery] = false;
BizInfo[i][bDeliveryProcess] = false;
Business_Refresh(i);
ServerInfo[total_biz]++;
}
db_free_result(dbresult);
return 1;
}
stock LoadHousesInventory(i)
{
new
query[128],
DBResult:dbresult,
field[35],
var[24]
;
format(query, sizeof(query), "SELECT * FROM `hinventory` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
for(new c = 0; c < MAX_HOUSE_INVENTORY; c++)
{
format(var, 24, "name%d", c + 1);
db_get_field_assoc(dbresult, var, field, sizeof(field)); format(HouseInventory[i][c][hInventoryname], 32, field);
format(var, 24, "quantity%d", c + 1);
db_get_field_assoc(dbresult, var, field, sizeof(field)); HouseInventory[i][c][hInventoryQuantity] = strval(field);
if(HouseInventory[i][c][hInventoryQuantity] > 0)
{
HouseInventory[i][c][hInventoryExist] = true;
}
}
}
db_free_result(dbresult);
return 1;
}
stock LoadHouses(i)
{
new
query[128],
DBResult:dbresult,
field[20]
;
format(query, sizeof(query), "SELECT * FROM `houses` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "owner", field, sizeof(field)); HouseInfo[i][hOwner] = strval(field);
db_get_field_assoc(dbresult, "address", field, sizeof(field)); format(HouseInfo[i][hAddress], 92, field);
db_get_field_assoc(dbresult, "forsale", field, sizeof(field)); HouseInfo[i][hForSale] = strval(field);
db_get_field_assoc(dbresult, "price", field, sizeof(field)); HouseInfo[i][hPrice] = strval(field);
db_get_field_assoc(dbresult, "x", field, sizeof(field)); HouseInfo[i][housePos][0] = floatstr(field);
db_get_field_assoc(dbresult, "y", field, sizeof(field)); HouseInfo[i][housePos][1] = floatstr(field);
db_get_field_assoc(dbresult, "z", field, sizeof(field)); HouseInfo[i][housePos][2] = floatstr(field);
db_get_field_assoc(dbresult, "a", field, sizeof(field)); HouseInfo[i][housePos][3] = floatstr(field);
db_get_field_assoc(dbresult, "ix", field, sizeof(field)); HouseInfo[i][houseInt][0] = floatstr(field);
db_get_field_assoc(dbresult, "iy", field, sizeof(field)); HouseInfo[i][houseInt][1] = floatstr(field);
db_get_field_assoc(dbresult, "iz", field, sizeof(field)); HouseInfo[i][houseInt][2] = floatstr(field);
db_get_field_assoc(dbresult, "ia", field, sizeof(field)); HouseInfo[i][houseInt][3] = floatstr(field);
db_get_field_assoc(dbresult, "hox", field, sizeof(field)); HouseInfo[i][houseObjectPos][0] = floatstr(field);
db_get_field_assoc(dbresult, "hoy", field, sizeof(field)); HouseInfo[i][houseObjectPos][1] = floatstr(field);
db_get_field_assoc(dbresult, "hoz", field, sizeof(field)); HouseInfo[i][houseObjectPos][2] = floatstr(field);
db_get_field_assoc(dbresult, "hoa", field, sizeof(field)); HouseInfo[i][houseObjectPos][3] = floatstr(field);
db_get_field_assoc(dbresult, "interior", field, sizeof(field)); HouseInfo[i][houseInterior] = strval(field);
db_get_field_assoc(dbresult, "exteriorint", field, sizeof(field)); HouseInfo[i][houseExteriorInt] = strval(field);
db_get_field_assoc(dbresult, "exteriorvw", field, sizeof(field)); HouseInfo[i][houseExteriorVW] = strval(field);
db_get_field_assoc(dbresult, "locked", field, sizeof(field)); HouseInfo[i][houseLocked] = strval(field);
db_get_field_assoc(dbresult, "money", field, sizeof(field)); HouseInfo[i][houseMoney] = strval(field);
db_get_field_assoc(dbresult, "sx", field, sizeof(field)); HouseInfo[i][houseStore][0] = floatstr(field);
db_get_field_assoc(dbresult, "sy", field, sizeof(field)); HouseInfo[i][houseStore][1] = floatstr(field);
db_get_field_assoc(dbresult, "sz", field, sizeof(field)); HouseInfo[i][houseStore][2] = floatstr(field);
House_Refresh(i);
ServerInfo[total_houses]++;
}
db_free_result(dbresult);
return 1;
}
stock LoadFacPay(i)
{
new
query[128],
DBResult:dbresult,
field[20],
var[32]
;
format(query, sizeof(query), "SELECT * FROM `facpay` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
for(new x=0; x<10; x++)
{
format(var, 32, "facpay%d", x);
db_get_field_assoc(dbresult, var, field, sizeof(field)); FactionInfo[i][facPay][x] = strval(field);
}
}
db_free_result(dbresult);
return 1;
}
stock LoadFactions(i)
{
new
query[128],
DBResult:dbresult,
field[20],
text[120],
var[32]
;
format(query, sizeof(query), "SELECT * FROM `factions` WHERE `id` = %d", i);
dbresult = db_query(database, query);
if(db_num_rows(dbresult))
{
db_get_field_assoc(dbresult, "factionname", field, sizeof(field)); format(FactionInfo[i][factionName], 62, field);
db_get_field_assoc(dbresult, "factionacronym", field, sizeof(field)); format(FactionInfo[i][factionAcro], 10, field);
db_get_field_assoc(dbresult, "board", field, sizeof(field)); format(FactionInfo[i][factionBoard], 110, field);
db_get_field_assoc(dbresult, "color", field, sizeof(field)); FactionInfo[i][factionColor] = strval(field);
db_get_field_assoc(dbresult, "type", field, sizeof(field)); FactionInfo[i][factionType] = strval(field);
db_get_field_assoc(dbresult, "rank1", field, sizeof(field)); format(FactionInfo[i][factionRank1], 32, field);
db_get_field_assoc(dbresult, "rank2", field, sizeof(field)); format(FactionInfo[i][factionRank2], 32, field);
db_get_field_assoc(dbresult, "rank3", field, sizeof(field)); format(FactionInfo[i][factionRank3], 32, field);
db_get_field_assoc(dbresult, "rank4", field, sizeof(field)); format(FactionInfo[i][factionRank4], 32, field);
db_get_field_assoc(dbresult, "rank5", field, sizeof(field)); format(FactionInfo[i][factionRank5], 32, field);
db_get_field_assoc(dbresult, "rank6", field, sizeof(field)); format(FactionInfo[i][factionRank6], 32, field);
db_get_field_assoc(dbresult, "rank7", field, sizeof(field)); format(FactionInfo[i][factionRank7], 32, field);
db_get_field_assoc(dbresult, "rank8", field, sizeof(field)); format(FactionInfo[i][factionRank8], 32, field);
db_get_field_assoc(dbresult, "rank9", field, sizeof(field)); format(FactionInfo[i][factionRank9], 32, field);
db_get_field_assoc(dbresult, "rank10", field, sizeof(field)); format(FactionInfo[i][factionRank10], 32, field);
db_get_field_assoc(dbresult, "lockerx", field, sizeof(field)); FactionInfo[i][factionLocker][0] = floatstr(field);
db_get_field_assoc(dbresult, "lockery", field, sizeof(field)); FactionInfo[i][factionLocker][1] = floatstr(field);
db_get_field_assoc(dbresult, "lockerz", field, sizeof(field)); FactionInfo[i][factionLocker][2] = floatstr(field);
db_get_field_assoc(dbresult, "lockerint", field, sizeof(field)); FactionInfo[i][factionLockerInt] = strval(field);
db_get_field_assoc(dbresult, "lockervw", field, sizeof(field)); FactionInfo[i][factionLockerVw] = strval(field);
for(new x=0; x<10; x++)
{
format(var, 32, "gun%d", x + 1);
db_get_field_assoc(dbresult, var, field, sizeof(field)); FactionInfo[i][factionGuns][x] = strval(field);
format(var, 32, "ammo%d", x + 1);
db_get_field_assoc(dbresult, var, field, sizeof(field)); FactionInfo[i][factionAmmo][x] = strval(field);
}
for(new x=0; x<8; x++)
{
format(var, 32, "skin%d", i + 1);
db_get_field_assoc(dbresult, var, field, sizeof(field)); FactionInfo[i][factionSkins][x] = strval(field);
}
db_get_field_assoc(dbresult, var, field, sizeof(field)); FactionInfo[i][factionCash] = strval(field);
DestroyDynamic3DTextLabel(FactionInfo[i][factionLockerText]);
format(text, sizeof(text), "[ %s #%d ]\n{FFFFFF}/locker to access the locker.\n/fmotd to check the locker board note", FactionInfo[i][factionAcro], i);
if(FactionInfo[i][factionType] != FACTION_GANG)
{
FactionInfo[i][factionLockerText] = CreateDynamic3DTextLabel(text, FactionInfo[i][factionColor], FactionInfo[i][factionLocker][0], FactionInfo[i][factionLocker][1], FactionInfo[i][factionLocker][2]+0.10, 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, FactionInfo[i][factionLockerVw], FactionInfo[i][factionLockerInt]);
}
else
{
FactionInfo[i][factionLockerText] = CreateDynamic3DTextLabel(text, 0xF0CC00FF, FactionInfo[i][factionLocker][0], FactionInfo[i][factionLocker][1], FactionInfo[i][factionLocker][2]+0.10, 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, FactionInfo[i][factionLockerVw], FactionInfo[i][factionLockerInt]);
}
ServerInfo[total_factions]++;
}
db_free_result(dbresult);
return 1;
}