PDA

View Full Version : Factions, Houses, Vehicles not loading


Stefand
18/05/2013, 07:50 PM
Hello,

I have bought a VPS and I tried to start my script but I discovered that it is not loading the vehicles/houses/factions bans etc...


stock InitFactions()
{
new query[400];
for(new id; id < MAX_FACTIONS; id++) // Goes through all the slots, looking for the data
{
format(query, sizeof(query), "SELECT * FROM `Factions` WHERE `FactionID` = %d", id); // Selects all the information from the table
mysql_function_query(g_connectionHandle, query, true, "LoadFactionsCallback", "d", id);
}
return 1;
}

stock InitVehicles()
{
new query[400];
for(new id; id < MAX_VEHICLES; id++) // Goes through all the slots, looking for the data
{
format(query, sizeof(query), "SELECT * FROM `Vehicles` WHERE `CarFileID` = %d", id); // Selects all the information from the table
mysql_function_query(g_connectionHandle, query, true, "LoadVehiclesCallback", "d", id);
}
return 1;
}

stock InitHouses()
{
new query[400];
for(new id; id < MAX_HOUSES; id++) // Goes through all the slots, looking for the data
{
format(query, sizeof(query), "SELECT * FROM `Houses` WHERE `HouseID` = %d", id); // Selects all the information from the table
mysql_function_query(g_connectionHandle, query, true, "LoadHousesCallback", "d", id);
}
return 1;
}

public LoadFactionsCallback(factionid)
{
new
rows,
fields;

cache_get_data(rows, fields);
if(rows == 1)
{
new temp[50];
cache_get_row(0, 0, temp); // #0 = #1 in the DB
Factions[factionid][FactionID] = strval(temp);
cache_get_row(0, 1, Factions[factionid][FactionName]);
cache_get_row(0, 2, temp);
Factions[factionid][CommandTypes] = strval(temp);
cache_get_row(0, 3, Factions[factionid][RankName1]);
cache_get_row(0, 4, Factions[factionid][RankName2]);
cache_get_row(0, 5, Factions[factionid][RankName3]);
cache_get_row(0, 6, Factions[factionid][RankName4]);
cache_get_row(0, 7, Factions[factionid][RankName5]);
cache_get_row(0, 8, Factions[factionid][RankName6]);
cache_get_row(0, 9, Factions[factionid][RankName7]);
cache_get_row(0, 10, temp);
Factions[factionid][Skin1] = strval(temp);
cache_get_row(0, 11, temp);
Factions[factionid][Skin2] = strval(temp);
cache_get_row(0, 12, temp);
Factions[factionid][Skin3] = strval(temp);
cache_get_row(0, 13, temp);
Factions[factionid][Skin4] = strval(temp);
cache_get_row(0, 14, temp);
Factions[factionid][Skin5] = strval(temp);
cache_get_row(0, 15, temp);
Factions[factionid][Skin6] = strval(temp);
cache_get_row(0, 16, temp);
Factions[factionid][Skin7] = strval(temp);
cache_get_row(0, 17, temp);
Factions[factionid][HQInteriorID] = strval(temp);
cache_get_row(0, 18, temp);
Factions[factionid][HQInteriorX] = floatstr(temp);
cache_get_row(0, 19, temp);
Factions[factionid][HQInteriorY] = floatstr(temp);
cache_get_row(0, 20, temp);
Factions[factionid][HQInteriorZ] = floatstr(temp);
cache_get_row(0, 21, temp);
Factions[factionid][HQInteriorA] = floatstr(temp);
cache_get_row(0, 22, temp);
Factions[factionid][HQExteriorID] = strval(temp);
cache_get_row(0, 23, temp);
Factions[factionid][HQExteriorX] = floatstr(temp);
cache_get_row(0, 24, temp);
Factions[factionid][HQExteriorY] = floatstr(temp);
cache_get_row(0, 25, temp);
Factions[factionid][HQExteriorZ] = floatstr(temp);
cache_get_row(0, 26, temp);
Factions[factionid][HQExteriorA] = floatstr(temp);
cache_get_row(0, 27, temp);
Factions[factionid][SafeInteriorID] = strval(temp);
cache_get_row(0, 28, temp);
Factions[factionid][SafeX] = floatstr(temp);
cache_get_row(0, 29, temp);
Factions[factionid][SafeY] = floatstr(temp);
cache_get_row(0, 30, temp);
Factions[factionid][SafeZ] = floatstr(temp);
cache_get_row(0, 31, temp);
Factions[factionid][SafeWorld] = strval(temp);
cache_get_row(0, 32, temp);
Factions[factionid][HQLock] = strval(temp);
cache_get_row(0, 33, Factions[factionid][FOwner]);

Factions[factionid][HQExteriorPickupID] = CreateObject(1559,Factions[factionid][HQExteriorX],Factions[factionid][HQExteriorY],Factions[factionid][HQExteriorZ]+0.700, 0,0,0,250.0);
Factions[factionid][HQInteriorPickupID] = CreatePickup(1314,1,Factions[factionid][HQInteriorX],Factions[factionid][HQInteriorY],Factions[factionid][HQInteriorZ], 45000+factionid);
Factions[factionid][SafePickupID] = CreateDynamicPickup(1274, 23, Factions[factionid][SafeX], Factions[factionid][SafeY], Factions[factionid][SafeZ],Factions[factionid][SafeWorld], -1, -1, 150.0);

printf("[System] Faction %d with faction name: %s spawned.", factionid, Factions[factionid][FactionName]);

}
return 1;
}

