ID:158572
 
Ok, i have my mute and unmute verb here.

var/list/mutes = list()
Mute()
set category = "Admin"
var/list/players = list()
for(var/mob/M in world)
if(M.client)
players += M
var/mob/M = input("Who do you want to Mute?","Mute")as null|anything in players
if(!M) return
var/Reason = input("Why are you muting [M]?","Reason")as text|null
Time:
var/Time = input("How long do you wish to Mute [M]?\n- Leave blank to Cancel the Mute","Time (In Minutes)")as num
if(!Time) return
if(Time > 480)
alert(usr,"Max Time is 480 minutes","Max Time")
goto Time
if(!M.muted || !M.mutetime)
var/list/KeyList[0]
for(var/m in mutes)
var/list/entry = params_2_list(m)
KeyList += entry[2]
if(KeyList.Find(M.key))
mutes += M
Admin_Alert("<font color=yellow>[m] was muted succesfully")
M.muted = 1
M.mutereason = "[Reason]: Muted by [usr.key]; Original Time: [Time] Minutes"
M.mutetime = Time
M.Mute_Timer()
mutes += "[M] ([M.key]) Reason: [Reason] Original Time: [Time]"
world<<"<font color=green>Announcement: </font color>[M] has been muted by [src] for [Time] minutes for [Reason]"
Unmute()
set category = "Admin"
var/list/players = list()
for(var/mob/M in world)
if(M.muted)
players += M
var/mob/M = input("Who would you like to Unmute?","Unmute")as null|anything in players
if(!M) return
if(M.muted || M.mutetime)
var/list/KeyList[0]
for(var/m in mutes)
var/list/entry=params_2_list(m)
KeyList += entry[2]// line #124
if(KeyList.Find(M.key))
mutes -= m
Admin_Alert("<font color=yellow>[m] was removed succesfully")
M.muted = 0
M.mutetime = 0
M.mutereason = null
world<<"<font color=green>Announcement: </font color>[M] has been Unmuted by [src]"

Now everything mutes fine, no runtime errors. But when i unmute i get this.
runtime error: list index out of bounds
proc name: Unmute (/mob/APP/verb/Unmute)
source file: Admin.dm,124
usr: Zane (/mob/player)
src: Zane (/mob/player)
call stack:
Zane (/mob/player): Unmute()
First, why are you using goto? Second, what's with all these redundant lines like "if(!M) return" when you have it to be null|anything?

And why are you making some sections needlessly complicated?
In response to Vic Rattlehead (#1)
Vic Rattlehead wrote:
First, why are you using goto? Second, what's with all these redundant lines like "if(!M) return" when you have it to be null|anything?

And why are you making some sections needlessly complicated?

While the advice on appropriate programming methods is nice, you should probably not answer questions that were never asked until the initial issue is solved.

OP:
We'll need to know what line EXACTLY that is directed at. You can find this out by clicking 'Edit' at the top of dream maker and typing in the relevant line (124 in this case, in the Admin.dm file)

The reason for the error is pretty self explanatory. 'Index out of bounds' means you're trying to access a location in a list (called an index) that doesn't exist.