Buildings and applications not loading?
#1

So I've tried lots of different methods to try and get my buildings and applications to load after converting MySQL to R41.4 and none of them are working. The buildings and applications save into the database fine but won't load.


Код:
stock LoadApplications()
{
	new query[256];
	for(new i = 1; i < MAX_APPLICATIONS; i++)
	{
		format(query, sizeof(query), "SELECT * FROM applications WHERE ID=%i", i);
		mysql_tquery(mysql, query, "LoadApplicationsSQL", "d", i);
	}
	return 1;
}

forward LoadApplicationsSQL(id);
public LoadApplicationsSQL(id)
{
    new rows;
    cache_get_row_count(rows);
    if(rows)
    {
        if(ApplicationInfo[id][SentIn] == 0)
    	{
        	new fetch[256];
        	cache_get_value_name_int(id, "ID", ApplicationInfo[id][ID]);
        	cache_get_value_name(id, "Name", fetch);
  			format(ApplicationInfo[id][Name], 128, fetch);
  			cache_get_value_name(id, "Question1", fetch);
  			format(ApplicationInfo[id][Question1], 128, fetch);
  			cache_get_value_name(id, "Question2", fetch);
  			format(ApplicationInfo[id][Question2], 128, fetch);
  			cache_get_value_name(id, "Question3", fetch);
  			format(ApplicationInfo[id][Question3], 128, fetch);
  			cache_get_value_name(id, "Question4", fetch);
  			format(ApplicationInfo[id][Question4], 128, fetch);
  			cache_get_value_name(id, "Question5", fetch);
  			format(ApplicationInfo[id][Question5], 128, fetch);
  			cache_get_value_name(id, "Question6", fetch);
  			format(ApplicationInfo[id][Question6], 128, fetch);
  			cache_get_value_name(id, "Accepted", fetch);
			ApplicationInfo[id][AppPassed]= strval(fetch);
			cache_get_value_name(id, "SentIn", fetch);
			ApplicationInfo[id][SentIn]= strval(fetch);
			ApplicationInfo[id][PlayerID] = -1;
		}
	}
	return 1;
}

stock LoadBuildings()
{
	mysql_tquery(mysql, "SELECT * FROM 'buildings'", "LoadBuildingsSQL");
	return 1;
}

forward LoadBuildingsSQL();
public LoadBuildingsSQL()
{
    new rows;
    cache_get_row_count(rows);
    for(new id = 1; id < rows; id++) if(id < MAX_BUILDINGS)
    {
   		new fetch[256];
    	cache_get_value_name_int(0, "ID", BuildingInfo[id][ID]);
 		cache_get_value_name(id, "Name", fetch);
		format(BuildingInfo[id][Name], 256, fetch);
		cache_get_value_name_float(id, "EnterX", BuildingInfo[id][EnterX]);
		cache_get_value_name_float(id, "EnterY", BuildingInfo[id][EnterY]);
		cache_get_value_name_float(id, "EnterZ", BuildingInfo[id][EnterZ]);
		cache_get_value_name_float(id, "ExitX", BuildingInfo[id][ExitX]);
		cache_get_value_name_float(id, "ExitY", BuildingInfo[id][ExitY]);
		cache_get_value_name_float(id, "ExitZ", BuildingInfo[id][ExitZ]);
		cache_get_value_name_int(id, "Interior", BuildingInfo[id][Int]);
		cache_get_value_name_int(id, "VirtualWorld", BuildingInfo[id][VW]);
		cache_get_value_name_int(id, "FreezeTimer", BuildingInfo[id][FreezeTimer]);
		if(BuildingInfo[id][EnterX] > 0.0) {
		    new string[256];
  			format(string, sizeof(string), "%s\nPress H to enter\nAlso /Enter or /Exit", BuildingInfo[id][Name]);
	    	Build3D[id] = CreateDynamic3DTextLabel(string,0xFFFFFFFF,BuildingInfo[id][EnterX],BuildingInfo[id][EnterY],BuildingInfo[id][EnterZ]+0.75, 25.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1, 100.0);
   			BuildPickup[id] = CreateDynamicPickup(1318, 1, BuildingInfo[id][EnterX],BuildingInfo[id][EnterY],BuildingInfo[id][EnterZ]);
		}
	}
	return 1;
}

Neither Load no matter what.
Saving the buildings and applications.

Код:
mysql_format(mysql, querylist, sizeof(querylist), "INSERT INTO `buildings` (`ID`, `Name`, `EnterX`, `EnterY`, `EnterZ`, `ExitX`, `ExitY`, `ExitZ`, `Interior`, `VirtualWorld`)\
					VALUES ('%d', '%e', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')", id, PCreateName[playerid], BuildingInfo[id][EnterX], BuildingInfo[id][EnterY], BuildingInfo[id][EnterZ], BuildingInfo[id][ExitX], BuildingInfo[id][ExitY], BuildingInfo[id][ExitZ], BuildingInfo[id][Int], id);
					mysql_query(mysql, querylist);

mysql_format(mysql, querylist, sizeof(querylist), "INSERT INTO `applications` (`ID`, `Name`, `Question1`, `Accepted`)\
					VALUES ('%d', '%e', '%e', 0)", PlayerInfo[playerid][AppID], PlayerInfo[playerid][Name], inputtext);
					mysql_query(mysql, querylist);
Note I added in a print to LoadBuildings(); and LoadbuildingsSQL. LoadBuildings() gets called but nothing happens no matter where print is in LoadBuildingsSQL
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)