The deleteGroup command requires the group to be local to the machine executing it:
https://community.bistudio.com/wiki/deleteGroup
When a player changes clothes a new group is created. The player is switched into a new unit in the new group, and then his old group is left empty. Because the old group is local to the player, it will not be deleted by server_cleanupGroups until he disconnects and it is transferred to the server.
We should delete the old group immediately rather than wait for the player to disconnect. This will prevent the excessive accumulation of empty groups when players change clothes a lot. It will help with the seagull spawn issue which happens when there are more than 144 groups on side WEST:
https://community.bistudio.com/wiki/createGroup
_pos should be _charPos. Currently it causes this error in server RPT on 1.63.112555+ because it references the player object, not the player object's position:
6:36:48 Error in expression <ear"] call server_updateObject;
} count nearestObjects [_pos, dayz_updateObjects>
6:36:48 Error position: <nearestObjects [_pos, dayz_updateObjects>
6:36:48 Error 0 elements provided, 3 expected
6:36:48 File z\addons\dayz_server\compile\server_playerSync.sqf, line 209