How do I use a chat command to make my GUI to op up?
[CODE]
if ply:IsUserGroup( "superadmin", "owner" )
local Derma = vgui.Create( "DFrame" )
Derma:Center()
Derma:SetSize( 300, 600 )
Derma:SetTitle( "Raindeer Anti-Spam" )
Derma:SetVisible( true )
Derma:SetDraggable( true )
Derma:ShowCloseButton( true )
Derma:MakePopup()
local Collapsible = vgui.Create( "DCollapsibleCategory", Derma )
Collapsible:SetPos( 25,50 )
Collapsible:SetSize( 200, 50 ) -- Keep the second number at 50
Collapsible:SetExpanded( 0 ) -- Expanded when popped up
Collapsible:SetLabel( "Raindeer Anti-Spam" )
CategoryList = vgui.Create( "DPanelList" )
CategoryList:SetAutoSize( true )
CategoryList:SetSpacing( 5 )
CategoryList:EnableHorizontal( false )
CategoryList:EnableVerticalScrollbar( true )
Collapsible:SetContents( CategoryList ) -- Add our list above us as the contents of the collapsible category
local CategoryContentOne = vgui.Create( "DCheckBoxLabel" )
CategoryContentOne:SetText( "God Mode" )
CategoryContentOne:SetValue( AntiSpam.Settings.AntiSpamming = true )
function CategoryContentOne:OnChange( checked )
AntiSpam.Settings.AntiSpamming = checked
end
CategoryList:AddItem( CategoryContentOne ) -- Add the above item to our list
else
ply:ChatPrint( "You do not have permission to do this!" )
end
[/CODE]
[QUOTE=MexicanR;49431796]How do I use a chat command to make my GUI to op up?[/QUOTE]
[CODE]
hook.Add( "OnPlayerChat", 'OpenDerma', function( ply, txt, team, bIsDead )
if ply:IsUserGroup( "superadmin", "owner" ) and txt == 'Whatever the player says to activate it' then
--your code here
end
end )
[/CODE]
[QUOTE=MPan1;49432127][CODE]
hook.Add( "OnPlayerChat", 'OpenDerma', function( ply, txt, team, bIsDead )
if ply:IsUserGroup( "superadmin", "owner" ) and txt == 'Whatever the player says to activate it' then
--your code here
end
end )
[/CODE][/QUOTE]
add a check to make sure that ply == LocalPlayer(), or else if any superadmin types in the command, everyone's screen will show the menu
I have a few questions; How can I apply a blur as the background of a derma, also how can I draw an image to the screen?
Last question: Is it possible to prevent the use of certain commands, without removing them?
Does anybody know why my dedicated servers have an error when shuting down?
It is:
[CODE]Shutdown function ShutdownMixerControls() not in list!!![/CODE]
It appears on the last line of the server when shuting down
Hello
I'm trying to grab the return string from a console command (in this case, atmos_dnc_gettime) which "The current time is [time]". How would I go about doing this?
Thank you in advance.
[QUOTE=Silhouhat;49434825]Hello
I'm trying to grab the return string from a console command (in this case, atmos_dnc_gettime) which "The current time is [time]". How would I go about doing this?
Thank you in advance.[/QUOTE]
[url]https://facepunch.com/showthread.php?t=1476636[/url]
First google search.
Dont be lazy, please
I'm currently making a Anti-Spam addon and I want to have a logging system that logs when a user is spamming & then will report and admin if the user goes over a configurable amount of warnings. I would to know if anyone here could help me with this logging system? I'm a "semi-beginner" with lua & glua.
[QUOTE=MexicanR;49435043]I'm currently making a Anti-Spam addon and I want to have a logging system that logs when a user is spamming & then will report and admin if the user goes over a configurable amount of warnings. I would to know if anyone here could help me with this logging system? I'm a "semi-beginner" with lua & glua.[/QUOTE]
What do you need help with, specifically? It sounds like you want us to make this for you. Work on it and get as far as you can, and post here if you get stuck.
[QUOTE=Z0mb1n3;49432204]add a check to make sure that ply == LocalPlayer(), or else if any superadmin types in the command, everyone's screen will show the menu[/QUOTE]
This doesn't make anything popup.
[editline]1st January 2016[/editline]
[QUOTE=roastchicken;49435229]What do you need help with, specifically? It sounds like you want us to make this for you. Work on it and get as far as you can, and post here if you get stuck.[/QUOTE]
I have no idea where to start with this. Maybe some links that have references to this could help. I couldn't find anything on Google. Then again my download speed is 5mbps
[QUOTE=MexicanR;49435328]Then again my download speed is 5mbps[/QUOTE]
What does download speed have to do with anything?
Is it possible to force a VGUI element to draw behind the chatbox?
[QUOTE=Z0mb1n3;49435772]Is it possible to force a VGUI element to draw behind the chatbox?[/QUOTE]
Untested, but this might do it.
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/SetZPos]Panel:SetZPos[/url]
[QUOTE=man with hat;49435881]Untested, but this might do it.
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/SetZPos]Panel:SetZPos[/url][/QUOTE]
Thanks, but that didn't seem to work. I set it as low as possible (-32768), but the default chatbox still draws behind it.
[QUOTE=bigdogmat;49435469]What does download speed have to do with anything?[/QUOTE]
Slow af internet
[QUOTE=MexicanR;49435919]Slow af internet[/QUOTE]
I get that though you can still easily look up stuff on the wiki and look through forums with that, I mean I have 2-3mbps on a good day which easily allows me to do these things.
As for the reference you're looking for
[IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/GM/PlayerSay"]GM/PlayerSay[/URL]
Guessing you already have a way to log it to something. Only other thing you'd need is a way to detect spam, which is kind of trial and error and a lot of testing ie
Checking if the player typed the same thing over and over..
Checking how often they're typing..
Checking if anything they're typing is in a valid format..
Many ways to do this and there isn't one solid way to do it.
EDIT: You may be talking about prop spam in which case you'd have to detect when they try to spawn a prop. If your gamemode is derived from sandbox then it'll have
[IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/SANDBOX/PlayerSpawnedProp"]SANDBOX/PlayerSpawnedProp[/URL]
and
[IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/SANDBOX/PlayerSpawnProp"]SANDBOX/PlayerSpawnProp[/URL]
And with those you'd use the first to add to a counter for spawned props and when they spawned it, and with the second you'd check if they're spamming and that's where you'd stop them. Just like chat spamming it's pretty much trial and error with testing, check times inbetween spawns, etc, etc.
Is there a way to register tools in real time without having to restart server?
I'm trying to make bots move to a certain location using a PlayerMove hook, but I'm having trouble with the math of it.
[code]
local SpeedMult = 100
local BotPos = ply:GetPos()
local BotAng = ply:GetAngles()
BotAng:Normalize()
local NoAngle = Angle(0,0,0)
local LocPos, LocAng = WorldToLocal(ply.CurrentTargetPos,NoAngle,BotPos,BotAng)
local Final = LocPos:GetNormalized()
mv:SetForwardSpeed(Final.x*SpeedMult)
mv:SetSideSpeed(Final.y*SpeedMult)
[/code]
ply.CurrentTargetPos is the position where the bot is told to go and it's not going in that direction because I've never done something like this before.
SetForwardSpeed tells the bot to move forward, relative to where he is looking
SetSideSpeed tells the bot to move right, relative to where he is looking.
[QUOTE=bigdogmat;49436337]I get that though you can still easily look up stuff on the wiki and look through forums with that, I mean I have 2-3mbps on a good day which easily allows me to do these things.
As for the reference you're looking for
[IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/GM/PlayerSay"]GM/PlayerSay[/URL]
Guessing you already have a way to log it to something. Only other thing you'd need is a way to detect spam, which is kind of trial and error and a lot of testing ie
Checking if the player typed the same thing over and over..
Checking how often they're typing..
Checking if anything they're typing is in a valid format..
Many ways to do this and there isn't one solid way to do it.
EDIT: You may be talking about prop spam in which case you'd have to detect when they try to spawn a prop. If your gamemode is derived from sandbox then it'll have
[IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/SANDBOX/PlayerSpawnedProp"]SANDBOX/PlayerSpawnedProp[/URL]
and
[IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/SANDBOX/PlayerSpawnProp"]SANDBOX/PlayerSpawnProp[/URL]
And with those you'd use the first to add to a counter for spawned props and when they spawned it, and with the second you'd check if they're spamming and that's where you'd stop them. Just like chat spamming it's pretty much trial and error with testing, check times inbetween spawns, etc, etc.[/QUOTE]
Actually it's the other way around I have the spamming protection made, but the logs I do not have made nor to I really know how. I do know that the logs should be event based. So on the event that a player spawns something, if it exceeds the threshold of warnings, get a list of admins and notify them but I have to make sure that I don't do this every frame, etc.
[QUOTE=GGG KILLER;49425204]How do I add a DCheckBoxLabel to a DCategoryList's category, I have the following code but it doesn't works:
[lua]
local Categories = vgui.Create('DCategoryList', MainWindow)
Categories:Dock( FILL )
local Categories_General = Categories:Add'General'
local CheckBox = vgui.Create'DCheckBoxLabel'
CheckBox:SetText'Enable Something'
function CheckBox:OnChange( checked )
print(checked and 'You Enabled Something! :D' or 'You Disabled Something! D:')
end
Categories_General:Add(CheckBox)
[/lua]
but it just errors, and if I do [lua]Categories:AddItem(CheckBox)[/lua] it won't add the CheckBox to that category...[/QUOTE]
bump?
[QUOTE=GGG KILLER;49425204]How do I add a DCheckBoxLabel to a DCategoryList's category, I have the following code but it doesn't works:
[lua]
local Categories = vgui.Create('DCategoryList', MainWindow)
Categories:Dock( FILL )
local Categories_General = Categories:Add'General'
local CheckBox = vgui.Create'DCheckBoxLabel'
CheckBox:SetText'Enable Something'
function CheckBox:OnChange( checked )
print(checked and 'You Enabled Something! :D' or 'You Disabled Something! D:')
end
Categories_General:Add(CheckBox)
[/lua]
but it just errors, and if I do [lua]Categories:AddItem(CheckBox)[/lua] it won't add the CheckBox to that category...[/QUOTE]
You might wanna overwrite AddItem with this since this actually works.
[code]
Categories.AddItem = function(cat,ctrl) ctrl:SetParent(cat) ctrl:Dock(TOP) end
[/code]
Or just use DCollapsableCategory with this code also.
[QUOTE=LUModder;49436945]You might wanna overwrite AddItem with this since this actually works.
[code]
Categories.AddItem = function(cat,ctrl) ctrl:SetParent(cat) ctrl:Dock(TOP) end
[/code]
Or just use DCollapsableCategory with this code also.[/QUOTE]
Thank you!
Hey I was wondering If it is possible to group weapons to be listed under one name in the GUI where you ID a body and it shows what was used to kill them.
What it currently looks like:
[IMG]https://t.gyazo.com/teams/nwa/d2b59a559112af7533036d7add488e25.png[/IMG]
I'm wondering if there is some code to add to make it just show as "CS:GO Knife"
pastebin of knife Lua: [url]http://pastebin.com/zf9bjxGY[/url]
I am using table.sort for the first time and it's being weird, this is my code:
[code]
function SortTable()
PrintTable(MyTable)
print("\n\n\n")
PrintTable(table.sort(MyTable, function(a,b) return a < b end))
end
[/code]
The key for my table is a number, whereas the value is an entity/player. While the first print shows the table perfectly fine, I get an error on the third one saying that the table is nil
Why is this?
[QUOTE=NiandraLades;49438119]I am using table.sort for the first time and it's being weird, this is my code:
[code]
function SortTable()
PrintTable(MyTable)
print("\n\n\n")
PrintTable(table.sort(MyTable, function(a,b) return a < b end))
end
[/code]
The key for my table is a number, whereas the value is an entity/player. While the first print shows the table perfectly fine, I get an error on the third one saying that the table is nil
Why is this?[/QUOTE]
table.sort doesn't actually return a table, but rather physically rearranges the table you use it on.
OH, I see - I decided to re-write a line and use table.SortByKey instead, but thanks anyway - I'll be sure to keep that in mind for future reference!
[editline]2nd January 2016[/editline]
Actually going back - does table.sort go by value or key?
Because I've got
[code]
Player [1][Niandra Lades] = 100
Player [2][Bot01] = 200
[/code]
But the order doesn't seem to change at all, no matter if I do
[code]
table.sort(MyTable, function(a,b) return a > b end)
[/code]
or
[code]
table.sort(MyTable, function(a,b) return a < b end)
[/code]
[QUOTE=NiandraLades;49438149]OH, I see - I decided to re-write a line and use table.SortByKey instead, but thanks anyway - I'll be sure to keep that in mind for future reference!
[editline]2nd January 2016[/editline]
Actually going back - does table.sort go by value or key?
Because I've got
[code]
Player [1][Niandra Lades] = 100
Player [2][Bot01] = 200
[/code]
But the order doesn't seem to change at all, no matter if I do
[code]
table.sort(MyTable, function(a,b) return a > b end)
[/code]
or
[code]
table.sort(MyTable, function(a,b) return a < b end)
[/code][/QUOTE]
It appears that if you don't use numerical keys, the sort function doesn't like it. I'm getting the same result as you.
Would anyone know why
[lua]
function PANEL:SetEnabled(self, bEnabled, ...)
self.BaseClass.SetEnabled(self, bEnabled, ...)
end
[/lua]
Would cause a stack overflow?
[QUOTE=vexx21322;49438889]Would anyone know why
[lua]
function PANEL:SetEnabled(self, bEnabled, ...)
self.BaseClass.SetEnabled(self, bEnabled, ...)
end
[/lua]
Would cause a stack overflow?[/QUOTE]
it's calling itself, causing an infinite loop :P
[QUOTE=vexx21322;49438889]Would anyone know why
function PANEL:SetEnabled(self, bEnabled, ...) self.BaseClass.SetEnabled(self, bEnabled, ...)end
Would cause a stack overflow?[/QUOTE]
Is it because when you register a new vgui element without a third argument, the panel's baseclass is itself? Therefore, calling the baseclass version of the function, which is a function you just defined, will do exactly what my sentence was about to do and keep repeating...
Sorry, you need to Log In to post a reply to this thread.