View Single Post
04/21/14, 08:46 AM   #3
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by BadVolt View Post
Elso you have wrong params list in function OnKill. Event EVENT_UNIT_DEATH_STATE_CHANGED have 2 args: unitTag,isDead. So, you have to work with them.
Lua Code:
  1. function OnKill(unitTag, isDead)
  2.    If unitTag==GetUnitName("player") and isDead then
  3.    ...
  4.    end
  5. end
If nothing works, you can check EVENT_PLAYER_DEAD param. It can have some args, so may be interested to check them.. but to info on WIKI about it.
In this case is wiki wrong, all events has "eventCode" as a first argument, so mikethecoder4's OnKill() function was correct.