Jump to content
  • 0

trader area anti Vehicle script help.


titan

Question

hi i posted my inquiry on another site and was directed here by another member. i know there is a topic allready here about this but i did'nt want to hijack it. as a noob scripter i been working on something like this, at the moment it is only for stary as i am still tying to get this to work correctly.

waitUntil {!isNil "dayz_animalCheck"};

publicVariable "delVehicle";
delVehicle = 0;

while {delVehicle == 0} do {

private["_VehicleList"];

_VehicleList = nearestObjects [[6331.0352, 7802.3911],["AH6X_DZ","AN2_DZ","ArmoredSUV_PMC_DZE","ATV_CZ_EP1","ATV_US_EP1","C130J_US_EP1","car_hatchback","car_sedan","CH_47F_EP1_DZE","CSJ_GyroC","CSJ_GyroCover","CSJ_GyroP","datsun1_civil_1_open","datsun1_civil_2_covered","datsun1_civil_3_open","Fishing_Boat","GAZ_Vodnik_DZE","GAZ_Vodnik_MedEvac","GLT_M300_LT","GLT_M300_ST","GNT_C185","GNT_C185C","GNT_C185R","GNT_C185U","hilux1_civil_1_open","hilux1_civil_2_covered","hilux1_civil_3_open_EP1","HMMWV_Ambulance","HMMWV_Ambulance_CZ_DES_EP1","HMMWV_DES_EP1","HMMWV_DZ","HMMWV_M1035_DES_EP1","HMMWV_M1151_M2_CZ_DES_EP1_DZE","HMMWV_M998A2_SOV_DES_EP1_DZE","Ikarus","Ikarus_TK_CIV_EP1","JetSkiYanahui_Case_Blue","JetSkiYanahui_Case_Green","JetSkiYanahui_Case_Red","JetSkiYanahui_Case_Yellow","Kamaz","KamazRefuel_DZ","Lada1","Lada1_TK_CIV_EP1","Lada2","Lada2_TK_CIV_EP1","LadaLM","LandRover_CZ_EP1","LandRover_MG_TK_EP1_DZE","LandRover_Special_CZ_EP1_DZE","LandRover_TK_CIV_EP1","M1030_US_DES_EP1","MH6J_DZ","Mi17_Civilian_DZ","Mi17_DZE","MMT_Civ","MtvrRefuel_DES_EP1_DZ","MTVR_DES_EP1","MV22_DZ","Offroad_DSHKM_Gue_DZE","Old_bike_TK_INS_EP1","Old_moto_TK_Civ_EP1","PBX","Pickup_PK_GUE_DZE","Pickup_PK_INS_DZE","Pickup_PK_TK_GUE_EP1_DZE","RHIB","S1203_ambulance_EP1","S1203_TK_CIV_EP1","Skoda","SkodaBlue","SkodaGreen","SkodaRed","Smallboat_1","Smallboat_2","SUV_Blue","SUV_Camo","SUV_Charcoal","SUV_Green","SUV_Orange","SUV_Pink","SUV_Red","SUV_Silver","SUV_TK_CIV_EP1","SUV_White","SUV_Yellow","tractor","TT650_Civ","TT650_Ins","TT650_TK_CIV_EP1","UAZ_CDF","UAZ_INS","UAZ_MG_TK_EP1_DZE","UAZ_RU","UAZ_Unarmed_TK_CIV_EP1","UAZ_Unarmed_TK_EP1","UAZ_Unarmed_UN_EP1","UH1H_DZE","UH1Y_DZE","UH60M_EP1_DZE","UralRefuel_TK_EP1_DZ","Ural_CDF","Ural_TK_CIV_EP1","Ural_UN_EP1","V3S_Open_TK_CIV_EP1","V3S_Open_TK_EP1","V3S_Refuel_TK_GUE_EP1_DZ","VolhaLimo_TK_CIV_EP1","Volha_1_TK_CIV_EP1","Volha_2_TK_CIV_EP1","VWGolf","Zodiac"], 100];	
VehCount = count _VehicleList; 
i = 0;
for "i" from 0 to VehCount do 
	{ 
		v = _VehicleList select i;
		deleteVehicle v; 
	};
    "delVehicle" =1;
    titleText ["Deleted All Vehicles within 100 meters of Trader Zones !.","PLAIN"];titlefadeOut 5;
};

currently it is set to delete ( the vehicles return on restart) for testing. it will be changed to"v setdamage 1;"

or even some sort of teliport script to teliport them to random locations.

 

problem is it deletes vehicles everytime someone joins the server, instead of just the once. i was reading up on using publicVariables to stop this from happening. but as a noob to scripting i am struggling.

 

i thought i would try if (isServer) {...code..}; but the vehicles don't get deleted.

 

the guy on the other forum mentioned to contact Axecop?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Hi, seems like i have to fix every script myself... Lol

Anyway i need some more details, what is that you want to do in the first place?

Delete (or destroy) all vehicles near trade zones when the server starts!?

That may be simpler than what you did, but iwait for your answer first. :)

