destroy object
#1

i have an object attached to vehicle my code is this, playercar is the array that every vips spawn vehicle so i have to destroy the attached objects... i use the Destroyobject(); in OnVehicleSpawn() but the object is not destroying and its sticks to another vehicle spawned in playercar array

Код:
CMD:sleigh(playerid,params[])
{
    if(GetPVarInt(playerid,"InDM") == 1) return SendLangMessage(playerid,_COLOR_RED2,"Du kannst diesen Befehl nicht in der Deathmatch Zone benutzen !","You can not use this command in deathmatch zone!","No puedes usar este comando en la zona de DeathMatch!");
	{
	if(PlayerSpawnedVehicle[playerid] == 1) DestroyVehicle(PlayerCar[playerid]);
    new Float:x, Float:y, Float:z, Float:a;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    PlayerCar[playerid] = CreateVehicle(578, x +2, y, z+4, a, -1, -1, 60);
	AttachObjectToVehicle(obj, PlayerCar[playerid], 0.000000, 1.699998, 0.634999, 0.000000, 0.000000, 0.000000); //Object Model: 1251 |
	AttachObjectToVehicle(obj1, PlayerCar[playerid], 0.374999, 4.085045, 0.344999, -1.004999, 1.005000, 88.439956); //Object Model: 19315 |
	AttachObjectToVehicle(obj2, PlayerCar[playerid], -0.389999, 4.085045, 0.344999, -1.004999, 1.005000, 88.439956); //Object Model: 19315 |
	AttachObjectToVehicle(obj3, PlayerCar[playerid], -0.389999, 2.195002, 0.344999, -1.004999, 1.005000, 88.439956); //Object Model: 19315 |
	AttachObjectToVehicle(obj4, PlayerCar[playerid], 0.359999, 2.195002, 0.344999, -1.004999, 1.005000, 88.439956); //Object Model: 19315 |
	AttachObjectToVehicle(obj5, PlayerCar[playerid], 0.359999, 2.590011, 0.704999, -1.004999, 1.005000, 175.875076); //Object Model: 1736 |
	AttachObjectToVehicle(obj6, PlayerCar[playerid], -0.344999, 2.590011, 0.704999, -1.004999, 1.005000, 175.875076); //Object Model: 1736 |
	AttachObjectToVehicle(obj7, PlayerCar[playerid], -0.344999, 4.440053, 0.704999, -1.004999, 1.005000, 175.875076); //Object Model: 1736 |
	AttachObjectToVehicle(obj8, PlayerCar[playerid], 0.399999, 4.440053, 0.704999, -1.004999, 1.005000, 175.875076); //Object Model: 1736 |
	AttachObjectToVehicle(obj9, PlayerCar[playerid], 0.000000, 0.014999, 0.624999, 24.119993, 91.454948, 0.000000); //Object Model: 19439 |

    LinkVehicleToInterior(PlayerCar[playerid], 6);
    //PutPlayerInVehicle(playerid, PlayerCar[playerid], 0);
    PlayerSpawnedVehicle[playerid] = 1;
    VehiclesToDestroy[PlayerCar[playerid]] = 1;
    Adminveh[playerid] = -1;
    SledgeSpawned[playerid] = 1;
    SendLangMessage(playerid,_COLOR_LIME,"Du hast dir eine Schlitten gespawnt !","You spawned a Sleigh !","Sacaste un Trineo !");
	}
	return 1;
}
destroy object in OnVehicleSpawn

Код:
{
			DestroyObject(obj);
			DestroyObject(obj1);
			DestroyObject(obj2);
			DestroyObject(obj3);
			DestroyObject(obj4);
			DestroyObject(obj5);
			DestroyObject(obj6);
			DestroyObject(obj7);
			DestroyObject(obj8);
			DestroyObject(obj9);
}
the object is not destroying....
Reply
#2

nunu_edited_nothing_here_cause_I_Just_wanted_posts
Reply
#3

Specify the vehicle that the objects are attached to
Reply
#4

the vehicle id is 578 - dft - 30 i've done it alraedy...

Код:
if(vehicleid == 578)
		{
			DestroyObject(obj);
			DestroyObject(obj1);
			DestroyObject(obj2);
			DestroyObject(obj3);
			DestroyObject(obj4);
			DestroyObject(obj5);
			DestroyObject(obj6);
			DestroyObject(obj7);
			DestroyObject(obj8);
			DestroyObject(obj9);
            printf("object detroyed");
		}
Reply
#5

According to your code, only one vehicle can have attached objects at a time. Vehicle ID is not equal to Vehicle Model ID by the way and use an array to store the object IDs - having them renamed like "objn" is ridiculous.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)