MySQL help again
#3

Quote:
Originally Posted by Heress
View Post
If your version of MYSQL is r40...r41...
Use mysql_tquery
https://sampwiki.blast.hk/wiki/MySQL#mysql_tquery
building's or applications aren't loading in with the tquery.

Code:
stock LoadBuildings()
{
	new query[256];
	for(new i = 1; i < MAX_APPLICATIONS; i++)
	{
		format(query, sizeof(query), "SELECT * FROM buildings WHERE ID=%i", i);
		mysql_tquery(mysql, query, "LoadBuildingsSQL", "d", i);
	}
	return 1;
}

forward LoadBuildingsSQL(id);
public LoadBuildingsSQL(id)
{
    new fields, rows;
    cache_get_row_count(rows);
	cache_get_field_count(fields);
    if(rows)
    {
   		new fetch[256];
    	cache_get_value_name(0, "ID", fetch);
		BuildingInfo[id][ID]= strval(fetch);
 		cache_get_value_name(0, "Name", fetch);
		format(BuildingInfo[id][Name], 256, fetch);
		cache_get_value_name_float(0, "EnterX", BuildingInfo[id][EnterX]);
		cache_get_value_name_float(0, "EnterY", BuildingInfo[id][EnterY]);
		cache_get_value_name_float(0, "EnterZ", BuildingInfo[id][EnterZ]);
		cache_get_value_name_float(0, "ExitX", BuildingInfo[id][ExitX]);
		cache_get_value_name_float(0, "ExitY", BuildingInfo[id][ExitY]);
		cache_get_value_name_float(0, "ExitZ", BuildingInfo[id][ExitZ]);
		cache_get_value_name_int(0, "Interior", BuildingInfo[id][Int]);
		cache_get_value_name_int(0, "VirtualWorld", BuildingInfo[id][VW]);
		cache_get_value_name_int(0, "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;
}
It shows up in the database fine, Doesn't load into game but compiling gave me no errors. I type /edit then enter the building ID it says the building doesn't exist in the database. Also the applications aren't loading.
Reply


Messages In This Thread
MySQL help again - by TheLeech - 17.01.2019, 16:40
Re: MySQL help again - by Heress - 17.01.2019, 16:42
Re: MySQL help again - by TheLeech - 17.01.2019, 16:51
Re: MySQL help again - by TheLeech - 18.01.2019, 08:44
Re: MySQL help again - by B3x7K - 18.01.2019, 09:40
Re: MySQL help again - by TheLeech - 18.01.2019, 10:09
Re: MySQL help again - by B3x7K - 18.01.2019, 11:56
Re: MySQL help again - by TheLeech - 18.01.2019, 12:31
Re: MySQL help again - by B3x7K - 19.01.2019, 00:00

Forum Jump:


Users browsing this thread: 2 Guest(s)