• Comms & Looc addon help
    2 replies, posted
Hello, my name is DanK aka PIXX! My problem is that the there is not text that shows up other then the Comms, Ooc and Advert ones, how do I fix this? Code - server: [code] if SERVER then util.AddNetworkString("SendCommsMsg") util.AddNetworkString("SendCommsMsg2") util.AddNetworkString("SendCommsMsg3") util.AddNetworkString("SendAdvertMsg") util.AddNetworkString("CommsFailure") util.AddNetworkString("CommsSuccess") util.AddNetworkString("CommsSuccess2") util.AddNetworkString("CommsSuccess3") hook.Add( "PlayerSay", "CommmsSay", function( ply, text, public, args ) if ( string.Left( text, 6 ) == "/comms" ) then net.Start("CommsSuccess") net.WriteString(string.sub(text, 7)) net.Send(ply) return ""; else return true; end if ( string.Left( text, 7 ) == "/advert" ) then net.Start("CommsSuccess2") net.WriteString(string.sub(text, 8)) net.Send(ply) return ""; else return true; end if ( string.Left( text, 4 ) == "/ooc" ) then net.Start("CommsSuccess3") net.WriteString(string.sub(text, 5)) net.Send(ply) return ""; else return true; end if ( string.Left( text, 5 ) == "/looc" ) then return "[LOOC] "..string.sub(text, 6); else return true; end return string.sub(text,0); end ); local comms = "[COMMS] " net.Receive("SendCommsMsg",function(len, ply) msg = net.ReadString() if msg != "" then if ply:IsValid() then print(comms..ply:Nick()..": "..msg) PrintMessage(HUD_PRINTTALK,comms..ply:Nick()..": "..msg) elseif not ply:IsValid() then print(comms.."Player is not valid, but the msg is!") end elseif msg == "" then net.Start("CommsFailure") if ply:IsValid() then net.WriteString(comms..ply:Nick().."\nI am sorry to inform you that your message did not come thru! Try adding some words next time!\n-Server") elseif not ply:IsValid() then print(comms.."Player is not valid and msg is not valid!") end net.Send(ply) end end) local advert = "[ADVERT] " net.Receive("SendCommsMsg2",function(len, ply) msg = net.ReadString() if msg != "" then if ply:IsValid() then print(advert..ply:Nick()..": "..msg) PrintMessage(HUD_PRINTTALK,advert..ply:Nick()..": "..msg) elseif not ply:IsValid() then print(advert.."Player is not valid, but the msg is!") end elseif msg == "" then net.Start("CommsFailure") if ply:IsValid() then net.WriteString(advert..ply:Nick().."\nI am sorry to inform you that your message did not come thru! Try adding some words next time!\n-Server") elseif not ply:IsValid() then print(advert.."Player is not valid and msg is not valid!") end net.Send(ply) end end) local ooc = "[OOC] " net.Receive("SendCommsMsg3",function(len, ply) msg = net.ReadString() if msg != "" then if ply:IsValid() then print(ooc..ply:Nick()..": "..msg) PrintMessage(HUD_PRINTTALK,ooc..ply:Nick()..": "..msg) elseif not ply:IsValid() then print(ooc.."Player is not valid, but the msg is!") end elseif msg == "" then net.Start("CommsFailure") if ply:IsValid() then net.WriteString(ooc..ply:Nick().."\nI am sorry to inform you that your message did not come thru! Try adding some words next time!\n-Server") elseif not ply:IsValid() then print(ooc.."Player is not valid and msg is not valid!") end net.Send(ply) end end) concommand.Add("comms",function( ply, cmd, args ) if (args[1] != nil) then print(comms.."server: "..args[1]) PrintMessage(HUD_PRINTTALK,comms.."server: "..args[1]) elseif (args[1] == nil) then print("The message needs to be at least 1 character!") end end) concommand.Add("comms_help",function() print("/comms ARGUMENT\nor\ncomms ARGUMENT\nExample: /comms 'GRANTED'(comms 'granted')") end) end [/code]
Is this for darkrp? Because they have some functions to tie it with darkrp and makes it easier to fix
Sorry, you need to Log In to post a reply to this thread.