ID:148131
 
I have a delete code that doesn't work


Destory(atom/M as mob|obj|turf in world)

Destroy(mob/M as mob|obj|turf)
set category = "GM"
set name = "Destroy"
set desc="(target) Destroy a mobile, object, or turf"
if(M.key)
usr << "You can't destroy Player Corpses. Use ban instead."
return
del(M)



Well it brings up lots of errors. Inconisitint indentation. Could someone tell me a delete code that works please?


~Pat~
mob
GM
verb
Destroy(mob/M as mob|obj|turf in world)
set category = "GM"
set name = "Destroy"
set desc="(target) Destroy a mobile, object, or turf"
if(M.key)
usr << "Can't delete players, use ban instead."
return
if(!M.key)
del M

That should work.

Airjoe
In response to Airjoe
No it won't.
mob
GM
verb
Destroy(mob/M as mob|obj|turf in world)
set category = "GM"
set name = "Destroy"
set desc="(target) Destroy a mobile, object, or turf"
if(ismob(M)) if(M.key)
usr << "Can't delete players, use ban instead."
return
del M
In response to Garthor
Dang. So close! Thanks for correcting me Garthor (never thought I'd say that =P)

Airjoe
In response to Garthor
Garthor wrote:
No it won't.

Yes, actually, it would. He would just get some runtime errors when he deletes anything but a mob.

~>Volte

In response to Airjoe
Well the code doesn't work sry to say. Inconsistent indentation still. I tried working with the tabs but it wont work.
In response to SSJGohan29
I make my code anti copy-paste. You should look at the code, and type it. That way you get used to coding. I made that code on the forum. You should be able to follow the indentations there.

Airjoe

note: I don't purposely(spelling?) make it copy-paste proof. I just make the code in the forums. When in the forums, if you hit tab, it goes onto the "post" button instead of indenting.

Note2: Mods, if you think I should stop doing this, I will. I think I remember an old post from a mod saying that people posting harmful or incorrect code should really stop, and would be punished after ___times.
In response to Airjoe
Airjoe wrote:
Note2: Mods, if you think I should stop doing this, I will. I think I remember an old post from a mod saying that people posting harmful or incorrect code should really stop, and would be punished after ___times.

I think that was only for deliberately harmful code.
In response to Crispy
ok ill try again thanx
In response to SSJGohan29
That code deletes a mob not a obj and turf
In response to Garthor
Destroy(atom/M as mob|obj|turf in world)

=)
mob/verb/Destroy(atom/A in view())
// if(A:Owner == usr) this is used to check the owner of the atom
if(istype(A,/mob/Man))
return
else
del(A)
In response to Crashed
this is a gm verb right? you do realize that any player that joins your game will have it dont you? just because its set in the category gm doesnt mean that only gms will have it. what you need to do is set your gms.

mob/Login()
if(src.key=="Siefer")
///then you need to give your gms the gm verbs.
src.verbs+=typesof(/mob/GM/verb)
///then make your verbs like this.

admin/verb
Destroy()
If you already knew all of that sorry to waste your time.
In response to Crispy
Buzz! Wrong answer! That would cause errors, but thanks for playing!
In response to Garthor
Thanks guys i got it now. had to change mob/M as mob to obj/O as obj
In response to SSJGohan29
mob/Login()
..()
usr.verbs-=/mob/verb/delete
if(usr.key=="blabla")usr.verbs+=/mob/verb/delete

mob/verb/delete(a as anything in oview())
if(a.client)goto end
del(a)
end
In response to The mothball
usr should not be used in Login() like that. src is what should be used.
In response to Garthor
my code would cause errors? why? it doesnt on my gm code. if you are refering to the part where it says
Destroy()
i was representing that on his delete verb it would really be
Destroy()
//your delete code goes here
In response to The mothball
The mothball wrote:
> mob/Login()
> ..()
> usr.verbs-=/mob/verb/delete
> if(usr.key=="blabla")usr.verbs+=/mob/verb/delete
>
> mob/verb/delete(a as anything in oview())
> <B>if(a.client)goto end</B>
> del(a)
> end

If you deleted anything that wasnt a mob, it would give you runtime errors.