08.12.2016, 09:49
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
destroy object in OnVehicleSpawn
the object is not destroying....
Код:
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; }
Код:
{ DestroyObject(obj); DestroyObject(obj1); DestroyObject(obj2); DestroyObject(obj3); DestroyObject(obj4); DestroyObject(obj5); DestroyObject(obj6); DestroyObject(obj7); DestroyObject(obj8); DestroyObject(obj9); }