SA-MP Forums Archive
Mysql Loading issue - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql Loading issue (/showthread.php?tid=629734)



Mysql Loading issue - JessThompson - 03.03.2017

This line [CellSystem[total][CellSQLID] = cache_get_field_content_int(i, "id");]does not seem to be loading for some reason because the print at the bottom shows this

Код:
[21:28:53] loop id: 45 | enum id: 0
[21:28:53] loop id: 46 | enum id: 0
[21:28:53] loop id: 47 | enum id: 0
[21:28:53] loop id: 48 | enum id: 0
[21:28:53] loop id: 49 | enum id: 0
[21:28:53] loop id: 50 | enum id: 0
Loading System

Код:
{
	new total, pickupmodel, LabelCell[258], InitialTicks = GetTickCount();
	for(new i = 0, r = cache_num_rows(); i < r; i++)
	{
		CellSystem[total][CellSQLID] = cache_get_field_content_int(i, "id");

		cache_get_field_content(i, "Cell_Name", CellSystem[total][CellName], g_iHandle, 128);

		CellSystem[total][CellLocked] = cache_get_field_content_int(i, "Cell_Locked");
		CellSystem[total][CellOwner] = cache_get_field_content_int(i, "Cell_Owner");
		CellSystem[total][CellPrice] = cache_get_field_content_int(i, "Cell_Price");
		CellSystem[total][CellLevel] = cache_get_field_content_int(i, "Cell_Level");
		CellSystem[total][CellWeaponOne] = cache_get_field_content_int(i, "Cell_Weapon_One");
		CellSystem[total][CellWeaponTwo] = cache_get_field_content_int(i, "Cell_Weapon_Two");
		CellSystem[total][CellWeed] = cache_get_field_content_int(i, "Cell_Weed");
		CellSystem[total][CellCoke] = cache_get_field_content_int(i, "Cell_Coke");

		CellSystem[total][CellEntPosX] = cache_get_field_content_float(i, "Cell_Ent_Pos_X");
		CellSystem[total][CellEntPosY] = cache_get_field_content_float(i, "Cell_Ent_Pos_Y");
		CellSystem[total][CellEntPosZ] = cache_get_field_content_float(i, "Cell_Ent_Pos_Z");
		CellSystem[total][CellExtPosX] = cache_get_field_content_float(i, "Cell_Ext_Pos_X");
		CellSystem[total][CellExtPosY] = cache_get_field_content_float(i, "Cell_Ext_Pos_Y");
		CellSystem[total][CellExtPosZ] = cache_get_field_content_float(i, "Cell_Ext_Pos_Z");

		CellSystem[total][CellLoaded] = 1;

		if(CellSystem[total][CellOwner] == -1) pickupmodel = 19522;
		else pickupmodel = 1273;

		CellSystem[total][CellPickup] = CreateDynamicPickup(pickupmodel, 23, CellSystem[total][CellEntPosX], CellSystem[total][CellEntPosY], CellSystem[total][CellEntPosZ], 0, -1, -1, 20.0);

		if(CellSystem[total][CellOwner] == -1) format(LabelCell, sizeof(LabelCell), "%s\n /buycell to buy this cell for $%d", CellSystem[total][CellName], CellSystem[total][CellPrice]);
		else format(LabelCell, sizeof(LabelCell), "%s\n Owner: %s | Cell level: %i | Cell Locked: %i", CellSystem[total][CellName], ReturnNameFromID(CellSystem[total][CellOwner]), CellSystem[total][CellLevel], CellSystem[total][CellLocked]);

		CellSystem[total][CellLabel] = CreateDynamic3DTextLabel(LabelCell, -1, CellSystem[total][CellEntPosX], CellSystem[total][CellEntPosY], CellSystem[total][CellEntPosZ]+0.5, 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, -1, -1, 15.0);
    	total++;

    	printf("loop id: %i | enum id: %i", total, CellSystem[total][CellSQLID]);

	}
	printf("%i cells have been successfully loaded. [%i miliseconds]", cache_num_rows(), GetTickCount() - InitialTicks);
	return 1;
}
EDIT:

This is my mysql log too ?#

Код:
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype
[21:33:09 03/02/17] [ERROR] cache_get_field_content_int - invalid datatype



Respuesta: Mysql Loading issue - mcreed - 03.03.2017

The error that the log prints by the 'id' field is not an Integer (Int).


Re: Respuesta: Mysql Loading issue - JessThompson - 03.03.2017

Quote:
Originally Posted by mcreed
Посмотреть сообщение
The error that the log prints by the 'id' field is not an Integer (Int).
It is in my database so why would it not be grabbing it as a int?


Re: Mysql Loading issue - JessThompson - 03.03.2017




Respuesta: Mysql Loading issue - mcreed - 03.03.2017

Could you pass a screen shot of the field?
Sorry, i used the ****** traductor for translate u.u

EDIT:
I look that you took a photo


Respuesta: Mysql Loading issue - mcreed - 03.03.2017

You can not teach more code, at least from where you do the consultation?


Re: Mysql Loading issue - JessThompson - 03.03.2017

eh? I don't understand


Re: Mysql Loading issue - noxno0609 - 03.03.2017

Is your Column ID auto-increment?
If it not, it will explain why all CellID is 0.


Re: Mysql Loading issue - JessThompson - 04.03.2017

Yep it is




Re: Mysql Loading issue - JessThompson - 05.03.2017

Can anybody help me with this?