Mute Problem in Developer Help
|
|
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] 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()
|
And why are you making some sections needlessly complicated?