ID:139177
 
Code:
mob
icon = 'mob.dmi'

var
HP = 100
MaxHP = 100
EXP = 0
MaxEXP = 1000
str = 5
MP = 10
Level = 1

verb
Weak_Attack(mob/M as mob in get_step(src,usr.dir))
set category="Skills"
F_damage(usr, rand(1,2), "#ff0000")
flick(pick("1","3","2"),usr)
M:DeathCheck()
usr:LevelUp()
sleep(10)
..()
Medium_Attack(mob/M as mob in get_step(src,usr.dir))
set category="Skills"
F_damage(usr, rand(5,6), "#ff0000")
flick(pick("5","6","7"),usr)
M:DeathCheck()
usr:LevelUp()
sleep(50)
..()
Strong_Attack(mob/M as mob in get_step(src,usr.dir))
set category="Skills"
F_damage(usr, rand(10,20), "#ff0000")
flick(pick("72 Pound","10","NewGorillaCross"),usr)
M:DeathCheck()
usr:LevelUp()
sleep(100)
..()

proc
DeathCheck()
if(src.HP <=0)
src.loc = locate(1,1,1)
src << "You have respawned."

LevelUp()
if(usr.EXP==usr.MaxEXP)
usr.EXP=0
usr.MaxEXP+=rand(5,7)
usr.str+=rand(5,10)
usr.Level+=1
usr.MaxHP += rand(10,15)
usr << "You have leveled up!"


Problem description:

Well as you can see i put a cooldown but if i macro the these attacks and just let my finger on top of the button, it will spam like theres no tomorrow >_> how do i fix this?

well you can try code like this
mob
verb
Weak_Attack(mob/M as mob in get_step(src,usr.dir))
set category="Skills"
if(usr.Attacking) return

F_damage(usr, rand(1,2), "#ff0000")
flick(pick("1","3","2"),usr)
M:DeathCheck()
usr:LevelUp()
usr.Attacking=1
spawn(4) if(usr) usr.Attacking=0
..()
In response to Hassanjalil
Hassanjalil please, stop trying to help people, and learn how to program yourself before you go about helping others. When helping someone with a post you should solve the desired question (Which you did, but your example was incorrect) , and upon noticing other errors point out all of the problems with his code that could potentially be a problem in the future, but seeing the snippet you added into it, I can tell you're not to that level yet yourself.

Cowgraft, As Hassan has pointed out you will need a temporary variable.
For example:
mob/var/tmp/attacking
mob/verb/attack()
if(attacking) return
//... continue


But you have many other flaws in your coding aswell, such as usr abuse, colon abuse.

Also, Look up the .. proc in the reference.

mob
var/tmp/attacking=0
verb
Weak_Attack(mob/M as mob in get_step(src,dir))
set category="Skills"
if(attacking) return
attacking=1
F_damage(src, rand(1,2), "#ff0000")//Displays the number of rand(1,2). I noticed you don't take any health away from the mob being attacked. So this would be purely visual. Would this (in comments below, perhaps be what you were trying?
/*
var/a=rand(1,2)
M.HP-a
F_damage(M,a,"#ff0000")//Display it over the one who got hit.
*/

flick(pick("1","3","2"),src)
M.DeathCheck()
LevelUp()
sleep(10)//Assuming you want a 1 second delay
attacking=0
In response to Leur
Thanks man really helped a lot Leur, crowgraft13 is my other account