Delete cars ingame problem.
#1

Hello everybody !

I use this : /v edit suppr , to delete a car ingame. Thing is, when the command is used, the car is here.
I don't know what's the problem.
I have no error when i compile

Quote:

/* if(strcmp(tmp, "suppr", true)==0 )
{
if (!pack_isAdmin(playerid, 4))
{SendClientMessage(playerid, COLOR_ADMIN, noAcces); return 1;}
new getcarid = GetPlayerVehicleID(playerid);
CarInfo[getcarid][cAngle] = 0;
CarInfo[getcarid][cColorOne] = 1;
CarInfo[getcarid][cColorTwo] = 1;
CarInfo[getcarid][cOwner] = -1;
CarInfo[getcarid][cOldOwner] = -1;
CarInfo[getcarid][cDescription] = -1;
CarInfo[getcarid][cValue] = 0;
CarInfo[getcarid][cWindow] = 0;
CarInfo[getcarid][cRegistration] = 0;
CarInfo[getcarid][cOwned] = 0;
CarInfo[getcarid][cLock] = 0;
CarInfo[getcarid][cRespawnTime] = 3600;
CarInfo[getcarid][cStatus] = 1;
CarInfo[getcarid][cType] = 0;
CarInfo[getcarid][cFamily] = 255;
CarInfo[getcarid][cHuile] = 100;
CarInfo[getcarid][cFaction] = 255;
CarInfo[getcarid][cHouse] = 25555;
CarInfo[getcarid][cArme1] = 0;
CarInfo[getcarid][cArme2] = 0;
CarInfo[getcarid][cArme3] = 0;
CarInfo[getcarid][cArme4] = 0;
CarInfo[getcarid][cArme5] = 0;
CarInfo[getcarid][cAmo1] = 0;
CarInfo[getcarid][cAmo2] = 0;
CarInfo[getcarid][cAmo3] = 0;
CarInfo[getcarid][cAmo4] = 0;
CarInfo[getcarid][cAmo5] = 0;
CarInfo[getcarid][cDrugs] = 0;
CarInfo[getcarid][cRank] = 255;
CarInfo[getcarid][cHero] = 0;
CarInfo[getcarid][cMatos] = 0;
CarInfo[getcarid][cProds] = 0;
CarInfo[getcarid][cJob] = 0;
CarInfo[getcarid][tPaintJob] = -1;
CarInfo[getcarid][tExhausts] = -1;
CarInfo[getcarid][tFrontBumper] = -1;
CarInfo[getcarid][tRearBumper] = -1;
CarInfo[getcarid][tRoof] = -1;
CarInfo[getcarid][tSpoilers] = -1;
CarInfo[getcarid][tSideBumper] = -1;
CarInfo[getcarid][tWheels] = -1;
CarInfo[getcarid][tHydraulics] = -1;
CarInfo[getcarid][tNeon] = -1;
CarInfo[getcarid][tNitro] = -1;
CarInfo[getcarid][tSideBumper2] = -1;
memcpy(CarInfo[getcarid][cPlaque], "-1", 0,32*4,32*4);
RemovePlayerFromVehicle(playerid);
format(sql,sizeof(sql),"DELETE FROM srp_players_cars WHERE model='%s'",tmp);
MySQLCheckConnection();
mysql_query(sql);
SendClientMessage(playerid, COLOR_ADMIN, "[Admin] Vous avez supprimй le Vйhicule.");
GetPlayerName(playerid,playername,sizeof(playernam e));
printf("[Admin] %s supprime le vehicule. (ID %d)",playername,getcarid);
return 1;
}*/line


I'm kinda lost Someone can help me please ?
Reply
#2

Thread edited : Resolved the BigEar problem. So I update instead of post a new thread again with the problem of deleting cars.
Reply
#3

Place this in the code, before you remove the player from the vehicle.

DestroyVehicle(getcarid);
Reply
#4

Hello Abreezy,

The command is now working, i can delete the cars... But ! (Yeah unfortunately there is one) the thing is that, when i reboot the server, the cars i delete before spawn again.
How can I fix this ?
Reply
#5

Well how do you load vehicles?
Reply
#6

From my database
Reply
#7

Show me the code please
Reply
#8

Here you go, and thanks for helping me.