public LoadVehiclesCallback(vehicleid)
{
new
rows,
fields;

cache_get_data(rows, fields);
if(rows == 1)
{
new temp[50];
cache_get_row(0, 0, temp); // #0 = #1 in the DB
Vehicles[vehicleid][CarFileID] = strval(temp);
cache_get_row(0, 2, temp);
Vehicles[vehicleid][ModelID] = strval(temp);
cache_get_row(0, 3, temp);
Vehicles[vehicleid][Color1] = strval(temp);
cache_get_row(0, 4, temp);
Vehicles[vehicleid][Color2] = strval(temp);
cache_get_row(0, 5, temp);
Vehicles[vehicleid][VPosX] = floatstr(temp);
cache_get_row(0, 6, temp);
Vehicles[vehicleid][VPosY] = floatstr(temp);
cache_get_row(0, 7, temp);
Vehicles[vehicleid][VPosZ] = floatstr(temp);
cache_get_row(0, 8, temp);
Vehicles[vehicleid][VPosAngle] = floatstr(temp);
cache_get_row(0, 9, temp);
Vehicles[vehicleid][LockStatus] = strval(temp);
cache_get_row(0, 10, temp);
Vehicles[vehicleid][FactionCar] = strval(temp);
cache_get_row(0, 11, Vehicles[vehicleid][VOwner]);
cache_get_row(0, 12, Vehicles[vehicleid][VPlate]);
cache_get_row(0, 13, temp);
Vehicles[vehicleid][VehicleWorld] = strval(temp);
cache_get_row(0, 14, temp);
Vehicles[vehicleid][VehicleInteriorID] = strval(temp);
cache_get_row(0, 15, temp);
Vehicles[vehicleid][SpeedoColor] = strval(temp);

Vehicles[vehicleid][VehicleID] = AddStaticVehicleEx(Vehicles[vehicleid][ModelID], Vehicles[vehicleid][VPosX], Vehicles[vehicleid][VPosY], Vehicles[vehicleid][VPosZ], Vehicles[vehicleid][VPosAngle], Vehicles[vehicleid][Color1], Vehicles[vehicleid][Color2], -1);
SetVehicleVirtualWorld(Vehicles[vehicleid][VehicleID], Vehicles[vehicleid][VehicleWorld]);//set vw
LinkVehicleToInterior(Vehicles[vehicleid][VehicleID], Vehicles[vehicleid][VehicleInteriorID]);//set int
SetVehicleNumberPlate(Vehicles[vehicleid][VehicleID], Vehicles[vehicleid][VPlate]);
Vehicles[vehicleid][Fuel] = 100;
Vehicles[vehicleid][Battery] = 100;
new query[500];
format(query, sizeof(query), "UPDATE `Vehicles` SET `VehicleID` = %d WHERE `CarFileID` = %d", Vehicles[vehicleid][VehicleID], vehicleid);
mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");

printf("[System] Vehicle %d has been succesfully spawned!", vehicleid);
SpawnedVehicles++;
}
return 1;
}

