ID:1136762
 
(See the best response by Magicsofa.)
Code:
proc/automute()//Automutes the player, if spamming say or afk and such.
usr.spam+=1
spawn(4)
usr.spam-=1
if(usr.spam<=-1)
usr.spam=0
if(usr.spam>=2)
world<<output("[usr.GetTime()]<font color=blue>Server: <font color=grey>[usr.name] has been automuted.","[s]")
usr.muteid=usr.name
Mute+=usr.key
spawn(600)
if(usr.key in Mute)
Mute-=usr.key
world<<output("[usr.GetTime()]<font color=blue>Server: <font color=grey>[usr.muteid] has been un-automuted.","[s]")
usr.spam=0
return
else
return
mob/var/spam//Goes with the proc, so it ended up in here.
mob/var/muteid


Problem description:

When they log out, it will not take off their key from the list when their time is up! I know what the problem is... But, I don't know how to make it where the player logs and it will take their key off. Obviousily the proc doesn't work, what are ways I could connect this only with that player, so it knows who's key needs to be taking off?
No usr in proc ugh.

Remove the users key from the Mute list at Logout() or client/Del()
Well, I've been told you are allowed to use user in procs (Just don't use usr with anything mob related. That's when you use src). I've found the problem. Also, at Logout, they could just relog and unmute themselves, which I don't want.

It's fixed, thank you anyways!
But, I don't know how to make it where the player logs and it will take their key off

Also, at Logout, they could just relog and unmute themselves

You contradicted yourself.
-facepalm- I was clearly talking about automute taking their key off when they log out after their time was up. It's fix anyways, so yeah!
In response to Hintake
Hintake wrote:
Well, I've been told you are allowed to use user in procs (Just don't use usr with anything mob related. That's when you use src).

You are allowed to, but most of the time it is a bad idea - it often results in unintended behavior. There are certain cases where it makes sense to have usr in a proc, but you have to make sure you know exactly what the value of usr will be. It is a bit confusing, which is why basically everyone here has to read this article when first learning DM
It works perfectly fine of how I am using it now. (Since I tested it with 2 players instead of 1). Thank you for that link, I'll take a look at it.
Also it's impossible for me to use src in this case anyways!
In response to Hintake
Hintake wrote:
It works perfectly fine of how I am using it now. (Since I tested it with 2 players instead of 1). Thank you for that link, I'll take a look at it.

It works, so it must be right!

Hintake wrote:
Also it's impossible for me to use src in this case anyways!

You'll either want to make the automute() procedure a mob procedure in order to use it on mobs, or make it accept a mob as an argument and use the argument to carry out the procedure.
Personally i just set the mob to a var in global procs or use for(var/mob/mobpath/M) to differentiate.
Best response
It's not impossible:

mob/proc/automute()//Automutes the player, if spamming say or afk and such.
spam+=1
spawn(4)
spam-=1
if(spam<=-1)
spam=0
if(spam>=2)
world<<output("[GetTime()]<font color=blue>Server: <font color=grey>[name] has been automuted.","[s]")
muteid=name
Mute+=key
spawn(600)
if(key in Mute)
Mute-=key
world<<output("[GetTime()]<font color=blue>Server: <font color=grey>[muteid] has been un-automuted.","[s]")
spam=0
return
else
return


You have a global procedure, but if you define the proc under the player's mob type (which I assumed is just /mob) then the proc "belongs" to that mob and you can use src just fine. I like to make things as short as I can for easy reading so I don't even write src.spam, but that is just preference.
@Lord, I'm not an inexprience coder, but thank you anyways!

Also, thank you all.