• taunt only for ulx group?
    3 replies, posted
I'm trying to make it so only specific usergroups can use a taunt command. This command works for all players [code]addTaunt("scream", "vo/npc/male01/runforyourlife01.wav", "male")[/code] I tried restricting it to only my "mod" group by doing this, but the sound still plays for all players, instead of only for mods. [code]if ply:IsUserGroup("mod") then addTaunt("scream", "vo/npc/male01/runforyourlife01.wav", "male") end[/code] What am I doing wrong?
Do you want mods to be the only ones who can hear and use it, or just use it?
The first code every player can use it, and hear it. I'd like for just mods to use it, but everyone to hear it. Basically I'd like to set up Admin only taunts, mod only taunts, etc; that everyone can hear, but only those user groups can use. The first script in my OP is a table that the taunts come from, so I'd like to restrict access to specific user groups in that table.
How could I for example, restrict the entire "scream" table for only mods/admins to use? This is the entire working code from the murder gamemode. [code]local taunts = {} function addTaunt(cat, soundFile, sex) if !taunts[cat] then taunts[cat] = {} end if !taunts[cat][sex] then taunts[cat][sex] = {} end local t = {} t.sound = soundFile t.sex = sex t.category = cat table.insert(taunts[cat][sex], t) end // male addTaunt("help", "vo/npc/male01/help01.wav", "male") addTaunt("scream", "vo/npc/male01/runforyourlife01.wav", "male") addTaunt("scream", "vo/npc/male01/runforyourlife02.wav", "male") addTaunt("scream", "vo/npc/male01/runforyourlife03.wav", "male") addTaunt("scream", "vo/npc/male01/watchout.wav", "male") addTaunt("scream", "vo/npc/male01/gethellout.wav", "male") addTaunt("morose", "vo/npc/female01/question31.wav", "male") addTaunt("morose", "vo/npc/male01/question30.wav", "male") addTaunt("morose", "vo/npc/male01/question20.wav", "male") addTaunt("morose", "vo/npc/male01/question25.wav", "male") addTaunt("morose", "vo/npc/male01/question15.wav", "male") addTaunt("funny", "vo/npc/male01/doingsomething.wav", "male") addTaunt("funny", "vo/npc/male01/busy02.wav", "male") addTaunt("funny", "vo/npc/male01/gordead_ques07.wav", "male") addTaunt("funny", "vo/npc/male01/notthemanithought01.wav", "male") addTaunt("funny", "vo/npc/male01/notthemanithought02.wav", "male") addTaunt("funny", "vo/npc/male01/question06.wav", "male") addTaunt("funny", "vo/npc/male01/question09.wav", "male") // female addTaunt("help", "vo/npc/female01/help01.wav", "female") addTaunt("scream", "vo/npc/female01/runforyourlife01.wav", "female") addTaunt("scream", "vo/npc/female01/runforyourlife02.wav", "female") addTaunt("scream", "vo/npc/female01/watchout.wav", "female") addTaunt("scream", "vo/npc/female01/gethellout.wav", "female") addTaunt("morose", "vo/npc/female01/question30.wav", "female") addTaunt("morose", "vo/npc/female01/question25.wav", "female") addTaunt("morose", "vo/npc/female01/question20.wav", "female") addTaunt("morose", "vo/npc/female01/question15.wav", "female") addTaunt("funny", "vo/npc/female01/doingsomething.wav", "female") addTaunt("funny", "vo/npc/female01/busy02.wav", "female") addTaunt("funny", "vo/npc/female01/gordead_ques07.wav", "female") addTaunt("funny", "vo/npc/female01/notthemanithought01.wav", "female") addTaunt("funny", "vo/npc/female01/notthemanithought02.wav", "female") addTaunt("funny", "vo/npc/female01/question06.wav", "female") addTaunt("funny", "vo/npc/female01/question09.wav", "female") concommand.Add("mu_taunt", function (ply, com, args, full) if ply.LastTaunt && ply.LastTaunt + 1 > CurTime() then return end if !ply:Alive() then return end if ply:Team() != 2 then return end if #args < 1 then return end local cat = args[1]:lower() if !taunts[cat] then return end local sex = string.lower(ply.ModelSex or "male") if !taunts[cat][sex] then return end local taunt = table.Random(taunts[cat][sex]) ply:EmitSound(taunt.sound) ply.LastTaunt = CurTime() end)[/code] I've gotten so far as to restrict ALL taunts to only mod by changing this [code] if ply:IsUserGroup( "mod" ) then local taunt = table.Random(taunts[cat][sex]) ply:EmitSound(taunt.sound) else ply:SendLua([[chat.AddText(Color(0,0,200), "This Taunt is for mods only.")]]) return false end[/code] but I'd just like to restrict some specific tables like scream and funny only if possible.
Sorry, you need to Log In to post a reply to this thread.