public LoadHousesCallback(houseid)
{
new
rows,
fields;

cache_get_data(rows, fields);
if(rows == 1)
{
new temp[50];
cache_get_row(0, 0, temp); // #0 = #1 in the DB
Houses[houseid][HouseID] = strval(temp);
cache_get_row(0, 1, temp);
Houses[houseid][hInteriorID] = strval(temp);
cache_get_row(0, 2, temp);
Houses[houseid][hInteriorX] = floatstr(temp);
cache_get_row(0, 3, temp);
Houses[houseid][hInteriorY] = floatstr(temp);
cache_get_row(0, 4, temp);
Houses[houseid][hInteriorZ] = floatstr(temp);
cache_get_row(0, 5, temp);
Houses[houseid][hInteriorA] = floatstr(temp);
cache_get_row(0, 6, temp);
Houses[houseid][hExteriorID] = strval(temp);
cache_get_row(0, 7, temp);
Houses[houseid][hExteriorX] = floatstr(temp);
cache_get_row(0, 8, temp);
Houses[houseid][hExteriorY] = floatstr(temp);
cache_get_row(0, 9, temp);
Houses[houseid][hExteriorZ] = floatstr(temp);
cache_get_row(0, 10, temp);
Houses[houseid][hExteriorA] = floatstr(temp);
cache_get_row(0, 11, temp);
Houses[houseid][hSpawnID] = strval(temp);
cache_get_row(0, 12, temp);
Houses[houseid][hSpawnX] = floatstr(temp);
cache_get_row(0, 13, temp);
Houses[houseid][hSpawnY] = floatstr(temp);
cache_get_row(0, 14, temp);
Houses[houseid][hSpawnZ] = floatstr(temp);
cache_get_row(0, 15, temp);
Houses[houseid][hSpawnA] = floatstr(temp);
cache_get_row(0, 16, Houses[houseid][hOwner]);
cache_get_row(0, 17, Houses[houseid][hAddress]);
cache_get_row(0, 18, temp);
Houses[houseid][HousePrice] = strval(temp);
cache_get_row(0, 19, temp);
Houses[houseid][hLockStatus] = strval(temp);
cache_get_row(0, 20, Houses[houseid][hType]);
cache_get_row(0, 21, temp);
Houses[houseid][LastLoginDay] = strval(temp);
cache_get_row(0, 22, temp);
Houses[houseid][LastLoginMonth] = strval(temp);
cache_get_row(0, 23, temp);
Houses[houseid][LastLoginYear] = strval(temp);

if(strcmp(Houses[houseid][hOwner], "Nobody", true) == 0)
{
Houses[houseid][hLockStatus] = 1;
Houses[houseid][HPickupID] = CreatePickup(1273, 23, Houses[houseid][hExteriorX], Houses[houseid][hExteriorY], Houses[houseid][hExteriorZ], 0);
}
else
{
Houses[houseid][HPickupID] = CreateObject(1559,Houses[houseid][hExteriorX],Houses[houseid][hExteriorY],Houses[houseid][hExteriorZ]+0.700, 0,0,0,250.0);

}

printf("[System] House %d has been succesfully spawned!", houseid);
SpawnedHouses++;
}
/*if(rows == 0) return print("Error -> Empty Houses Database!");
if(rows > MAX_HOUSES) return print("Error -> Too Many Data Row! [Houses DB]");*/
return 1;
}

public OnGameModeInit()
{
mysql_debug(SQL_DEBUG);
//mysql_log(LOG_ERROR | LOG_WARNING);
g_connectionHandle = mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);

