ID:262323
 
Code:
area
Arena1
var
max_capacity=2
arena_name= "PvP Arena"

Enter(mob/M)
var/current_capacity=0
var mob/X
if(istype(M,/mob) && M.client)
for(X as mob in contents)
if(X.client)
current_capacity++
if(current_capacity < max_capacity)
contents<<"[M] has entered the PvP Arena. [current_capacity + 1] of [max_capacity] are currently in this arena."
M<<"You have entered the PvP Arena. [current_capacity + 1] of [max_capacity] are currently in this arena."
M<<"You have left the safe area."
if(M:move_rate <=0)
M:move_rate+=1
M:safe=0
return
else
M<<"This Arena is currently full. [current_capacity] of [max_capacity] players."
return 0
else
return 1

Exited(mob/M)
var/current_capacity=0
var mob/X
if(istype(M,/mob) && M.client)
for(X as mob in contents)
if(X.client)
current_capacity++
contents<<"[M] has left the [arena_name] Arena."
if(usr.hp < 0)
world<<"[M] has died in the [arena_name] Arena!"
M<<"You have entered a safe area."
M:safe=1
del M:enemy_marker
M:enemy=null
if(move_rate > 0)
M:move_rate -= 1
//M<<"You no longer have a target."
return 1
mob
var/tmp
move_rate=1


Problem description:okay, when i compile, it says area.dm:42:error:move_rate:undefined var
area.dm:29:current_capacity :warning: variable defined but not used and i defined them both.. i dont know whats happening, plz some1 help

The first thing you need to do is stop using the : operator, which is bad news unless you absolutely positively know how to use it well. (In this case there's absolutely no reason to use it, since M has already been defined as a mob.) The second thing is to change "var mob/X" to "var/mob/X". The third thing is to get rid of the "as mob" in the for(X in src) loop, which is useless.

The very last things to fix are the bugs that currently appear while compiling. First, you must realize that move_rate alone won't work because it's the same as src.move_rate and src is an area, not a mob. Second, you must look again at your definition of the area and notice that you did not, in fact, define a var called current_capacity.

Lummox JR