Did you read the ComRef?
object addEventHandler handler
Operand types:
object: Object
handler: Array
Type of returned value:
Number
Compatibility:
Version 1.85 required.
Description:
Format of handler is [type,command]. Check scripting topic Event handlers for more information. Index of currently added handler is returned.
Example:
player addEventHandler ["killed",{_this exec "playerKilled.sqs"}]
I'm certain you didn't search, either, so I'll be friendly and post the answer to your next question, "What event handlers are there?"
Event handlers
Description:
Event handlers can be defined in unit config or by function addEventHandler. Multiple handlers can be attached at one time. Event handler types are defined below. Each handler receives arguments in _this, argument types and meaning are defined below.
"Killed" object:killer
"Hit" object:causedBy,scalar:howMuch
"Engine" bool:engineState
"GetIn" string:position (1),object:unit
"GetOut" string:position (1),object:unit
"Fired" string:weapon,string:muzzle,string:mode,string:ammo
"IncomingMissile" string:ammo,object:whoFired
"Dammaged" string:selectionName,scalar:howMuch
"Gear" bool:gearState
"Fuel" bool:fuelState
"Init" No arguments
(1) position can be "driver", "gunner", "commander", "cargo"
MP notes: "Killed" and "Hit" event handlers are executed where given unit is local. All other event handlers are executed on all computers. Events added by addEventHandler may be different on each computer.