Derma button @ message.

So with my derma button I have an @ message that will show if clicked. The player says @Help blah blah blah. But only they can see the @ message. How do I make it so admins see it? I’m gonna go ahead and guess i’ll be working in the init.lua file.

Thanks!

You have to network it or send it to admins via :SendLua()

Ew. Or do it all clientside, and loop through the admins and print a message accordingly…

How are you planning on sending it to admins without sending it to server first?
We are talking about custom function, not some built in ULX right?

I assumed it was custom…



for k,v in pairs(player.GetAll()) do
	if (not v:IsAdmin()) then continue end

	v:PrintMessage(HUD_PRINTTALK, "Blah blah message")
end


Maybe if I showed my code it would be easier for you guys…


net.Receive( 'OpenIt', function()
		local base = vgui.Create( 'DFrame' )
			base:SetSize( 470, 300 )
			base:Center()
			base:ShowCloseButton( true )
			base:MakePopup()
			base:SetDraggable( false )
			base:SetTitle( 'Admin Help' )
			function base:Paint( w, h )
				draw.RoundedBox( 0, 0, 0, w, h, Color( 0,0, 0 ) )
				surface.SetDrawColor( 33, 255, 0 )
				surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
			end
		local button = vgui.Create( 'DButton' )
			button:SetParent( base )
			button:SetSize( 150, 100 )
			button:SetPos( 5, 26 )
			button:SetText( 'RDM' )
			button.DoClick = function()
			function button:Paint( w, h )
				draw.RoundedBox( 0, 0, 0, w, h, Color( 33, 255, 0 ) )
			end
			RunConsoleCommand( "say", "@Help! I have been RDMed!" )
		end 
		local button2 = vgui.Create( 'DButton' )
			button2:SetParent( base )
			button2:SetSize( 150, 100 )
			button2:SetPos( 160, 26 )
			button2:SetText( 'RDA' )
			button2.DoClick = function()
			function button2:Paint( w, h )
				draw.RoundedBox( 0, 0, 0, w, h, Color( 33, 255, 0 ) )
			end
			RunConsoleCommand( "say", "@Help! I have been RDAed!" )
		end	
		local button3 = vgui.Create( 'DButton' )
			button3:SetParent( base )
			button3:SetSize( 150, 100 )
			button3:SetPos( 315, 26 )
			button3:SetText( 'NLR' )
			button3.DoClick = function()
			function button3:Paint( w, h )
				draw.RoundedBox( 0, 0, 0, w, h, Color( 33, 255, 0 ) )
			end
			RunConsoleCommand( "say", "@Help! This person is breaking New Life Rule!" )
		end	
end )


That’s my code. Whenever some hits a button, the message sends but admins can’t see it. They need to be able to see it. And yes I do use ULX.

@Help isn’t a ULX command. Pretty sure you need to add a space. I’m not for sure tho

Try changing ‘say’ to the actual ULX command like sayToAdmins or whatever it uses.

This might make stuff easier for you:

[editline]16th September 2014[/editline]

Wait fuck I mean this

Everything you see works fine. I need the admins to get the messages. Which would probably need to go in my init.lua…

[editline]16th September 2014[/editline]

I want them to click a button and send the message. Not type it out :confused:

You can just define the message in DoClick

“ulx asay RdEEEemmeEEEd! Amdin 2 m3!!!1”

I don’t understand. Could you give me an example?

Ignore what I said, I didn’t look close enough before I sent the message

urbutton.DoClick = function()

and:

this is how to correctly use @

"say " … “@” … “hello”

you would want to use concommand thou, this is what i use in my script: LocalPlayer():ConCommand("say " … “@” … “hello admins!!” )

I still don’t think admins would be able to see this.

They would.

It did not work. Anyone else have any ideas?

What?

Then you must be doing something wrong, this is my whole shit:




local rekt = {
	"HELLO",
	"ABUSE",
	"ADMIN HELLO!!"
}

SPATSPam = function()
	LocalPlayer():ConCommand("say " .. "@" .. table.Random(rekt) )
end



And its been tested and works

where did you place the ConCommand thing? show me the code

Do you have ULX installed clientside (if that’s how you’re testing it) because it won’t work without it.