if(mysql_ping() == 1) print(" * Connecting to MySQL: Success"); //Als mysql_ping gelijk staat aan 1 betekent dat dat er connectie is.
else print(" x [ERROR] Connecting to MySQL: Failed"); //Zo niet, dan niet :O!

Streamer_VisibleItems(STREAMER_TYPE_OBJECT, 1000);

SetGameModeText(""#SCRIPT_MODE" "#SCRIPT_VERSION"");
EnableStuntBonusForAll(0);
DisableInteriorEnterExits();
ManualVehicleEngineAndLights();
ShowPlayerMarkers(0);

InitFactions();
InitVehicles();
InitHouses();
LoadObjects();


FadeInit();
}
return 1;
}


I use BlueG R7, and my VPS is linux Cent OS.
What can be the problem? Is there something wrong with the plugins or is it the script?
On my Windows7 Localhost it all worked fine...

Stefand
18/05/2013, 08:13 PM
MYSQL log:

[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 91 | d
[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 92 | d
[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 93 | d
[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 94 | d
[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 95 | d
[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 96 | d
[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 97 | d
[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 98 | d
[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 99 | d
[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 100 | d
[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 101 | d
[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 102 | d
[22:12:08] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError()
[22:12:08] Passing query SELECT * FROM `Vehicles` WHERE `CarFileID` = 103 | d
This is where the file is spammed with. for Cars, Houses and Factions...
What does it mean?

Its supposed to do show this in the console:

[13:33:05] * Connecting to MySQL: Success
[13:33:05]
[13:33:05]
[13:33:05] -----------------------GAMEMODE LOADING-----------------------
[13:33:05] ------------- Gamemode created by: Stefantjuh97 --------------
[13:33:05] --------------- Email: Stefantjuh97@gmail.com ----------------
[13:33:05] -----------------------GAMEMODE LOADED-----------------------
[13:33:05]
[13:33:05]
[13:33:05] Number of vehicle models: 0
[13:33:05] [System] Faction 1 with faction name: Los Santos Police Department spawned.
[13:33:05] [System] Faction 2 with faction name: Los Santos Emergency Services spawned.
[13:33:05] [System] Faction 3 with faction name: Federal Bureau of Investigations spawned.
[13:33:05] [System] Faction 4 with faction name: Cable News Network spawned.
[13:33:05] [System] Faction 5 with faction name: Taxi Company spawned.
[13:33:06] [System] Vehicle 1 has been succesfully spawned!
[13:33:06] [System] Vehicle 2 has been succesfully spawned!
[13:33:06] [System] Vehicle 3 has been succesfully spawned!
[13:33:06] [System] Vehicle 4 has been succesfully spawned!
[13:33:06] [System] Vehicle 5 has been succesfully spawned!
[13:33:06] [System] Vehicle 6 has been succesfully spawned!
[13:33:06] [System] Vehicle 7 has been succesfully spawned!
[13:33:06] [System] Vehicle 8 has been succesfully spawned!
[13:33:06] [System] Vehicle 9 has been succesfully spawned!
[13:33:06] [System] Vehicle 10 has been succesfully spawned!
[13:33:06] [System] Vehicle 11 has been succesfully spawned!
[13:33:06] [System] Vehicle 12 has been succesfully spawned!
[13:33:06] [System] Vehicle 13 has been succesfully spawned!
[13:33:06] [System] Vehicle 14 has been succesfully spawned!
[13:33:06] [System] Vehicle 15 has been succesfully spawned!
[13:33:06] [System] Vehicle 16 has been succesfully spawned!

^Localhost

on the VPS it shows:

[22:48:44] * Connecting to MySQL: Success
[22:48:44]
[22:48:44]
[22:48:44] -----------------------GAMEMODE LOADING-----------------------
[22:48:44] ------------- Gamemode created by: Stefantjuh97 --------------
[22:48:44] --------------- Email: Stefantjuh97@gmail.com ----------------
[22:48:44] -----------------------GAMEMODE LOADED-----------------------
[22:48:44]
[22:48:44]
[22:48:44] Number of vehicle models: 0

Richie©
18/05/2013, 11:30 PM
Do you even have prints in OnQueryError?