ID:262873
 
Code:
mob
proc
Shoot()
if(shooot==1)
return
else
if(usr.Team=="Eliet")
if(usr.sb==1)
//var/obj/sb360/S
var/obj/S = new/obj/sb360
for(var/mob/Axtream/M in oview(usr))
if(istype(M))
new /obj/sb360
missile(/obj/sb360, usr, M)
usr.dir=get_dir(usr,M)
//usr.dir=S.dir
walk_towards(S, M)
Target(M)
//usr<<"You hit [M]."
M.Health-=30
if(M.Health <=0)
Aalive-=1
world<<"<font color = blue><font size = 1><center>[usr] shoot [M]'s head off.</center>"
M<<browse("<font color = green>[usr] Health: [usr.Health]")
usr.Kills+=1
EKills+=1
ADeaths+=1
M.Deaths+=1
usr.Money+=500
M.Money+=250
M<<"You have to wait until rounds over until you can join!"
M.loc=locate(0,0,0)
CheckRound()
usr.shooot=1
sleep(30)
usr.shooot=0
return 1


Problem description:

I made a shooting code so when you shoot the bullet goes to the mob. It works if I have non-players characters but when regular players play the gun will not shoot at all.

->Calus CoRPS<-
usr abuse
Boolean vars
And it's spelled "Elite".
In response to Mysame
I am not trying to spell Elite, it is Eliet. It is something diffrent in my game.

->Calus CoRPS<-
Calus CoRPS wrote:
Code:
> mob
> proc
> Shoot()
> if(shooot==1)
> return
> else
> if(usr.Team=="Eliet")
> if(usr.sb==1)
> //var/obj/sb360/S
> var/obj/S = new/obj/sb360
> for(var/mob/Axtream/M in oview(usr))
> if(istype(M))
> new /obj/sb360
> missile(/obj/sb360, usr, M)
> usr.dir=get_dir(usr,M)
> //usr.dir=S.dir
> walk_towards(S, M)
> Target(M)
> //usr<<"You hit [M]."
> M.Health-=30
> if(M.Health <=0)
> Aalive-=1
> world<<"<font color = blue><font size = 1><center>[usr] shoot [M]'s head off.</center>"
> M<<browse("<font color = green>[usr] Health: [usr.Health]")
> usr.Kills+=1
> EKills+=1
> ADeaths+=1
> M.Deaths+=1
> usr.Money+=500
> M.Money+=250
> M<<"You have to wait until rounds over until you can join!"
> M.loc=locate(0,0,0)
> CheckRound()
> usr.shooot=1
> sleep(30)
> usr.shooot=0
> return 1
>

Problem description:

I made a shooting code so when you shoot the bullet goes to the mob. It works if I have non-players characters but when regular players play the gun will not shoot at all.

->Calus CoRPS<-

It has been a day so now I can bump.

->Calus CoRPS<-
In response to Calus CoRPS
While Mysame may have been incorrect about the spelling error, he was right about the rest.

You've got massive usr abuse in that proc, you need to correct it.

Also, boolean var checks, (where you're looking for either 0/1) such as this one:
if(shooot==1)    //This is how you did it

if(shooot) //This does the same thing, \
and if you're looking for 0 instead of 1, do this:

if(!shooot)


It's shorter, and just as efficient. But try correcting that usr abuse. It's hard to track down a bug when you're harboring so much troublesome code.

If you're curious as to why usr is bad practice in a proc, the usr lecture will help.
In response to Detnom
The player isnt a /mob/Axtream, so it doesnt target the player.