MySQL issue.
#1

Код HTML:
PLUG::LoadVehicleTrunk(vehicle)
{
	new row[256];
	for(new count = 1; count < MAX_VEHICLE_WEAPONS; count++)
	{
		format(_query, sizeof(_query), "SELECT * FROM `vehweps` WHERE `vehSQL` = %d", vInfo[vehicle][ID]);
		mysql_query(_query);
		mysql_store_result();
		if(mysql_num_rows())
		{
			if(mysql_retrieve_row())
			{
		    	mysql_fetch_field_row(row, "dataID"),    	vehWep[vehicle][count][dataID] = strval(row);

		    	mysql_fetch_field_row(row, "vehSQL"),    	vehWep[vehicle][count][vehSQL] = strval(row);
		    	mysql_fetch_field_row(row, "wepModel"),  	vehWep[vehicle][count][wepModel] = strval(row);
		    	mysql_fetch_field_row(row, "OffsetX"),   	vehWep[vehicle][count][vOffsetX] = floatstr(row);
		    	mysql_fetch_field_row(row, "OffsetY"),   	vehWep[vehicle][count][vOffsetY] = floatstr(row);
		    	mysql_fetch_field_row(row, "OffsetZ"),   	vehWep[vehicle][count][vOffsetZ] = floatstr(row);
		    	mysql_fetch_field_row(row, "RotX"), 	 	vehWep[vehicle][count][vRotX] = floatstr(row);
		    	mysql_fetch_field_row(row, "RotY"),	 	 	vehWep[vehicle][count][vRotY] = floatstr(row);
		    	mysql_fetch_field_row(row, "RotZ"), 	 	vehWep[vehicle][count][vRotZ] = floatstr(row);
		    	mysql_fetch_field_row(row, "Wep"), 	 		vehWep[vehicle][count][Wep] = strval(row);
		    	mysql_fetch_field_row(row, "Ammo"), 	 	vehWep[vehicle][count][Ammo] = strval(row);
		    	mysql_fetch_field_row(row, "Slot"),			vehWep[vehicle][count][ServerSlot] = strval(row);
				if(vehWep[vehicle][count][Wep] != 0)
				{
	        		vehWep[vehicle][count][Exist] = true;
	        		vehWep[vehicle][count][wepObject] = CreateDynamicObject(vehWep[vehicle][count][wepModel], 0.0, 0.0, -1000.0, 0.0, 0.0, 0.0);
	        		AttachDynamicObjectToVehicle(vehWep[vehicle][count][wepObject], vehicle, vehWep[vehicle][count][vOffsetX], vehWep[vehicle][count][vOffsetY], vehWep[vehicle][count][vOffsetZ], vehWep[vehicle][count][vRotX], vehWep[vehicle][count][vRotY], vehWep[vehicle][count][vRotZ]);
				}
				mysql_free_result();
			}
		}
	}
	printf("Loaded %d rows, vehID: %d", count, vehicle);
	return 1;
}
It loads the same data, executes the same action, I have no clue why also the slot does not work fine, let me explain..

if I stored three guns: slot 1. ak, slot 2. deagle, slot 3. shotgun.

I type /take to take it as a temp data (doesnt reload database) it works
If I go restart, I do the same action, I may take another slot wep and object does not destroy
Reply
#2

Just mentioning these for now -
for integer fields in SQL you can use cache_get_field_content_int, or if R40+; cache_get_value_index_int and likewise with floats: cache_get_field_content_float & cache_get_value_index_float.

So you say it loads the same data, executes the same action?
Isn't this to do with saving it then? What's your saving code like?
What is your system supposed to do? How does it work? May need more information to understand what you're saying.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)