{"name":"removeEventHandler","operator":null,"title":"removeEventHandler","type":"command","url":"https://community.bistudio.com/wiki/removeEventHandler","revid":369196,"updated":"2024-09-03T10:34:47Z","groups":["Event Handlers"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.85"},{"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":"ofp","name":"Operation Flashpoint","version":"1.85"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Removes a given Event Handler that was added with addEventHandler.","syntaxes":[{"syntax":"target removeEventHandler [type, index]","since":null,"effect":null,"exec":null,"params":[{"name":"target","type":"Object or Arma 3 v2.10 Group","optional":false,"default":null,"description":null,"types":["Object","Group"],"since":null,"text":"target: Object or Arma 3 v2.10 Group"},{"name":"type","type":"String","optional":false,"default":null,"description":"see Event Handlers for the full list of available options","types":["String"],"since":null,"text":"type: String - see Event Handlers for the full list of available options"},{"name":"index","type":"Number","optional":false,"default":null,"description":"the value originally returned by addEventHandler","types":["Number"],"since":null,"text":"index: Number - the value originally returned by addEventHandler"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"target","types":["Object","Group"]},"right":{"text":"[type, index]","types":["Array"]}}],"examples":[{"text":"```sqf\nplayer removeEventHandler [\"Killed\", 0];\n```","code":["player removeEventHandler [\"Killed\", 0];"]},{"text":"The Magic Variables `_thisEvent` and `_thisEventHandler` can be used to easily remove an Event Handler:\n\n```sqf\nplayer addEventHandler [\"FiredNear\", {\n    systemChat \"This Event Handler is now removing itself!\";\n    player removeEventHandler [_thisEvent, _thisEventHandler];\n}];\n```","code":["player addEventHandler [\"FiredNear\", {\n\tsystemChat \"This Event Handler is now removing itself!\";\n\tplayer removeEventHandler [_thisEvent, _thisEventHandler];\n}];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["addEventHandler","removeAllEventHandlers","removeMPEventHandler","removeMissionEventHandler"],"notes":[],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Event Handlers","Introduced with Operation Flashpoint version 1.85","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}