Forum Jump :

Author Message


Posts: 3
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2015-11-09 03:52        
     
I am currently writing a server mod called Vehicle Death Match, Up and running on a Server: I am able to have vehicles and bodies removed after 10 seconds of being dead / blown up. I cant seem to find a script to remove vehicles after a player leaves them? Does anyone know what code i can use to do this or any scriptwriter out there that are able to help me? Many thanks!

If there is a way to just scripts something like this in the Int File or Discript file that would be best as the vehicles are randomly spawned from a file

Image is what the admin Sees.... this is only with 7 people on and 20 min of game play/


This post was edited by DarkRay (2015-11-09 03:59, 770 days ago)


Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 20
In-game name: Wak

 
#2 Posted at 2015-11-09 10:02        
     
You could spawn a loop with every vehicle you spawn:

while {alive _veh} do {
	if (count (crew _veh) < 1) then {deleteVehicle _veh};	
	sleep 5;
};

This post was edited by 654wak654 (2015-11-09 17:02, 769 days ago)

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Advertisement


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#3 Posted at 2015-11-10 02:18        
     
If you don't want to delete empty vehicles but only disconnected player's one, see also:
https://community.bistudio.com/wiki/BIS_fnc_addStackedEventHandler
and https://community.bistudio.com/wiki/onPlayerDisconnected

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 3
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#4 Posted at 2015-11-10 14:28        
     
Many thanks for this code, I will test it when i get home!,

Added 2 hours 11 minutes later:

# 654wak654 : You could spawn a loop with every vehicle you spawn:

while {alive _veh} do {
	if (count (crew _veh) < 1) then {deleteVehicle _veh};	
	sleep 5;
};

I am still quite new at this coding so sorry for my stupidity XD

I attempted to put it in my spawn vehicle SQF and no Luck. Was i supposed to put this in the Int file or Description file, I have attached my spawn vehicle Code

_plr = _this select 0
_actionid = _this select 2
_dir = getDir _plr

_tanktypes = [];
_tanktypes = _tanktypes+["B_APC_Tracked_01_rcws_F", "B_APC_Tracked_01_CRV_F", "B_APC_Tracked_01_rcws_F", "B_APC_Wheeled_01_cannon_F", "B_APC_Tracked_01_CRV_F", "O_APC_Tracked_02_cannon_F", "I_APC_Wheeled_03_cannon_F", "O_APC_Wheeled_02_rcws_F", "B_APC_Tracked_01_AA_F", "O_APC_Tracked_02_cannon_F", "O_APC_Tracked_02_AA_F", "I_APC_tracked_03_cannon_F", "I_APC_Wheeled_03_cannon_F", "B_APC_Wheeled_01_cannon_F", "O_APC_Wheeled_02_rcws_F"];
_tanktypes = _tanktypes+["B_Boat_Armed_01_minigun_F", "I_Boat_Armed_01_minigun_F", "O_Boat_Armed_01_hmg_F", "B_MRAP_01_hmg_F", "O_MRAP_02_hmg_F", "I_MRAP_03_hmg_F", "O_MRAP_02_F", "O_MRAP_02_hmg_F", "O_MRAP_02_gmg_F", "I_MRAP_03_F", "I_MRAP_03_hmg_F", "I_MRAP_03_gmg_F", "I_G_Offroad_01_armed_F", "B_G_Offroad_01_armed_F", "O_G_Offroad_01_armed_F"];
_tanktypes = _tanktypes+["B_APC_Tracked_01_rcws_F", "B_APC_Tracked_01_CRV_F", "B_APC_Tracked_01_rcws_F", "B_APC_Wheeled_01_cannon_F", "B_APC_Tracked_01_CRV_F", "O_APC_Tracked_02_cannon_F", "I_APC_Wheeled_03_cannon_F", "O_APC_Wheeled_02_rcws_F", "B_APC_Tracked_01_AA_F", "O_APC_Tracked_02_cannon_F", "O_APC_Tracked_02_AA_F", "I_APC_tracked_03_cannon_F", "I_APC_Wheeled_03_cannon_F", "B_APC_Wheeled_01_cannon_F", "O_APC_Wheeled_02_rcws_F"];
_tanktypes = _tanktypes+["B_MBT_01_cannon_F", "B_MBT_01_TUSK_F", "I_MBT_03_cannon_F", "O_MBT_02_cannon_F", "I_MBT_03_cannon_F", "B_MBT_01_cannon_F", "B_MBT_01_mlrs_F", "O_MBT_02_cannon_F", "B_MBT_01_TUSK_F"];
_tanktypes = _tanktypes+["B_Heli_Light_01_armed_F", "O_Heli_Light_02_F", "O_Heli_Light_02_v2_F", "B_Heli_Attack_01_F", "O_Heli_Attack_02_F", "O_Heli_Attack_02_black_F", "I_Heli_light_03_F"];

