mob
proc
Ban(mob/M as mob in world)
switch(alert("Do you really want to ban [M]?","Ban","Ban","Quit"))
if("Ban")
if((Admins.Find(M.key)))
src<<"Cant ban admins!"
text2file("<br>[time2text(world.realtime, "Day, Month DD, YYYY \[hh:mm:ss\]")]:<font color = red><B>[src] tried to ban the admin [M]","Log.html")
world << "<font color =red><b>[src] has just banned [M]."
text2file("<br>[time2text(world.realtime, "Day, Month DD, YYYY \[hh:mm:ss\]")]:<font color = red><B>[src] bans Name [M]/ Key [M.key]/ IP [src.client.address]","Log.html")
crban_fullban(M)
del(M)
K, i used spell check to make my spelling better because smoko complained! I need it to work heres the error i get
runtime error: Cannot read null.key
proc name: Ban (/mob/proc/Ban)
source file: Game Administer.dm,65
usr: VV (/mob/Player)
src: VV (/mob/Player)
call stack:
VV (/mob/Player): Ban(null)
line 55 is if((Admins.Find(M.key))) please help me
You don't need mob/M as mob in world, just use mob/M in world. Secondly, don't use HTML documents for logs. I learned my lesson with that a while ago when I downloaded a 1MB logfile with only a handful of lines in it.
Now, on to your problem. It's easy to see that the mob/M you selected doesn't exist or wasn't defined, as dictated by this line in your runtime error:
Ban(null)
This is also something I learned about many runtimes later; perform sanity checks after any and every operation that sleeps the proc, to make sure the target is still there.
Since the switch statement sleps the proc, the target M may log out, be booted, deleted etc. in the time it takes the person using the verb to select "Ban".
Which brings up another issue... Are you trying to use this as a verb? Procs do not prompt you for an argument as verbs do, they assume that you will give them a value to work with, in this case a mob. If you meant to use this as a proc, you're going about it wrong... you need a variable supplied by the user to go through this proc.
If you don't want to do that, just change proc to verb: