{"name":"deleteGroup","operator":null,"title":"deleteGroup","type":"command","url":"https://community.bistudio.com/wiki/deleteGroup","revid":330309,"updated":"2022-08-30T23:40:39Z","groups":["Groups"],"status":"ok","replaced_by":[],"games":[{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"local","effect":"global","server_exec":false},"exec":null,"description":"Destroys the given group - the group must be empty and local to the machine executing this command.\n\n> [!NOTE]\n> In Arma 3 you can find out locality of the group with local command, unlike with previous games. However owner and setOwner don't work with groups anywhere. The group will always be local to the client that created it, until the client disconnects, then the group becomes local to the server. So if you need to delete a group, delete all members first then execute deleteGroup where is it local.\n\n> [!NOTE]\n> **Arma 3:** In Arma 3 when the last unit leaves a group, the group gets automatically deleted. Manually deleting all units from a group, however, does **not** automatically delete the empty group. To force the group to get auto-deleted when empty, use deleteGroupWhenEmpty.","syntaxes":[{"syntax":"deleteGroup group","since":null,"effect":null,"exec":null,"params":[{"name":"group","type":"Group","optional":false,"default":null,"description":null,"types":["Group"],"since":null,"text":"group: Group"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"unary","operator":null,"left":null,"right":{"text":"group","types":["Group"]}}],"examples":[{"text":"```sqf\ndeleteGroup _group;\n```","code":["deleteGroup _group;"]},{"text":"```sqf\n[_group] remoteExec [\"deleteGroup\", groupOwner _group]; // server only\n```","code":["[_group] remoteExec [\"deleteGroup\", groupOwner _group]; // server only"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["deleteGroupWhenEmpty","isGroupDeletedWhenEmpty","createGroup","units","group","groupFromNetId"],"notes":[{"user":"ColonelSandersLite","date":"2006-12-17T00:34:00Z","text":"The deleteGroup Command does not work when there are living members of in the group.  It doesn't error, it simply doesn't do anything."},{"user":"5133p39","date":"2007-07-10T07:50:00Z","text":"Living or not doesn't matter - you can't delete the group while it contains any units - even dead ones. It takes few seconds until a dead unit is automatically removed from its group."},{"user":"LongEnoughName","date":"2013-09-12T03:54:00Z","text":"deleteGroup will only delete local groups even if called by server.\nSay we have a situation where client creates a group and puts a unit there and later unit dies/gets deleted, server will not be able to delete that empty group until client leaves the game and group ownership switches to server."}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Groups","Introduced with Operation Flashpoint: Elite version 1.00","Operation Flashpoint: Elite: New Scripting Commands","Operation Flashpoint: Elite: Scripting Commands","Scripting Commands","Scripting Commands: Global Effect","Take On Helicopters: Scripting Commands"]}