- Initiateur de la discussion
TSnick
Geek
- Messages
- 53
- Score réaction
- 9
- Points
- 95
Bonjour, j'aurais besoins d'un coup de mains pour retirer ceci svp
Merci d'avance
Merci d'avance
-----------------------------------------------------------------------------[[
-----------------------------------------------------------------------------]]
local receivers
local currentChatText = {}
local receiverConfigs = {}
local currentConfig = {text = "", hearFunc = fn.Id} -- Default config is not loaded yet
function DarkRP.addChatReceiver(prefix, text, hearFunc) receiverConfigs[prefix] = { text = text, hearFunc = hearFunc }
end
function DarkRP.removeChatReceiver(prefix) receiverConfigs[prefix] = nil
end
function DarkRP.addChatReceiver(prefix, text, hearFunc) receiverConfigs[prefix] = { text = text, hearFunc = hearFunc }
end
local function chatGetRecipients() if not currentConfig then return end receivers = {} for _, ply in pairs(player.GetAll()) do if not IsValid(ply) or ply == LocalPlayer() then continue end if ply:GetNoDraw() then continue end local val = currentConfig.hearFunc(ply, currentChatText) -- Return nil to disable the chat recipients temporarily. if val == nil then receivers = nil return elseif val == true then table.insert(receivers, ply) end end
end
local function startFind() currentConfig = receiverConfigs[""] hook.Add("Think", "DarkRP_chatRecipients", chatGetRecipients) hook.Add("HUDPaint", "DarkRP_DrawChatReceivers", drawChatReceivers)
end
hook.Add("StartChat", "DarkRP_StartFindChatReceivers", startFind)
local function stopFind() hook.Remove("Think", "DarkRP_chatRecipients") hook.Remove("HUDPaint", "DarkRP_DrawChatReceivers")
end
hook.Add("FinishChat", "DarkRP_StopFindChatReceivers", stopFind)
local function findConfig(text) local split = string.Explode(' ', text) local prefix = string.lower(split[1]) currentChatText = split currentConfig = receiverConfigs[prefix] or receiverConfigs[""]
end
hook.Add("ChatTextChanged", "DarkRP_FindChatRecipients", findConfig)
-- Load after the custom languages have been loaded
local function loadChatReceivers() -- Default talk chat receiver has no prefix DarkRP.addChatReceiver("", DarkRP.getPhrase("talk"), function(ply) if GAMEMODE.Config.alltalk then return nil end return LocalPlayer():GetPos():DistToSqr(ply:GetPos()) < 62500 end) DarkRP.addChatReceiver("/ooc", DarkRP.getPhrase("speak_in_ooc"), function(ply) return true end) DarkRP.addChatReceiver("//", DarkRP.getPhrase("speak_in_ooc"), function(ply) return true end) DarkRP.addChatReceiver("/a", DarkRP.getPhrase("speak_in_ooc"), function(ply) return true end) DarkRP.addChatReceiver("/w", DarkRP.getPhrase("whisper"), function(ply) return LocalPlayer():GetPos():DistToSqr(ply:GetPos()) < 8100 end) DarkRP.addChatReceiver("/y", DarkRP.getPhrase("yell"), function(ply) return LocalPlayer():GetPos():DistToSqr(ply:GetPos()) < 302500 end) DarkRP.addChatReceiver("/me", DarkRP.getPhrase("perform_your_action"), function(ply) return LocalPlayer():GetPos():DistToSqr(ply:GetPos()) < 62500 end) DarkRP.addChatReceiver("/g", DarkRP.getPhrase("talk_to_your_group"), function(ply) for _, func in pairs(GAMEMODE.DarkRPGroupChats) do if func(LocalPlayer()) and func(ply) then return true end end return false end) DarkRP.addChatReceiver("/pm", "PM", function(ply, text) if not isstring(text[2]) then return false end text[2] = string.lower(tostring(text[2])) return string.find(string.lower(ply:Nick()), text[2], 1, true) ~= nil or string.find(string.lower(ply:SteamName()), text[2], 1, true) ~= nil or string.lower(ply:SteamID()) == text[2] end) DarkRP.addChatReceiver("speak", DarkRP.getPhrase("speak"), function(ply) if not LocalPlayer().DRPIsTalking then return nil end if LocalPlayer():GetPos():DistToSqr(ply:GetPos()) > 302500 then return false end return not GAMEMODE.Config.dynamicvoice or ply:isInRoom() end)
end
hook.Add("loadCustomDarkRPItems", "loadChatListeners", loadChatReceivers)
local function startFindVoice(ply) if ply ~= LocalPlayer() then return end currentConfig = receiverConfigs["speak"] hook.Add("Think", "DarkRP_chatRecipients", chatGetRecipients) hook.Add("HUDPaint", "DarkRP_DrawChatReceivers", drawChatReceivers)
end
hook.Add("PlayerStartVoice", "DarkRP_VoiceChatReceiverFinder", startFindVoice)
local function stopFindVoice(ply) if ply ~= LocalPlayer() then return end stopFind()
end
hook.Add("PlayerEndVoice", "DarkRP_VoiceChatReceiverFinder", stopFindVoice)
mrc bcpVeaTime à dit:Tu va dans gamemodes/le gamemode de ton serveur/gamemode/modules/chat dans cl_chatlisteners tu supprime tout est tu mes ça a la place
cl_chatlisteners.lua:-----------------------------------------------------------------------------[[ -----------------------------------------------------------------------------]] local receivers local currentChatText = {} local receiverConfigs = {} local currentConfig = {text = "", hearFunc = fn.Id} -- Default config is not loaded yet function DarkRP.addChatReceiver(prefix, text, hearFunc) receiverConfigs[prefix] = { text = text, hearFunc = hearFunc } end function DarkRP.removeChatReceiver(prefix) receiverConfigs[prefix] = nil end function DarkRP.addChatReceiver(prefix, text, hearFunc) receiverConfigs[prefix] = { text = text, hearFunc = hearFunc } end local function chatGetRecipients() if not currentConfig then return end receivers = {} for _, ply in pairs(player.GetAll()) do if not IsValid(ply) or ply == LocalPlayer() then continue end if ply:GetNoDraw() then continue end local val = currentConfig.hearFunc(ply, currentChatText) -- Return nil to disable the chat recipients temporarily. if val == nil then receivers = nil return elseif val == true then table.insert(receivers, ply) end end end local function startFind() currentConfig = receiverConfigs[""] hook.Add("Think", "DarkRP_chatRecipients", chatGetRecipients) hook.Add("HUDPaint", "DarkRP_DrawChatReceivers", drawChatReceivers) end hook.Add("StartChat", "DarkRP_StartFindChatReceivers", startFind) local function stopFind() hook.Remove("Think", "DarkRP_chatRecipients") hook.Remove("HUDPaint", "DarkRP_DrawChatReceivers") end hook.Add("FinishChat", "DarkRP_StopFindChatReceivers", stopFind) local function findConfig(text) local split = string.Explode(' ', text) local prefix = string.lower(split[1]) currentChatText = split currentConfig = receiverConfigs[prefix] or receiverConfigs[""] end hook.Add("ChatTextChanged", "DarkRP_FindChatRecipients", findConfig) -- Load after the custom languages have been loaded local function loadChatReceivers() -- Default talk chat receiver has no prefix DarkRP.addChatReceiver("", DarkRP.getPhrase("talk"), function(ply) if GAMEMODE.Config.alltalk then return nil end return LocalPlayer():GetPos():DistToSqr(ply:GetPos()) < 62500 end) DarkRP.addChatReceiver("/ooc", DarkRP.getPhrase("speak_in_ooc"), function(ply) return true end) DarkRP.addChatReceiver("//", DarkRP.getPhrase("speak_in_ooc"), function(ply) return true end) DarkRP.addChatReceiver("/a", DarkRP.getPhrase("speak_in_ooc"), function(ply) return true end) DarkRP.addChatReceiver("/w", DarkRP.getPhrase("whisper"), function(ply) return LocalPlayer():GetPos():DistToSqr(ply:GetPos()) < 8100 end) DarkRP.addChatReceiver("/y", DarkRP.getPhrase("yell"), function(ply) return LocalPlayer():GetPos():DistToSqr(ply:GetPos()) < 302500 end) DarkRP.addChatReceiver("/me", DarkRP.getPhrase("perform_your_action"), function(ply) return LocalPlayer():GetPos():DistToSqr(ply:GetPos()) < 62500 end) DarkRP.addChatReceiver("/g", DarkRP.getPhrase("talk_to_your_group"), function(ply) for _, func in pairs(GAMEMODE.DarkRPGroupChats) do if func(LocalPlayer()) and func(ply) then return true end end return false end) DarkRP.addChatReceiver("/pm", "PM", function(ply, text) if not isstring(text[2]) then return false end text[2] = string.lower(tostring(text[2])) return string.find(string.lower(ply:Nick()), text[2], 1, true) ~= nil or string.find(string.lower(ply:SteamName()), text[2], 1, true) ~= nil or string.lower(ply:SteamID()) == text[2] end) DarkRP.addChatReceiver("speak", DarkRP.getPhrase("speak"), function(ply) if not LocalPlayer().DRPIsTalking then return nil end if LocalPlayer():GetPos():DistToSqr(ply:GetPos()) > 302500 then return false end return not GAMEMODE.Config.dynamicvoice or ply:isInRoom() end) end hook.Add("loadCustomDarkRPItems", "loadChatListeners", loadChatReceivers) local function startFindVoice(ply) if ply ~= LocalPlayer() then return end currentConfig = receiverConfigs["speak"] hook.Add("Think", "DarkRP_chatRecipients", chatGetRecipients) hook.Add("HUDPaint", "DarkRP_DrawChatReceivers", drawChatReceivers) end hook.Add("PlayerStartVoice", "DarkRP_VoiceChatReceiverFinder", startFindVoice) local function stopFindVoice(ply) if ply ~= LocalPlayer() then return end stopFind() end hook.Add("PlayerEndVoice", "DarkRP_VoiceChatReceiverFinder", stopFindVoice)
C'est le meme code sauf que j'ai remove le "everyone can hear you!"