Quote:
Код:
public LoadSQLCars()
{
	new sql[64], fields[55][MAX_PLAYER_NAME], row[320];
	new Float:park_x, Float:park_y, Float:park_z, Float:park_a;

	format(sql, sizeof(sql), "SELECT COUNT(*) FROM srp_players_cars");
	MySQLCheckConnection();
	mysql_query(sql);
	mysql_store_result();
	mysql_fetch_row(row);
	totalcars = strval(row);
	mysql_free_result();
	for (new i=1; i<=totalcars; i++)
	{
		format(sql, sizeof(sql), "SELECT * FROM srp_players_cars WHERE id=%d", i);
		MySQLCheckConnection();
		mysql_query(sql);
		mysql_store_result();
		mysql_fetch_row(row);
		split(row, fields, '|');
		CarInfo[i][cModel] = strval(fields[1]);
		CarInfo[i][cLocationx] = floatstr(fields[2]);
		CarInfo[i][cLocationy] = floatstr(fields[3]);
		CarInfo[i][cLocationz] = floatstr(fields[4]);
		CarInfo[i][cAngle]     = floatstr(fields[5]);
		park_x = floatstr(fields[6]);
		park_y = floatstr(fields[7]);
		park_z = floatstr(fields[8]);
		park_a = floatstr(fields[9]);
		if (park_x != 0 && park_y != 0 && park_z != 0)
	    {
	    	CarInfo[i][cLocationx] = park_x;
			CarInfo[i][cLocationy] = park_y;
			CarInfo[i][cLocationz] = park_z;
			CarInfo[i][cAngle] = park_a;
	    }
		CarInfo[i][cColorOne] = strval(fields[10]);
		CarInfo[i][cColorTwo] = strval(fields[11]);
		CarInfo[i][cOwned] = strval(fields[12]);
		memcpy(CarInfo[i][cOwner], fields[13], 0, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4);
		memcpy(CarInfo[i][cOldOwner], fields[14], 0, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4);
        CarInfo[i][cFaction] = strval(fields[15]);
  		CarInfo[i][cFamily] =  strval(fields[16]);
		CarInfo[i][cType] = strval(fields[17]);
		memcpy(CarInfo[i][cDescription], fields[18], 0, 32*4, 32*4);
		CarInfo[i][cValue] = strval(fields[19]);
		CarInfo[i][cStatus] = strval(fields[20]);
		if(CarInfo[i][cStatus]==3) // Cela ne sauvegarde pas la position du garage, donc, on remet а defaut
		    {CarInfo[i][cStatus]=1;}
		CarInfo[i][cRespawnTime] = 3600;
		CarInfo[i][cWindow] = 0;
		CarInfo[i][cLock] = strval(fields[21]);
	    CarInfo[i][cHouse] = strval(fields[23]);
		CarInfo[i][cArme1] = strval(fields[24]);
		CarInfo[i][cArme2] = strval(fields[25]);
		CarInfo[i][cArme3] = strval(fields[26]);
		CarInfo[i][cArme4] = strval(fields[27]);
		CarInfo[i][cArme5] = strval(fields[28]);
		CarInfo[i][cAmo1] = strval(fields[29]);
		CarInfo[i][cAmo2] = strval(fields[30]);
		CarInfo[i][cAmo3] = strval(fields[31]);
		CarInfo[i][cAmo4] = strval(fields[32]);
		CarInfo[i][cAmo5] = strval(fields[33]);
		CarInfo[i][cDrugs] = strval(fields[34]);
		CarInfo[i][cHero] = strval(fields[35]);
		CarInfo[i][cMatos] = strval(fields[36]);
		CarInfo[i][cJob] = strval(fields[37]);
		CarInfo[i][tPaintJob] = strval(fields[38]);
		CarInfo[i][tExhausts] = strval(fields[39]);
		CarInfo[i][tFrontBumper] = strval(fields[40]);
		CarInfo[i][tRearBumper] = strval(fields[41]);
		CarInfo[i][tRoof] = strval(fields[42]);
		CarInfo[i][tSpoilers] = strval(fields[43]);
		CarInfo[i][tSideBumper] = strval(fields[44]);
		CarInfo[i][tWheels] = strval(fields[45]);
		CarInfo[i][tHydraulics] = strval(fields[46]);
		CarInfo[i][tNitro] = strval(fields[47]);
		CarInfo[i][tSideBumper2] = strval(fields[48]);
		CarInfo[i][tNeon] = strval(fields[49]);
		memcpy(CarInfo[i][cPlaque], fields[50], 0,32*4,32*4);
		CarInfo[i][cRank] = strval(fields[51]);
		CarInfo[i][cStelled] = strval(fields[52]);
		CarInfo[i][cHuile] = strval(fields[53]);
		CarInfo[i][cVignette] = strval(fields[54]);
		CarInfo[i][cPlaqueAfficher] = 1;
        mysql_free_result();

		if (carsreloaded==0)
		{
			AddStaticVehicleEx(CarInfo[i][cModel], CarInfo[i][cLocationx], CarInfo[i][cLocationy], CarInfo[i][cLocationz], CarInfo[i][cAngle], CarInfo[i][cColorOne], CarInfo[i][cColorTwo], -1);
			tuning_resetFacture(i);
		    tuning_applyDbTuning(i);
		    car_isrenting[i] = -1;
		    if(IsABike(i))
		    {
		        engineOn[i] = true;
				car_Engine(i);
		    }
		}
		else
			{car_respawn(i,false);}
        CreateVehicleLabel(i,-1);

        CreatePlate(i,1);
	}
	print("Fin Boucle 292");
	carsreloaded++;
}
Reply
#9

format(sql,sizeof(sql),"DELETE FROM srp_players_cars WHERE model='%s'",tmp);

In the command, what is that suppose to be doing? Where does it get the model = %s? I'm pretty sure you'd have to do it by ids, meaning %d.

Can you show me your debug for when you do the command, to see what it says?
Reply
#10

This is the debug line when I use the command.

Quote:

[15:18:31] CMySQLHandler::Query(DELETE FROM srp_players_cars WHERE model='suppr') - Successfully executed.

May I PM you my skype name ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)