Jump to content
  • 0

pomoc Mysql - help


Anonimus24

Dotaz

Ahoj mám problém a nevím jak ho vyřešit:

Kod:
 

Spoiler

stock IsVehiclesCreate(VehicleID)
{
    new query[128];
    mysql_format(g_SQL, query, sizeof(query), "SELECT COUNT(*) FROM `Vehicles` WHERE `ID`=%d", VehicleID);
    mysql_query(g_SQL, query);

    new found;
    cache_get_value_index_int(0, 0, found);
    return found;
}


stock CreateVehicleEx(VehType, Float:Veh_x, Float:Veh_y, Float:Veh_z, Float:Veh_a, color1, color2, respawn = -1)
{
	VehiclesCount ++;

	if(VehiclesCount < MAX_VEHICLE_EX)
	{
	    if(!IsVehiclesCreate(VehiclesCount))
	    {
	        //--
		    new string[128];
			new ab[][26]=
			{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};

			format(string, sizeof(string), "%d%s%d • %d%d%d%d", random(10), ab[random(26)], random(10), random(10),random(10),random(10),random(10));
			SetVehicleNumberPlate(VehiclesCount, string);

			new query[500];
			mysql_format(g_SQL, query, sizeof(query), "INSERT INTO `Vehicles`(`ID`,`VehType`,`Vehx`, `Vehz`, `Veha`, `color1`, `color2`, `respawn`, `Benzin`, `SPZ`) VALUES (%d, %f, %f, %f, %f, %d, %d, %d, %d, '%e')",VehiclesCount, Veh_x, Veh_y, Veh_z, Veh_a,color1,color2,respawn,Car_Gas[VehiclesCount],string);
			mysql_tquery(g_SQL, query);

			VehiclesCount = CreateVehicle(VehType, Float:Veh_x, Float:Veh_y, Float:Veh_z, Float:Veh_a, color1, color2, respawn);
		    SetVehicleHealth(VehiclesCount,999);

		    ZamekCar[VehiclesCount] = 0;
		    format(VehicleLocName[VehiclesCount],24,"");
		    //--
		    DestroyObject(Neon2[VehiclesCount]);
			DestroyObject(Neon[VehiclesCount]);
			DestroyObject(VehText[VehiclesCount]);
			DestroyObject(VehText2[VehiclesCount]);

			VehicleTextTuningColor[VehiclesCount] = -1;
			VehicleTuningColorLast[VehiclesCount] = -1;
			format(VehicleTextTuningSTR[VehiclesCount], 100, "");
			format(VehicleTuningSTRLast[VehiclesCount], 100, "");
			VehicleTextTuningSize[VehiclesCount] = 140;
			VehicleTuningSizeLast[VehiclesCount] = 140;
		    //--
		    VehiclePosX[VehiclesCount] = Veh_x;
		 	VehiclePosY[VehiclesCount] = Veh_y;
		 	VehiclePosZ[VehiclesCount] = Veh_z;
		 	VehicleColor[0][VehiclesCount] = color1;
			VehicleColor[1][VehiclesCount] = color2;
			VehiclePaint[VehiclesCount] = -1;
		 	NaplnitKanistrVozuID(VehiclesCount, 100);
		 	//--
		 	for(new i; i < 17; i ++) VehicleTune[i][VehiclesCount] = 0;
		    //--
		    DisableSipka(VehiclesCount);
		    //--
		    new engine,lights,alarm,doors,bonnet,boot,objective;
			GetVehicleParamsEx(VehiclesCount,engine,lights,alarm,doors,bonnet,boot,objective);
			SetVehicleParamsEx(VehiclesCount,0,0,0,0,0,0,objective);
		    //--
		    ForMaxPlayer(i) SetVehicleParamsForPlayer( VehiclesCount, i, 0, 0);
		}else mysql_tquery(g_SQL, "SELECT * FROM `Vehicles`", "LoadCar", "");
	}else print("Prekrocen Vozidla");
	return 1;
}


