ID:148211
 
Hey, I am having troubles with my Deathcheck proc. I get this error in game:

runtime error: Cannot read 0.cash
proc name: die (/mob/proc/die)
source file: combat.dm,32
usr: 0
src: ReZZa (/mob/player)
call stack:
ReZZa (/mob/player): die(GM-Oblivian (/mob/GM))
the bullet (/obj/bullet): Bump(ReZZa (/mob/player))

And heres my code:
mob
proc/die(mob/killer)
if(killer)
if(icon == 'blue.dmi')
src.fire = 1
src.tagged += 1
view() << 'neikahit.wav'
src.loc = locate(/area/nofire2)
src << "You must wait for 30 seconds before Resurrecting."
usr.cash += 8
usr.pk += 1
usr << "You gain $8 from tagging [src]!"
world << "<B>[src] was tagged by [usr]!</B>"
sleep(300)
src.loc = locate(/area/login)
src.fire = 0
src.pk -= 1
world << "<B>[src] Has Resurrected!</B>"
The error is obvious: it says it can't read 0.var, so you have to figure that any place that var is used is suspect. Then it says that usr is also 0. Given that this is more unusual than null, it's crystal clear.

The solution is not to put usr in your proc. It has no place here. Curiously you're using something that appears to be cobbled together from the correct solution and the old wrong way of doing things. The correct solution uses the mob/killer argument; the old wrong way just plain has usr as the killer. You're actually doing both: You've got usr plastered all over the proc where you should be using killer.

Lummox JR
In response to Lummox JR
Thanks, Lummox.