- Initiateur de la discussion
BCZ Gaming
Psychopathe
- Messages
- 1 301
- Score réaction
- 129
- Points
- 275
Bonjours, je souhaite créer un hl2Rp.
J'ai donc fait un fichier comme sa:
Je voudrais que quand on marque par exemple citoyen sa lance sa: sounds[ "citoyen" ] = { "npc/metropolice/vo/citizen.wav" }
Merci d'avance!
J'ai donc fait un fichier comme sa:
Code:
-- Scripted by puregaming
-- This module will make voice sounds play when certain words are typed in the chat
-- You can add/remove sounds as you wish using DarkRP.setChatSound, just follow the format used here
-- To disable them completely, set GM.Config.chatsounds to false
-- TODO: Add female sounds & detect gender of model, and use combine sounds for CPs
-- DaCoolboy: I sorted the entries alphabetically for better overview
local sounds = {}
sounds[ "404" ] = { "npc/metropolice/vo/possible404here.wav" }
sounds[ "505" ] = { "npc/metropolice/vo/subjectis505.wav" }
sounds[ "citoyen" ] = { "npc/metropolice/vo/citizen.wav" }
sounds[ "code 100" ] = { "npc/metropolice/vo/code100.wav" }
sounds[ "recherche de suspect" ] = { "npc/metropolice/hiding02.wav" }
sounds[ "bloquer"] = { "npc/metropolice/vo/lock.wav" }
sounds[ "isolez" ] = { "npc/metropolice/vo/isolate.wav" }
sounds[ "appliquer" ] = { "npc/metropolice/takedown.wav" }
sounds[ "zone 404" ] = { "npc/metropolice/vo/404zone.wav" }
sounds[ "visuel" ] = { "npc/metropolice/vo/acquiringonvisual.wav" }
sounds[ "administrer" ] = { "npc/metropolice/vo/administer.wav" }
sounds[ "affirmative" ] = { "npc/metropolice/vo/affirmative.wav" }
sounds[ "Ghost patrouille aerienne 505" ] = { "npc/metropolice/vo/airwatchsubjectis505.wav" }
sounds[ "circulez" ] = { "npc/metropolice/vo/allrightyoucango.wav" }
sounds[ "tous sur le suspect" ] = { "npc/metropolice/vo/allun" }
sounds[ "allez au qg" ] = { "npc/metropolice/vo/allunitsmovein.wav" }
sounds[ "localisez le suspect" ] = { "npc/metropolice/vo/allunitsreportlocationsuspect.wav" }
sounds[ "amputez" ] = { "npc/metropolice/vo/amputate.wav" }
sounds[ "anti citoyen" ] = { "npc/metropolice/vo/anticitizen.wav" }
sounds[ "urgence code 2" ] = { "npc/metropolice/vo/allunitscode2.wav" }
sounds[ "34s dans" ] = { "npc/metropolice/vo/allunitsbol34sat.wav" }
sounds[ "anti citoyen libre" ] = { "npc/metropolice/vo/anyonepickup647e.wav" }
sounds[ "appliquer" ] = { "npc/metropolice/vo/apply.wav" }
sounds[ "pdc" ] = { "npc/metropolice/vo/atcheckpoint.wav" }
sounds[ "insectes" ] = { "npc/metropolice/vo/bugs.wav"}
sounds[ "insectes libre" ] = { "npc/metropolice/vo/bugsontheloose.wav" }
sounds[ "channel" ] = { "npc/metropolice/vo/canal.wav" }
sounds[ "bip" ] = { "npc/metropolice/vo/catchthatbliponstabilization.wav"}
sounds[ "haha" ] = { "npc/metropolice/vo/chuckle.wav" }
sounds[ "session usine" ] = { "npc/metropolice/vo/citizensummoned.wav" }
sounds[ "sujet deceder" ] = { "npc/metropolice/vo/classifyasdbthisblockready.wav" }
sounds[ "zone bloquer" ] = { "npc/metropolice/vo/condemnedzone.wav" }
sounds[ "confirmation dataincarne sur le suspect 10-0" ] = { "npc/metropolice/vo/confirmadw.wav" }
sounds[ "recu" ] = { "npc/metropolice/vo/copy.wav" }
sounds[ "unite defaillante" ] = { "npc/metropolice/vo/cpiscompromised.wav" }
sounds[ "position unite" ] = { "npc/metropolice/vo/cprequestsallunitsreportin.wav" }
sounds[ "intrusion criminelle" ] = { "npc/metropolice/vo/criminaltrespass63.wav" }
sounds[ "nombre de mort" ] = { "npc/metropolice/vo/dbcountis.wav" }
sounds[ "intrusion suspect" ] = { "npc/metropolice/vo/dispreportssuspectincursion.wav" }
sounds[ "documentez" ] = { "npc/metropolice/vo/document.wav" }
sounds[ "pas un geste" ] = { "npc/metropolice/vo/dontmove.wav" }
sounds[ "examine" ] = { "npc/metropolice/vo/examine.wav" }
sounds[ "verdict final" ] = { "npc/metropolice/vo/finalverdictadministered.wav" }
sounds[ "dernier avertisement" ] = { "npc/metropolice/vo/finalwarning.wav" }
sounds[ "premier avertisement" ] = { "npc/metropolice/vo/firstwarningmove.wav" }
sounds[ "necrotique libre" ] = { "npc/metropolice/vo/freenecrotics.wav" }
sounds[ "a terre" ] = { "npc/metropolice/vo/getdown.wav" }
sounds[ "complice ici" ] = { "npc/metropolice/vo/gotoneaccomplicehere.wav" }
sounds[ "hero" ] = { "npc/metropolice/vo/hero.wav" }
sounds[ "stop sa" ] = { "npc/metropolice/vo/holditrightthere.wav" }
sounds[ "injecte" ] = { "npc/metropolice/vo/inject.wav" }
sounds[ "dit circulez" ] = { "npc/metropolice/vo/Isaidmovealong.wav" }
sounds[ "passive" ] = { "npc/metropolice/vo/ispassive.wav" }
sounds[ "refus obtemperer" ] = { "vo/npc/male01/whoops01.wav" }
sounds[ "roi" ] = { "npc/metropolice/vo/king.wav" }
sounds[ "refus test loyauter" ] = { "npc/metropolice/vo/loyaltycheckfailure.wav" }
sounds[ "hostile" ] = { "npc/metropolice/vo/malignant.wav" }
sounds[ "recule maintenant" ] = { "npc/metropolice/vo/movebackrightnow.wav" }
sounds[ "avencez" ] = { "npc/metropolice/vo/moveit.wav" }
sounds[ "necrotique" ] = { "npc/metropolice/vo/necrotics.wav" }
sounds[ "aide pour celui la" ] = { "npc/metropolice/vo/needanyhelpwiththisone.wav" }
sounds[ "code 3 10-20" ] = { "npc/metropolice/vo/officerdowncode3tomy10-20.wav" }
sounds[ "patrouille" ] = { "npc/metropolice/vo/patrol.wav" }
sounds[ "ramasse cette boite" ] = { "npc/metropolice/vo/pickupthecan1.wav" }
sounds[ "jugement civil" ] = { "npc/metropolice/vo/prepareforjudgement.wav" }
sounds[ "rendez vous pdc" ] = { "npc/metropolice/vo/proceedtocheckpoints.wav" }
sounds[ "met sa dans la poubelle" ] = { "npc/metropolice/vo/putitinthetrash1.wav" }
sounds[ "zone interdite" ] = {"npc/metropolice/vo/restrictedblock.wav" }
sounds[ "deuxieme avertisement" ] = { "npc/metropolice/vo/secondwarning.wav" }
sounds[ "merde" ] = { "npc/metropolice/vo/shit.wav" }
sounds[ "test loyauter" ] = { "npc/metropolice/vo/standardloyaltycheck.wav" }
sounds[ "sterelisez" ] = { "npc/metropolice/vo/sterilize.wav" }
sounds[ "confirmation data" ] = { "npc/metropolice/vo/confirmadw.wav" }
sounds[ "union" ] = { "npc/metropolice/vo/union.wav" }
sounds[ "ta renverse ramase" ] = { "npc/metropolice/vo/youknockeditover.wav" }
sounds[ "affirmative" ] = { "npc/combine_soldier/vo/affirmative.wav" }
sounds[ "debut" ] = { "npc/combine_soldier/vo/engaging.wav" }
sounds[ "foncez foncez" ] = { "npc/combine_soldier/vo/gosharpgosharp.wav" }
sounds[ "milice" ] = { "npc/combine_soldier/vo/overwatch.wav" }
DarkRP.hookStub{ name = "canChatSound", description = "Whether a chat sound can be played.", parameters = { { name = "ply", description = "The player who triggered the chat sound.", type = "Player" }, { name = "chatPhrase", description = "The chat sound phrase that has been detected.", type = "string" }, { name = "chatText", description = "The whole chat text the player sent that contains the chat sound phrase.", type = "string" } }, returns = { { name = "canChatSound", description = "False if the chat sound should not be played.", type = "boolean" } }
}
DarkRP.hookStub{ name = "onChatSound", description = "When a chat sound is played.", parameters = { { name = "ply", description = "The player who triggered the chat sound.", type = "Player" }, { name = "chatPhrase", description = "The chat sound phrase that was detected.", type = "string" }, { name = "chatText", description = "The whole chat text the player sent that contains the chat sound phrase.", type = "string" } }, returns = { }
}
local function CheckChat(ply, text) if not GAMEMODE.Config.chatsounds or ply.nextSpeechSound and ply.nextSpeechSound > CurTime() then return end local prefix = string.sub(text, 0, 1) if prefix == "/" or prefix == "!" or prefix == "@" then return end -- should cover most chat commands for various mods/addons for k, v in pairs(sounds) do local res1, res2 = string.find(string.lower(text), k) if res1 and (not text[res1 - 1] or text[res1 - 1] == "" or text[res1 - 1] == " ") and (not text[res2 + 1] or text[res2 + 1] == "" or text[res2 + 1] == " ") then local canChatSound = hook.Call("canChatSound", nil, ply, k, text) if canChatSound == false then return end ply:EmitSound(table.Random(v), 80, 100) ply.nextSpeechSound = CurTime() + GAMEMODE.Config.chatsoundsdelay -- make sure they don't spam HAX HAX HAX, if the server owner so desires hook.Call("onChatSound", nil, ply, k, text) break end end
end
hook.Add("PostPlayerSay", "ChatSounds", CheckChat)
DarkRP.getChatSound = DarkRP.stub{ name = "getChatSound", description = "Get a chat sound (play a noise when someone says something) associated with the given phrase.", parameters = { { name = "text", description = "The text that triggers the chat sound.", type = "string", optional = false } }, returns = { { name = "soundPaths", description = "A table of string sound paths associated with the given text.", type = "table" } }, metatable = DarkRP
}
function DarkRP.getChatSound(text) return sounds[string.lower(text or "")]
end
DarkRP.setChatSound = DarkRP.stub{ name = "setChatSound", description = "Set a chat sound (play a noise when someone says something)", parameters = { { name = "text", description = "The text that should trigger the sound.", type = "string", optional = false }, { name = "sounds", description = "A table of string sound paths.", type = "table", optional = false } }, returns = { }, metatable = DarkRP
}
function DarkRP.setChatSound(text, sndTable) sounds[string.lower(text or "")] = sndTable
end
Merci d'avance!