_planetypes = ["B_Plane_CAS_01_F", "O_Plane_CAS_02_F", "I_Plane_Fighter_03_CAS_F", "I_Plane_Fighter_03_AA_F"];

? ((vehicle _plr) != _plr): Exit

_startpos = getPos _plr;

_isplane = (random 10 > 9);
if (_isplane) then {goto "MAKEPLANE"} else {goto "MAKETANK"}

#CONT
_vehicle setDir _dir;
_vehicle lock false;
_plr moveInDriver _vehicle;
_plr removeAction _actionid;

@GetDammage _vehicle >= 0.1;
~240
deletevehicle _vehicle;

while {alive _veh} do {
    if (count (crew _veh) < 1) then {deleteVehicle _veh};    
    sleep 5;
};

exit;

#MAKEPLANE
_arraysize = count _planetypes; 
_numero = random (_arraysize-1); 
_vehicle = (_planetypes select _numero) createVehicle _startpos;
_startpos set [2, 1500];
_vehicle setPos _startpos;
goto "CONT";

#MAKETANK
_arraysize = count _tanktypes;

_numero = random (_arraysize-1);
_vehicle =  (_tanktypes select _numero) createVehicle _startpos;
goto "CONT";


Rearm.SQS
_plr = _this select 0
_plr addrating (-(rating _plr) - 100000);

removeAllWeapons _plr;

_plr addMagazine "30Rnd_65x39_caseless_green";
_plr addMagazine "30Rnd_65x39_caseless_green";
_plr addMagazine "30Rnd_65x39_caseless_green";
_plr addMagazine "30Rnd_65x39_caseless_green";
_plr addMagazine "1Rnd_HE_Grenade_shell";
_plr addMagazine "1Rnd_HE_Grenade_shell";
_plr addMagazine "1Rnd_HE_Grenade_shell";
_plr addMagazine "1Rnd_HE_Grenade_shell";
_plr addMagazine "6Rnd_45ACP_Cylinder";
_plr addMagazine "6Rnd_45ACP_Cylinder";
_plr addMagazine "6Rnd_45ACP_Cylinder";
_plr addMagazine "6Rnd_45ACP_Cylinder";
_plr addWeapon "arifle_Katiba_GL_ACO_pointer_snds_F";
_plr addWeapon "launch_Titan_short_F";
_plr addWeapon "hgun_Pistol_heavy_02_Yorris_F";

_plr addWeapon "Laserdesignator";
_plr addWeapon "NVGoggles";

~0
_actionid = _plr addAction ["<t color='#FFFF00'>Spawn vehicle</t>", "spawnvehicle.sqs"];
_actionid = _plr addAction ["<t color='#32CD32'>Spawn vehicle</t>", "spawnvehicle.sqs"];

@GetDammage _plr >= 0.8;
_plr removeAction _actionid;

This post was edited by DarkRay (2015-11-10 17:03, 768 days ago)


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#5 Posted at 2015-11-10 17:14        
     
You're writing in sqs, Wak in sqf. Syntaxes are not the same and you can't mix them. You should try sqf or write in sqs:
while {alive _veh} do {
if (count (crew _veh) < 1) then {deleteVehicle _veh}
~ 5
}
Sleep is ~ in sqs.
Not sure for ";" but it seems you don't need that in sqs. See:
https://community.bistudio.com/wiki/SQS_syntax
https://community.bistudio.com/wiki/SQF_syntax

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 20
In-game name: Wak

 
#6 Posted at 2015-11-10 17:30        
     
Sqs is an old, dead syntax. It's not meant to be side by side (or anywhere near) sqf code of Arma 3. Since you're still new you can switch to sqf without sqs corrupting your brain.

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Author Message


Posts: 3
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#7 Posted at 2015-11-10 23:50        
     
Many thanks! I will look into it