Vehicle ID Problem [MYSQL]
#1

Hello,

i dont know how it should work that i match the Database carid with the ingame car id

https://pic-upload.pw/img/0cd for example ingame its ID:1 and in the Database its ID 4

Код:
CMD:copcarloeschen(playerid, params[])
{
	new vid;
	if(!IsNumeric(params) || !strlen(params)) return SendClientMessage(playerid, 0xFF0000FF, "Error: Nutze: /copcarloeschen [Vehicle ID]");
	vid = strval(params);
	if(vid <= 0) return SendClientMessage(playerid, 0xFF0000FF, "Error: Vehicle-ID ist kein Fraktions-Fahrzeug.");
	for(new i=0; i<MAX_cop_VEHICLES; i++)
	{
	if(copVehicle[i][e_vID] == vid)
	{
			copVehicle[i][e_modelID] = 0;
			copVehicle[i][e_x] = 0.0;
			copVehicle[i][e_y] = 0.0;
			copVehicle[i][e_z] = 0.0;
			copVehicle[i][e_a] = 0.0;
			copVehicle[i][e_color1] = 0;
			copVehicle[i][e_color2] = 0;
			new query[128];
			format(query, sizeof(query), "DELETE FROM copVehicles WHERE ID = '%i'",vid);
			mysql_tquery(handle, query);
			DestroyVehicle(copVehicle[i][e_vID]);
			return SendClientMessage(playerid, 0x00FF00FF, "Fahrzeug gelцscht.");
				}
			}
	return SendClientMessage(playerid, 0xFF0000FF, "Error: Vehicle-ID ist kein Fraktions-Fahrzeug.");
}
thats the command to delete the car but it only delete the car if the database id and the ingame id match
Reply
#2

This is not a smart way to do it, you can't be sure that the database ID will be the same as the in-game id's, as in-game id's may change over time.
Reply
#3

Quote:
Originally Posted by denNorske
Посмотреть сообщение
This is not a smart way to do it, you can't be sure that the database ID will be the same as the in-game id's, as in-game id's may change over time.
hmm how can i solve the problem?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)