ID:141768
 
Code:
mob
icon = 'person.dmi'
icon_state = "male"
verb
attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
usr << "You attack [M]!" //send this message to the usr
oview() << "[usr] attacks [M]!" //send this message to everybody else
var/damage = rand(1,10) //assign a random # to a new variable
world << "[damage] damage!" //tell the damage to the world
M.HP -= damage //take away the damage from M

Say(msg as text)
view() << "[usr] says: [msg]"

verb
OOC(msg as text)
world << "[usr] OOC: [msg]"

verb
Emote(msg as text)
world << "*[usr] [msg]*"

verb
Whisper(msg as text)
oview(3) << "[usr] whispers: ]msg]"

turf
Grass
icon = 'turfs.dmi'
icon_state = "grass"

Water
icon = 'turfs.dmi'
icon_state = "water"
density = 1

Path
icon = 'turfs.dmi'
icon_state = "Path"

Wall
icon = 'turfs.dmi'
icon_state = "wall"
density = 1

mob
icon = 'person.dmi' //makes it so all mobs will be created with the person icon
proc
Login()
icon_state = gender //when a player logs in, make their icon's state
..() //the gender of their key. Then call the parent!

verb
say(msg as text) //What the usr says is passed into "msg" as text
world << "[usr]: [msg]" //The world sees chatroom-like output

var
HP = 30 //declares a new variable called HP, with a value of 30


Problem description:

plz help my error is

error:M.HP:undefined var
        attack(var/mob/M in oview(1))

You need to use var/mob/M instead of mob/M
And i don't think you need the "as mob" part either.
In response to Lcooper
it didnt help
The variable "HP" is defined under turfs. It should be under mobs, since that is what has "HP".
In response to Russelisthebestever2
Russelisthebestever2 wrote:
it didnt help
mob
icon = 'person.dmi' //makes it so all mobs will be created with the person icon
proc
Login()
icon_state = gender //when a player logs in, make their icon's state
..()