Btw it is almost 3am here so you might have to wait until tomorrow for my answer, or maybe someone else can help you.. The script is not that hard to do after all.

Link to comment
Share on other sites

  • 0

The goal is to remove vehicles within a set area (trade zone for example) on a server restart.

spot on...

 

basically i would like to know how to have this code execute only once on server restart, eg: after the vehicles have spawned and before, or after the first player logs in...and never again, until the next restart.

 

i have tried executing it server side using server_functions, (although if i recall i did manage to remove the trader zone completely using "All" but the vehicles remained!, leading me to think that was exec before the vehicles were spawed by the hive). 

i have also tried calling it from the server, in  the init.sqf from the mission file.but both options did'nt delete remove the vehicles, unless there is a way for the server to wait until the vehicles have spawned?

 

like i said the code above does the job if put into a .sqf file as is, and then placed into a mission.pbo and called from the init.sqf. but it is executed every time a player logs in!. 

Link to comment
Share on other sites

  • 0
//TiTANS Move it or loose it script V0.1 lol

waitUntil {!isNil "dayz_animalCheck"};

if (!isNil "delVehicle") exitWith {};
delVehicle = true;

private["_VehicleList"];

_VehicleList = nearestObjects [[6331.0352, 7802.3911],["AH6X_DZ","AN2_DZ","ArmoredSUV_PMC_DZE","ATV_CZ_EP1","ATV_US_EP1","C130J_US_EP1","car_hatchback","car_sedan","CH_47F_EP1_DZE","CSJ_GyroC","CSJ_GyroCover","CSJ_GyroP","datsun1_civil_1_open","datsun1_civil_2_covered","datsun1_civil_3_open","Fishing_Boat","GAZ_Vodnik_DZE","GAZ_Vodnik_MedEvac","GLT_M300_LT","GLT_M300_ST","GNT_C185","GNT_C185C","GNT_C185R","GNT_C185U","hilux1_civil_1_open","hilux1_civil_2_covered","hilux1_civil_3_open_EP1","HMMWV_Ambulance","HMMWV_Ambulance_CZ_DES_EP1","HMMWV_DES_EP1","HMMWV_DZ","HMMWV_M1035_DES_EP1","HMMWV_M1151_M2_CZ_DES_EP1_DZE","HMMWV_M998A2_SOV_DES_EP1_DZE","Ikarus","Ikarus_TK_CIV_EP1","JetSkiYanahui_Case_Blue","JetSkiYanahui_Case_Green","JetSkiYanahui_Case_Red","JetSkiYanahui_Case_Yellow","Kamaz","KamazRefuel_DZ","Lada1","Lada1_TK_CIV_EP1","Lada2","Lada2_TK_CIV_EP1","LadaLM","LandRover_CZ_EP1","LandRover_MG_TK_EP1_DZE","LandRover_Special_CZ_EP1_DZE","LandRover_TK_CIV_EP1","M1030_US_DES_EP1","MH6J_DZ","Mi17_Civilian_DZ","Mi17_DZE","MMT_Civ","MtvrRefuel_DES_EP1_DZ","MTVR_DES_EP1","MV22_DZ","Offroad_DSHKM_Gue_DZE","Old_bike_TK_INS_EP1","Old_moto_TK_Civ_EP1","PBX","Pickup_PK_GUE_DZE","Pickup_PK_INS_DZE","Pickup_PK_TK_GUE_EP1_DZE","RHIB","S1203_ambulance_EP1","S1203_TK_CIV_EP1","Skoda","SkodaBlue","SkodaGreen","SkodaRed","Smallboat_1","Smallboat_2","SUV_Blue","SUV_Camo","SUV_Charcoal","SUV_Green","SUV_Orange","SUV_Pink","SUV_Red","SUV_Silver","SUV_TK_CIV_EP1","SUV_White","SUV_Yellow","tractor","TT650_Civ","TT650_Ins","TT650_TK_CIV_EP1","UAZ_CDF","UAZ_INS","UAZ_MG_TK_EP1_DZE","UAZ_RU","UAZ_Unarmed_TK_CIV_EP1","UAZ_Unarmed_TK_EP1","UAZ_Unarmed_UN_EP1","UH1H_DZE","UH1Y_DZE","UH60M_EP1_DZE","UralRefuel_TK_EP1_DZ","Ural_CDF","Ural_TK_CIV_EP1","Ural_UN_EP1","V3S_Open_TK_CIV_EP1","V3S_Open_TK_EP1","V3S_Refuel_TK_GUE_EP1_DZ","VolhaLimo_TK_CIV_EP1","Volha_1_TK_CIV_EP1","Volha_2_TK_CIV_EP1","VWGolf","Zodiac"], 100];	
VehCount = count _VehicleList; 
i = 0;
for "i" from 0 to VehCount do 
	{ 
		v = _VehicleList select i;
		deleteVehicle v; 
	};
   
    titleText ["Deleted All Vehicles within 100 meters of Trader Zones !.","PLAIN"];titlefadeOut 5;

Think that should work i will test a little later when i get the chance.

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
  • Advertisement
  • Discord

×
×
  • Create New...