Hello,
So for some reason, my addons are conflicting. These are addons I've made. The two I'm showing you, as you can see, are a !rules chat command and !servers chat command. Only the !servers one will actually work when they're both on the same server. How do I fix this? Here is the server file for each addon and the starting of the client file.
[LUA]
-- Rules addon
if ( SERVER ) then
local chatCommands = {
"!rules",
}
hook.Add( "PlayerSay", "ChatCheck", function( ply, text, bteam )
if ( table.HasValue( chatCommands, text:lower() ) ) then
umsg.Start( "rulesMenu", ply )
umsg.End()
umsg.Start( "rulesBroadcast" )
umsg.Entity( ply )
umsg.End()
return ""
end
end )
end
if CLIENT then
usermessage.Hook( "rulesMenu", function()
local base2 = vgui.Create( 'DPanel' )
base2:SetSize( 480, 480 )
base2:SetPos( (ScrW()/2)-(base2:GetWide()/2), (ScrH()/2)-(base2:GetTall()/2)-ScrH() )
base2:MoveTo((ScrW()/2)-(base2:GetWide()/2), (ScrH()/2)-(base2:GetTall()/2), 0.5,0,-1)
base2:MakePopup()
base2:SetVisible( true )
function base2:Paint( w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 18, 18, 18, 250 ) )
end
-- Servers addon
if SERVER then
util.AddNetworkString( 'isply' )
util.AddNetworkString( 'Openpls' )
local chatCommands = {
"!servers",
}
hook.Add( "PlayerSay", "ChatCheck", function( ply, text, bteam )
if ( table.HasValue( chatCommands, text:lower() ) ) then
net.Start( 'Openpls' )
net.Send( ply )
net.Start( 'isply' )
net.Send( ply )
return ""
end
end )
end
net.Receive( 'Openpls', function()
local base = vgui.Create( 'DPanel' )
base:SetSize( 350, 143 )
base:Center()
local x, y = base:GetPos()
base:SetPos( (ScrW()/2)-(base:GetWide()/2), (ScrH()/2)-(base:GetTall()/2)-ScrH() )
base:MoveTo((ScrW()/2)-(base:GetWide()/2), (ScrH()/2)-(base:GetTall()/2)-200, 0.5,0,-1)
base:SetVisible( true )
base:MakePopup()
function base:Paint( w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 18, 18, 18, 250 ) )
end
[/LUA]
Any help would be cool! Thanks
PLEASE NOTE THEY BOTH WORK. SO IF I ONLY HAVE THE RULES ADDON IT WORKS.
Don't return in the PlayerSay hook
[QUOTE=code_gs;48531402]Don't return in the PlayerSay hook[/QUOTE]
I removed the return "" of both. Didn't change anything, only one will work.
It always seems to be the server one as well.
[QUOTE=Munch1431;48531455]I removed the return "" of both. Didn't change anything, only one will work.
It always seems to be the server one as well.[/QUOTE]
You have same names for the hooks, change the 2nd arg, example:
hook.Add( "PlayerSay", "UNIQUENAMEHERE", ....
You cant have 2 same uniquenames, because it will overwrite the old one.
[QUOTE=SteppuFIN;48531571]You have same names for the hooks, change the 2nd arg, example:
hook.Add( "PlayerSay", "UNIQUENAMEHERE", ....
You cant have 2 same uniquenames, because it will overwrite the old one.[/QUOTE]
Thank you very much!
Sorry, you need to Log In to post a reply to this thread.