if(src.HP <= 0)
src.loc = locate(32,31,6)
src << "You were killed by [killedby], and you are now a ghost.You will be a ghost for 5 minutes, then wake up in the hospital wing."
killedby << "You killed [src]!"
killedby.XP += src.lvl + 10
src.XP -= 2
src.HP = src.MaxHP
This is under construction, so don't worry about the user not being a ghost. The problem is that it says killedby.XP is not defined, but there is a var called killedby and there is a var called XP.