forward LoadCar();
public LoadCar()
{
	new rows = cache_num_rows();
	if(rows)
	{
		new id, loaded,spzname[400],vehti,respawnv;
		while(loaded < rows)
		{
		    VehiclesCount ++;

			cache_get_value_name_int(loaded, "ID", id);

            cache_get_value_float(loaded, "Vehx", VehiclePosX[id]);
			cache_get_value_float(loaded, "Vehy", VehiclePosY[id]);
			cache_get_value_float(loaded, "Vehz", VehiclePosZ[id]);
			cache_get_value_float(loaded, "Veha", VehiclePosA[id]);

			cache_get_value_int(loaded, "color1", VehicleColor[0][id]);
			cache_get_value_int(loaded, "color2", VehicleColor[1][id]);

			cache_get_value_int(loaded, "respawn", respawnv);
			cache_get_value_int(loaded, "Benzin", Car_Gas[id]);
		 	cache_get_value(loaded, "SPZ", spzname, 400);

            CreateVehicle(vehti, VehiclePosX[id], VehiclePosY[id], VehiclePosZ[id], VehiclePosA[id], VehicleColor[0][id], VehicleColor[1][id], respawnv);
            SetVehicleNumberPlate(VehiclesCount, spzname);
		}
		printf("Loaded %i Vehicles", loaded);
	}
	return 1;
}

 

 

Chyby které vypisuje:

 

Spoiler

[21:50:23] [INFO] changed log level from 'warning, error' to 'debug, info, warning, error'
[21:50:23] [DEBUG] mysql_format(1, 0x05741858, 128, "SELECT COUNT(*) FROM `Vehicles` WHERE `ID`=%d")
[21:50:23] [DEBUG] mysql_format: return value: '44'
[21:50:23] [DEBUG] mysql_query(1, "SELECT COUNT(*) FROM `Vehicles` WHERE `ID`=1", 1)
[21:50:23] [DEBUG] CHandle::Execute(this=0x7d0428, type=3, query=0x7cd440)
[21:50:23] [DEBUG] CConnection::Execute(query=0x7cd440, this=0x7ad5f8, connection=0x780af0)
[21:50:23] [DEBUG] CQuery::Execute(this=0x7cd440, connection=0x780af0)
[21:50:23] [INFO] query "SELECT COUNT(*) FROM `Vehicles` WHERE `ID`=1" successfully executed within 18.506 milliseconds
[21:50:23] [DEBUG] CResultSet::Create(connection=0x780af0, query_str='SELECT COUNT(*) FROM `Vehicles` WHERE `ID`=1')
[21:50:23] [DEBUG] created new resultset '0x7d26f0'
[21:50:23] [DEBUG] fetched MySQL result '0x7d2d08'
[21:50:23] [DEBUG] allocated 20 bytes for PAWN result
[21:50:23] [DEBUG] CHandle::Execute - return value: true
[21:50:23] [DEBUG] mysql_query: return value: '1'
[21:50:23] [DEBUG] cache_get_value_index_int(0, 0, 0x05741854)
[21:50:23] [DEBUG] cache_get_value_index_int: assigned value: '1'
[21:50:23] [DEBUG] cache_get_value_index_int: return value: '1'
[21:50:23] [DEBUG] mysql_tquery(1, "SELECT * FROM `Vehicles`", "LoadCar", "")
[21:50:23] [DEBUG] CCallback::Create(amx=0x2be78b0, name='LoadCar', format='', params=0x5741a54, param_offset=5)
[21:50:23] [DEBUG] CCallback::Create - callback index for 'LoadCar': 20
[21:50:23] [INFO] Callback 'LoadCar' set up for delayed execution.
[21:50:23] [DEBUG] created delayed callback with 0 parameter
[21:50:23] [DEBUG] CHandle::Execute(this=0x7d0428, type=1, query=0x7cd440)
[21:50:23] [DEBUG] CHandle::Execute - return value: true
[21:50:23] [DEBUG] mysql_tquery: return value: '1'
[21:50:23] [DEBUG] mysql_format(1, 0x05741858, 128, "SELECT COUNT(*) FROM `Vehicles` WHERE `ID`=%d")
[21:50:23] [DEBUG] mysql_format: return value: '44'

 

 

 

 

 

 

 

Link to comment
Share on other sites

1 odpověd na tuto otázku

Recommended Posts

  • 0

Nejde o chyby, ale o príliš detailné logovanie. Niekde v kóde máš pravdepodobne riadok mysql_log(ALL). Toto zapne logovanie aj info a debug správ, ktoré ťa pravdepodobne nezaujímajú. Väčšinou ti stačí logovanie errorov a warningov: mysql_log(ERROR | WARNING);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...