ID:263200
 
Code:
mob
verb
throw(mob/M in oview(1))
set category = "Training"
set src in oview(1) // beside
set name = "throw"
// if(usr.jailed)
// alert("You cannot use this while in Jail. Behave!","Behave!")
// return
// if(!usr.lt){usr<<"<font color=red><B>Error:</b><font color=white> You don't know the skill <u>Throw</u> yet.";return}
if(usr.doing){usr<<"<font color=red><B>Error:</b><font color=white> You are doing something else at the time.";return}
// if(usr.dead)
// usr<<"<font size=1><font color=red><B>Error:</b> <font color=white>You cannot attack while being dead."
// return
// if(usr.healing)
// usr<<"<font size=1><font color=red><B>Error:</b> <font color=white>You cannot attack while being healing."
// return
// if(usr.travelling)
// usr<<"<font size=1><font color=red><B>Error:</b> <font color=white>You cannot attack while travelling."
// return
var/mob/a=locate(/mob) in get_step(usr,usr.dir)
/*for(var/mob/M in oview(1))
if(usr.dir==NORTH&&M.y==usr.y+1&&M.x==usr.x)a=M
else if(usr.dir==SOUTH&&M.y==usr.y-1&&M.x==usr.x)a=M
else if(usr.dir==WEST&&M.x==usr.x-1&&M.y==usr.y)a=M
else if(usr.dir==EAST&&M.x==usr.x+1&&M.y==usr.y)a=M*/

if(istype(usr,/mob/player))
if(istype(a,/mob/enemy)||istype(a,/mob/enemy))
if(a.blockin)
usr<<"<font color=green><Font size=1>[a] has blocked your throw!"
return
if(a.Dead)
usr<<"<font size=1><font color=red><B>Error:</b> <font color=white>You cannot attack <font color=red>[a]<font color=white> while <font color=red>[a]<font color=white> is dead."
return
// if(a.travelling)
// usr<<"<font size=1><font color=red><B>Error:</b> <font color=white>You cannot attack <font color=red>[a]<font color=white> while <font color=red>[a]<font color=white> is travelling."
// return
// if(a.healing)
// usr<<"<font size=1><font color=red><B>Error:</b> <font color=white>You cannot attack <font color=red>[a]<font color=white> while <font color=red>[a]<font color=white> is healing."
// return
// a.Frozen=1
flick("rokujuu",usr)
var b=0
var c=0
if(usr.dir==NORTH)
for(var/turf/T in oview(3))
sleep(-1)
if(istype(T,/turf/NO_monster)&&istype(a,/mob/enemy)&&a.y==T.y-1&&T.x==a.x)c=1
else if(a.y==T.y-1&&T.x==a.x&&T.density==1)b=1
if(b||c)view(3)<<sound('hitbag.wav',channel=0)
else
a.y+=1
view(3)<<sound('hitbag.wav',channel=0)
if(usr.dir==SOUTH)
for(var/turf/T in oview(3))
sleep(-1)
if(istype(T,/turf/NO_monster)&&istype(a,/mob/enemy)&&a.y==T.y+1&&T.x==a.x)c=1
else if(a.y==T.y+1&&T.x==a.x&&T.density==1)b=1
if(b||c)view(3)<<sound('hitbag.wav',channel=0)
else
a.y-=1
view(3)<<sound('hitbag.wav',channel=0)
if(usr.dir==EAST)
for(var/turf/T in oview(3))
sleep(-1)
if(istype(T,/turf/NO_monster)&&istype(a,/mob/enemy)&&a.x==T.x-1&&T.y==a.y)c=1
else if(a.x==T.x-1&&T.y==a.y&&T.density==1)b=1
if(b||c)view(3)<<sound('hitbag.wav',channel=0)
else
a.x+=1
view(3)<<sound('hitbag.wav',channel=0)
if(usr.dir==WEST)
for(var/turf/T in oview(3))
sleep(-1)
if(istype(T,/turf/NO_monster)&&istype(a,/mob/enemy)&&a.x==T.x+1&&T.y==a.y)c=1
else if(a.x==T.x+1&&T.y==a.y&&T.density==1)b=1
if(b||c)
view(3)<<sound('hitbag.wav',channel=0)
else
a.x-=1
view(3)<<sound('hitbag.wav',channel=0)
else
usr<<sound('beep.wav',channel=0)
alert("You cannot throw [a]!","Error")
sleep(4)
a.Frozen=0
a.doing=0


Problem description:- Well this is spose to throw npcs and players back, but its not working properly can some see wehere the problem is ,ty.

1. All of those <code>if</code> statements are not needed. Look up <code>get_dir()</code>
2. Boolean variables!
// When checking TRUE/FALSE values

if(var==1) // Wrong!
if(var) // Right!

if(var==0) // Wrong!
if(!var) // Right!

3. You need to check wether there is an 'a'. What if you're targetting thin air? :/
4. WHAT's not working properly?