-SNIPY-
Figured it out, I was trying to use a sandbox function in my base gamemode.
is there any way to disable built-in effects from weapons?
such as muzzle flashes and shell ejections?
[editline]10th September 2012[/editline]
is there any way to disable built-in effects from weapons?
such as muzzle flashes and shell ejections?
and sounds?
[code]if CLIENT then
function testframe()
local DCheckBox2
local NOABGUI
NOABGUI = vgui.Create('DFrame')
NOABGUI:SetSize(530, 446)
NOABGUI:Center()
NOABGUI:SetTitle('NK Cheat')
NOABGUI:SetSizable(true)
NOABGUI:SetDeleteOnClose(false)
NOABGUI:MakePopup()
DCheckBox2 = vgui.Create('DCheckBoxLabel')
DCheckBox2:SetPos(267, 233)
DCheckBox2:SetText('kill')
DCheckBox2.DoClick = function()
RunConsoleCommand("kill")
end
end
concommand.Add("menutest", testframe) -- adding the console command
end
[/code]
] menutest
Unknown Command: 'menutest'
I'm attempting to make a GUI, i made for my own server and the derma isn't working. Can anyone tell me what's wrong with this?
ignore the "kill" function on the checkbox
[QUOTE=zerothefallen;37618848][code]if CLIENT then
function testframe()
local DCheckBox2
local NOABGUI
NOABGUI = vgui.Create('DFrame')
NOABGUI:SetSize(530, 446)
NOABGUI:Center()
NOABGUI:SetTitle('NK Cheat')
NOABGUI:SetSizable(true)
NOABGUI:SetDeleteOnClose(false)
NOABGUI:MakePopup()
DCheckBox2 = vgui.Create('DCheckBoxLabel')
DCheckBox2:SetPos(267, 233)
DCheckBox2:SetText('kill')
DCheckBox2.DoClick = function()
RunConsoleCommand("kill")
end
end
concommand.Add("menutest", testframe) -- adding the console command
end
[/code]
] menutest
Unknown Command: 'menutest'
I'm attempting to make a GUI, i made for my own server and the derma isn't working. Can anyone tell me what's wrong with this?
ignore the "kill" function on the checkbox[/QUOTE]
the code isn't running at all, or it's being ran on the server, because it doesnt make it all the way to concommand.Add.
[QUOTE=skar;37619075]the code isn't running at all, or it's being ran on the server, because it doesnt make it all the way to concommand.Add.[/QUOTE]
It's in my lua/autorun folder and I'm playing singleplayer, if that helps.
there's likely a lua error somewhere then
thats why I posted the code. I don't get what I did wrong
[QUOTE=zerothefallen;37618848]-menu stuff-[/QUOTE]
[code]
if not CLIENT then return end
local cbox, dpanel
local function testframe()
dpanel = vgui.Create( "DFrame" )
dpanel:SetSize( 530, 446 )
dpanel:SetSizable( 1 )
dpanel:Center()
dpanel:SetTitle( "NK Cheat" )
dpanel:SetDeleteOnClose( 0 )
dpanel:MakePopup()
--[[
dbutton = vgui.Create( "DButton", dpanel )
dbutton:SetPos( 267, 233 )
dbutton:SetSize( 100, 100 )
dbutton:SetText( "Kill" )
dbutton.DoClick = function()
RunConsoleCommand( "kill" )
end
]]--
cbox = vgui.Create( "DCheckBoxLabel", dpanel )
cbox:SetPos( 267, 233 )
cbox:SetSize( 100, 100 )
cbox:SetText( "Kill" )
cbox.OnChange = function()
RunConsoleCommand( "kill" )
end
end
concommand.Add( "menutest", testframe )
[/code]
Just out of curiosity, is it possible to change the viewmodel and model of a SWEP mid-game?
[QUOTE]
Couldn't include file 'nb\gamemode\cl_init.lua' (File not found) (<nowhere>)
[cpp] Couldn't Load Init Script: 'nb/gamemode/cl_init.lua'[/QUOTE]
Why am I getting this? I created a SRCDS server which I can join and works fine with sandbox. I wanted to create my own gamemode, so I made the appropriate files following the new gmod13 guidelines. Once I change the gamemode in the SRCDS console "Gamemode nb" it changes over fine. Although when I try to join the server I get presented with that main error and a barrage more of other random ones. Here is a picture of all my files, folders, and errors. Please help. (:
[IMG]http://i.imgbox.com/acqvYXbL.png[/IMG]
Hey, I'm having this problem, I've been trying to make a menu where when you spawn, this Derma menu comes up, but when the Derma menu runs it says the "BackGround" Is a nil value.
[CODE]
function Rulesmenu()
local BackGround = vgui.Create( "Dframe" )
BackGround:SetSize( 200, 90 )
BackGround:SetPos( (ScrW()/2)-BackGround:GetWide(),(ScrH()/2)-BackGround:GetTall() )
BackGround:SetVisible( true )
BackGround:SetDraggable( true )
BackGround:ShowCloseButton( true )
BackGround:MakePopup()
local ply = LocalPlayer()
local RulesTab = vgui.Create( "DPaneList", BackGround )
RulesTab:EnableVerticalScrollbar( true )
RulesTab:SetTitle( "Rules" )
RulesTab:SetImage( "gui/silkicons/exclamation" )
function RulesTab:Update()
local GenCat = vgui.Create("DCollapsibleCategory")
GenCat:SetLabel("General Rules")
local General = vgui.Create("DPanelList", GenCat)
General:SetSpacing(5)
General:SetSize(740,60)
General:EnableHorizontal(false)
General:EnableVerticalScrollbar(true)
local GeneralCategory = vgui.Create("DLabel")
GeneralCategory:SetPos(1,1) // Position
GeneralCategory:SetColor(Color(255,255,255,255)) // Color
GeneralCategory:SetFont("default")
GeneralCategory:SetText([[1. Don't random death-match
-Definition of RDM follows-
Killing someone on random impulse, if someone
isn't threatening your or is tresspassing, you
may not kill them. If someone is constantly harassing
you, attack them at your discretion.
2. Obey NLR, the NLR wait time is 2 minutes
3. Do not minge around with props, you know what that is, this includes propclimb.
4. Do not use hacks, or addons that give you an unfair advantage.
5. Respect others despite their age, affiliation, race, gender, or sexual oriantation.
6. Do not spam props, or entities.]]) // Text
GeneralCategory:SizeToContents() // make the control the same size as the text.
end
end
concommand.Add( "open_RulesMenu", RulesMenu )[/code]
[QUOTE=find me;37620767]Why am I getting this? I created a SRCDS server which I can join and works fine with sandbox. I wanted to create my own gamemode, so I made the appropriate files following the new gmod13 guidelines. Once I change the gamemode in the SRCDS console "Gamemode nb" it changes over fine. Although when I try to join the server I get presented with that main error and a barrage more of other random ones. Here is a picture of all my files, folders, and errors. Please help. (:[/QUOTE]
AddCSLuaFile( "nb/gamemode/cl_init.lua" )
AddCSLuaFile( "nb/gamemode/shared.lua" )
include( "nb/gamemode/shared.lua" )
[QUOTE=Drakehawke;37621847]AddCSLuaFile( "nb/gamemode/cl_init.lua" )
AddCSLuaFile( "nb/gamemode/shared.lua" )
include( "nb/gamemode/shared.lua" )[/QUOTE]
Just tried that, still no luck.
Thanks anyways.
[editline]11th September 2012[/editline]
[QUOTE=Crossu88;37621699]Hey, I'm having this problem, I've been trying to make a menu where when you spawn, this Derma menu comes up, but when the Derma menu runs it says the "BackGround" Is a nil value.
*CODE*
[/QUOTE]
[LUA]
function Rulesmenu()
local BackGround = vgui.Create( "Dframe" ) --Capitalize the F in "DFrame".
BackGround:SetSize( 200, 90 )
BackGround:SetPos( (ScrW()/2)-BackGround:GetWide(),(ScrH()/2)-BackGround:GetTall() )
BackGround:SetVisible( true )
BackGround:SetDraggable( true )
BackGround:ShowCloseButton( true )
BackGround:MakePopup()
local ply = LocalPlayer()
local RulesTab = vgui.Create( "DPaneList", BackGround ) --You forgot to add an l in "DPanelList"
RulesTab:EnableVerticalScrollbar( true )
RulesTab:SetTitle( "Rules" ) --SetTitle doesn't work for a DPanelList, but it does for a DFrame.
RulesTab:SetImage( "gui/silkicons/exclamation" ) --SetImage only works with a DButton or DImage.
function RulesTab:Update() --I'm sure there is more wrong with your code but you would be better off just doing what I've suggested below.
local GenCat = vgui.Create("DCollapsibleCategory")
GenCat:SetLabel("General Rules")
local General = vgui.Create("DPanelList", GenCat)
General:SetSpacing(5)
General:SetSize(740,60)
General:EnableHorizontal(false)
General:EnableVerticalScrollbar(true)
local GeneralCategory = vgui.Create("DLabel")
GeneralCategory:SetPos(1,1) // Position
GeneralCategory:SetColor(Color(255,255,255,255)) // Color
GeneralCategory:SetFont("default")
GeneralCategory:SetText([[1. Don't random death-match
-Definition of RDM follows-
Killing someone on random impulse, if someone
isn't threatening your or is tresspassing, you
may not kill them. If someone is constantly harassing
you, attack them at your discretion.
2. Obey NLR, the NLR wait time is 2 minutes
3. Do not minge around with props, you know what that is, this includes propclimb.
4. Do not use hacks, or addons that give you an unfair advantage.
5. Respect others despite their age, affiliation, race, gender, or sexual oriantation.
6. Do not spam props, or entities.]]) // Text
GeneralCategory:SizeToContents() // make the control the same size as the text.
end
end
concommand.Add( "open_RulesMenu", RulesMenu )
[/LUA]
A lot of what you are trying to do will not work with what you have right now. You are mixing derma controls with other ones and not capitalizing/spelling things right. If you want to make a simple rules menu, I suggest you look a little more in depth about the derma controls I list below and start over.
[URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexc281.html"]DFrame[/URL] Make your main menu with this.
[URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexcc5c.html"]DPanelList[/URL] Put this inside of your main menu.
[URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index1fc7.html"]DLabel[/URL] Make one of these for each rule and put them in your 'DPanelList'.
I'm trying to make a tab with collapsible categories for each rule section, then a tab for donation, then everything else.
I have a [b]brush based entity[/b] and [b]it moves[/b] even though I have run self:SetMoveType(MOVETYPE_NONE)
It moves when I jump into it, to be more specific, the model, the visual part, doesn't move, however It is playing the noises as though it is moving, and I know the collision box has moved, because I tested it with an entity.
Is there a way to either stop physical forces from pushing it, or just out right stop movement, or freeze it?
Added note, it is a brushed based entity, and I am running:
self:PhysicsInit(SOLID_BSP)
self:SetMoveType(MOVETYPE_NONE)
self:SetSolid(SOLID_BSP)
Hi, not a lua question as such but it affects my project.
I want to use some code from Wenli's Precision Alignment tool (the mirroring functions) But I noticed that the code is GPLv3 licensed. What's the proper way of attributing that portion of code to him in my project? Google turned up nothing useful, surprisingly.
[QUOTE=find me;37620767]Why am I getting this? I created a SRCDS server which I can join and works fine with sandbox. I wanted to create my own gamemode, so I made the appropriate files following the new gmod13 guidelines. Once I change the gamemode in the SRCDS console "Gamemode nb" it changes over fine. Although when I try to join the server I get presented with that main error and a barrage more of other random ones. Here is a picture of all my files, folders, and errors. Please help. (:
[IMG]http://i.imgbox.com/acqvYXbL.png[/IMG][/QUOTE]
Have you tried changing "Gamemode" to "nb" in the nb.txt?
Can somebody confirm that this function would properly update a server's SQL? It's running in the init.lua of a GMod13 gamemode.
[lua]
function saveStat(ply)
net.Receive("SQLmoney", function(msglength, ply)
steamID = ply:SteamID()
net.ReadInt(money)
sql.Query("UPDATE player_info SET money = "..money.." WHERE steam_id = '"..steamID.."'")
end)
net.Receive("SQLrpname", function(msglength, ply)
steamID = ply:SteamID()
net.ReadString(rpname)
sql.Query("UPDATE player_info SET rpname = "..rpname.." WHERE steam_id = '"..steamID.."'")
end)
net.Receive("SQLexperience", function(msglength, ply)
steamID = ply:SteamID()
net.ReadInt(experience)
sql.Query("UPDATE player_info SET experience = "..experience.." WHERE steam_id = '"..steamID.."'")
end)
net.Receive("SQLcorporation", function(msglength, ply)
steamID = ply:SteamID()
net.ReadString(corporation)
sql.Query("UPDATE player_info SET corporation = "..corproation.." WHERE steam_id = '"..steamID.."'")
end)
Msg("Stats updated!\n")
for k, v in pairs(player.GetAll()) do
local steamID = v:SteamID()
net.Start("SQLcorporationToClient")
local clientcorporation = sql.Query("SELECT corporation FROM player_info WHERE steam_id = '"..steamID.."'")
net.WriteString(clientcorporation)
net.Send(v)
net.Start("SQLmoneyToClient")
local clientmoney = sql.Query("SELECT money FROM player_info WHERE steam_id = '"..steamid.."'")
net.WriteInt(clientmoney)
net.Send(v)
net.Start("SQLrpnameToClient")
local clientrpname = sql.Query("SELECT rpname FROM player_info WHERE steam_id = '"..steamid.."'")
net.WriteString(clientrpname)
net.Send(v)
net.Start("SQLexperienceToClient")
local clientexperience = sql.Query("SELECT experience FROM player_info WHERE steam_id = '"..steamid.."'")
net.WriteInt(clientexperience)
net.Send(v)
end
Msg("Client stats updated!\n")
end
[/lua]
Thanks in advance.
[QUOTE=Nalestom;37628834]Can somebody confirm that this function would properly update a server's SQL? It's running in the init.lua of a GMod13 gamemode.
[lua]
function saveStat(ply)
net.Receive("SQLmoney", function(msglength, ply)
steamID = ply:SteamID()
net.ReadInt(money)
sql.Query("UPDATE player_info SET money = "..money.." WHERE steam_id = '"..steamID.."'")
end)
net.Receive("SQLrpname", function(msglength, ply)
steamID = ply:SteamID()
net.ReadString(rpname)
sql.Query("UPDATE player_info SET rpname = "..rpname.." WHERE steam_id = '"..steamID.."'")
end)
net.Receive("SQLexperience", function(msglength, ply)
steamID = ply:SteamID()
net.ReadInt(experience)
sql.Query("UPDATE player_info SET experience = "..experience.." WHERE steam_id = '"..steamID.."'")
end)
net.Receive("SQLcorporation", function(msglength, ply)
steamID = ply:SteamID()
net.ReadString(corporation)
sql.Query("UPDATE player_info SET corporation = "..corproation.." WHERE steam_id = '"..steamID.."'")
end)
Msg("Stats updated!\n")
for k, v in pairs(player.GetAll()) do
local steamID = v:SteamID()
net.Start("SQLcorporationToClient")
local clientcorporation = sql.Query("SELECT corporation FROM player_info WHERE steam_id = '"..steamID.."'")
net.WriteString(clientcorporation)
net.Send(v)
net.Start("SQLmoneyToClient")
local clientmoney = sql.Query("SELECT money FROM player_info WHERE steam_id = '"..steamid.."'")
net.WriteInt(clientmoney)
net.Send(v)
net.Start("SQLrpnameToClient")
local clientrpname = sql.Query("SELECT rpname FROM player_info WHERE steam_id = '"..steamid.."'")
net.WriteString(clientrpname)
net.Send(v)
net.Start("SQLexperienceToClient")
local clientexperience = sql.Query("SELECT experience FROM player_info WHERE steam_id = '"..steamid.."'")
net.WriteInt(clientexperience)
net.Send(v)
end
Msg("Client stats updated!\n")
end
[/lua]
Thanks in advance.[/QUOTE]
That makes absolutely no sense. Why are you creating those net.Receive hooks?
You could just get the money etc. serverside?
[lua] net.Receive("SQLmoney", function(msglength, ply)
steamID = ply:SteamID()
net.ReadInt(money)
sql.Query("UPDATE player_info SET money = "..money.." WHERE steam_id = '"..steamID.."'")
end)[/lua]
What are you smoking?
This will never work.
[QUOTE=Nalestom;37628834]
[lua]
net.Receive("SQLrpname", function(msglength, ply)
steamID = ply:SteamID()
net.ReadString(rpname)
sql.Query("UPDATE player_info SET rpname = "..rpname.." WHERE steam_id = '"..steamID.."'")
end)
[/lua]
[/QUOTE]
Now i'm not an sql expert, but;
rpname = "lmao' WHERE steam_id = 'lol'; DROP TABLE player_info; --"
fun with sql :v:
Don't rely on the client to sanitize your database input, motivated clients can bypass that.
Also can anyone answer this question;
Given a plane normal vector, how do I get an Angle perpendicular to the normal (e.g. forward vector parallel with plane, up vector parallel to normal)?
[QUOTE=Splambob;37629851]Now i'm not an sql expert, but;
rpname = "lmao' WHERE steam_id = 'lol'; DROP TABLE player_info; --"
fun with sql :v:
Don't rely on the client to sanitize your database input, motivated clients can bypass that.
Also can anyone answer this question;
Given a plane normal vector, how do I get an Angle perpendicular to the normal (e.g. forward vector parallel with plane, up vector parallel to normal)?[/QUOTE]
Always treat the client like your worst enemy.
(Be careful)
[QUOTE=Splambob;37629851]
Also can anyone answer this question;
Given a plane normal vector, how do I get an Angle perpendicular to the normal (e.g. forward vector parallel with plane, up vector parallel to normal)?[/QUOTE]
Having a hard time understanding what you need, could you please give a more clear example?
I have a mirror-plane defined by a normal vector and a center position. I want to get [i]any[/i] angle which points along the plane, and respects the normal direction.
Ex; If I use angle:Forward(), I want that vector to be parallel to the plane's surface. If I use angle:Up(), I want that vector to be parallel to the plane's normal vector. Doesn't matter what particular direction angle:Forward() points along the plane, as long as angle:Up() is correct.
If I was using E2 I could use quat(vec(1,0,0), normal):toAngle() but I don't think GLua has a quaternion library. :v:
[QUOTE=Splambob;37630310]If I was using E2 I could use quat(vec(1,0,0), normal):toAngle() but I don't think GLua has a quaternion library. :v:[/QUOTE]
You could find out what E2 does when you run those functions and use the same code, but that might be a lot of unecessary code
Yeah very true but I was thinking the same thing. Wanted to know if there was some obvious thing I was missing before I resorted to quats :v:
[QUOTE=ollie;37629309]That makes absolutely no sense. Why are you creating those net.Receive hooks?
You could just get the money etc. serverside?[/QUOTE]
[quote=vercas]What are you smoking?
This will never work.[/quote]
Lua is my first programming language, as I'm learning completely from scratch for a school project. That would explain why none of the code really makes sense - it's because I'm quite a beginner.
What I'm trying to do is allow the server to accept net messages from client-side scripts, then write that message directly to the SQL. I realize that it's an insecure way to do it, but at the moment, I'm just trying to get it to work - I'll work on security later.
What's the best way to go about this using the net library?
From my understanding, defending against SQL injection is easy if you use the provided string sanitizer function. Try using [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexce94.html]G.SQLStr[/url] to stop people like me deleting all your player records :v:
Ohai, i have a problem.. in my stool i have a function called drawGuis() which deletes DPan if it exists, and then creates DFrame "DPan" using vgui.Create.
after the script runs through for the first time, and it calls drawGuis() after creating main context menu cpanel, the drawGuis() works flawlessly.
when i press enter in a text box in the gui, and it calls TextTick() which calls drawGuis() it works flawlessly.
the problem i have is
when i call drawGuis() after you have left clicked with the tool, it totally starts to flip its shit.
it says DPan is nil even though it is clearly there. After that it tries to create the DPan with vgui.Create
it says global vgui is a nil value (wut) and absolutely no functions in the drawGuis() work.
also the tool will break after that.
how come i can call the function drawGui() after the main gui has been created, and through another function after i have pressed enter on a box, but on left click it totally breaks?
[QUOTE=TNOMCat;37632179]Ohai, i have a problem.. in my stool i have a function called drawGuis() which deletes DPan if it exists, and then creates DFrame "DPan" using vgui.Create.
after the script runs through for the first time, and it calls drawGuis() after creating main context menu cpanel, the drawGuis() works flawlessly.
when i press enter in a text box in the gui, and it calls TextTick() which calls drawGuis() it works flawlessly.
the problem i have is
when i call drawGuis() after you have left clicked with the tool, it totally starts to flip its shit.
it says DPan is nil even though it is clearly there. After that it tries to create the DPan with vgui.Create
it says global vgui is a nil value (wut) and absolutely no functions in the drawGuis() work.
also the tool will break after that.
how come i can call the function drawGui() after the main gui has been created, and through another function after i have pressed enter on a box, but on left click it totally breaks?[/QUOTE]
Looks like you're calling drrawGuis serverside. Your menu doesn't exist on the server, only the client
Sorry, you need to Log In to post a reply to this thread.