• What do you need help with? V3
    6,419 replies, posted
This problem has only occurred in the GM13 beta, but I dont know how to fix it. This happens on all the map's I have tried with my gamemode. [img]http://cloud.steampowered.com/ugc/504639052636532739/BFDA3C426EDC806A49C2DA6D1D0BEA4F350D4CA7/[/img]
[QUOTE=Dorkslayz;34757402]This problem has only occurred in the GM13 beta, but I dont know how to fix it. This happens on all the map's I have tried with my gamemode. [img]http://cloud.steampowered.com/ugc/504639052636532739/BFDA3C426EDC806A49C2DA6D1D0BEA4F350D4CA7/[/img][/QUOTE] Are you doing anything that changes your skybox in your code? Like moving env_sun etc? Anyway, I'm finding no sense in this what-so-ever. I have tried adding another tool like this: [lua] ToolList["Stuff"][1] = { Controls = "color", ItemName = "color", Command = "gmod_tool color", Text = "#Color" } [/lua] And this is one which was already made: [lua] ToolList["Constraints"][1] = { Controls = "axis", ItemName = "axis", Command = "gmod_tool axis", Text = "#Axis" } [/lua] Yes, the Stuff menu does exist. The tool shows but there is no options for the tool's. Well the tool itself works, however there is no options to change anything, it's just grey. (Floodmod).
[QUOTE=Mrkrabz;34757536]Are you doing anything that changes your skybox in your code? Like moving env_sun etc? Anyway, I'm finding no sense in this what-so-ever. I have tried adding another tool like this: [lua] ToolList["Stuff"][1] = { Controls = "color", ItemName = "color", Command = "gmod_tool color", Text = "#Color" } [/lua] And this is one which was already made: [lua] ToolList["Constraints"][1] = { Controls = "axis", ItemName = "axis", Command = "gmod_tool axis", Text = "#Axis" } [/lua] Yes, the Stuff menu does exist. The tool shows but there is no options for the tool's.[/QUOTE] As far as I remember, im not.
Mrkrabz: you probably need to supply the CPanel building tool, since I think color doesn't use txt files for controls.
I suppose there isn't an opposite function of [I]GM:PlayerSpawnedProp( Player ply, String model, Entity ent )[/I]? Any tips on how to make one? e.g PlayerUndoProp or PlayerRemoveProp?
[QUOTE=Panto;34757730]I suppose there isn't an opposite function of [I]GM:PlayerSpawnedProp( Player ply, String model, Entity ent )[/I]? Any tips on how to make one? e.g PlayerUndoProp or PlayerRemoveProp?[/QUOTE] Hook OnEntityRemoved and compare to see if the ent is a prop_physics
I keep getting this error when the VGUI is meant to appear within my gamemode. [code] Hook 'CharacterPanels' Failed: attempt to index local 'characterPanel' (a nil value) [/code] the code for the section is [lua] local characterPanel = vgui.Create( "DFrame" ) characterPanel:SetPos( ScrW() / 4, ScrH() / 4 ) characterPanel:SetSize( 800, 570 ) characterPanel:SetTitle( "Character Creation" ) characterPanel:SetVisible( true ) characterPanel:SetDraggable( false ) characterPanel:ShowCloseButton( false ) characterPanel:Show() [/lua] and the hook code is [lua] hook.Add( "InitPostEntity", "CharacterPanels", CreateCharacterPanels ) [/lua]
My Collapsible category won't display correct: [URL=http://www.imagebanana.com/view/p20grnd7/Untitled.png][IMG]http://img7.imagebanana.com/img/p20grnd7/thumb/Untitled.png[/IMG][/URL] It seems as it's not opening rather just moving when you select it. This is the code of one of my category. [lua] self.PropsCatD = vgui.Create( "DCollapsibleCategory" ) self.PropsCatD:SetSize( (self.LeftX - 10), self.MY ) self.PropsCatD:SetLabel( "Miscellaneus Props" ) self.PropsContD = vgui.Create( "DPanelList" ) self.PropsContD:EnableHorizontal(true) self.PropsContD:SetAutoSize( true ) self.PropsContD:SetSpacing( 5 ) self.PropsContD:SetPadding( 5 ) self.PropsCatD:SetContents( self.PropsContD ) self.PropsBackground:AddItem( self.PropsCatD ) [/lua] [lua] self.MX = self:GetWide() self.MY = self:GetTall() self.LeftX = (math.floor((self.MX/2 - 10)/66) * 66) + 11 [/lua]
Hi, I've run into a question nobody is able to answer or take the time to answer. Using the TDMcars, some car material skins would jump from 12, suddenly to have 26 files. those extra 14 files don't exist. But this causes a problem, for e.g. If i use skin3.vmt it would apply skin1.vmt and wouldn't allow the use of some skins at all. I've got everything setup properly works fine with other cars except certain one's like the murcielago.
[lua] function MyCalcView(ply, pos, angles, fov) local view = {} view.origin = pos-(angles:Forward()*100) view.angles = angles view.fov = fov return view end hook.Add("CalcView", "MyCalcView", MyCalcView) hook.Add("ShouldDrawLocalPlayer", "MyHax ShouldDrawLocalPlayer", function(ply) return true end) [/lua] How would I get this camera to face my frontside? I tried reversing it and that didn't quite work.
[code][@lua\autorun\server\test.lua:19] bad key to string index (number expected, got string)[/code] [lua] -- Line 19 -- -- GetRoleString() is valid (From TTT) Message = d .. ";;" .. v:Name() .. " [" .. v:GetRoleString() .. "]" .. " was killed by " .. k:Name() .. " [" .. k:GetRoleString() .. "]" .. " using " .. w:GetClass() [/lua]
[QUOTE=Persious;34764445][code][@lua\autorun\server\test.lua:19] bad key to string index (number expected, got string)[/code] [lua] -- Line 19 -- -- GetRoleString() is valid (From TTT) Message = d .. ";;" .. v:Name() .. " [" .. v:GetRoleString() .. "]" .. " was killed by " .. k:Name() .. " [" .. k:GetRoleString() .. "]" .. " using " .. w:GetClass() [/lua][/QUOTE] I think that means either v, k or w is a string. I could be wrong though, I've only seen that error once before and that's what my problem was, however the error doesn't really imply that at all.
You were more or less right. I got it working now. It seem'd like w was acting dumb, so I just changed it to my old way.
function MyCalcView(ply, pos, angles, fov) local view = {} view.origin = pos-(angles:Forward()*100) view.angles = angles view.fov = fov return view end hook.Add("CalcView", "MyCalcView", MyCalcView) hook.Add("ShouldDrawLocalPlayer", "MyHax ShouldDrawLocalPlayer", function(ply) return true end) [/lua] How would I get this camera to face my frontside? I tried reversing it and that didn't quite work.
[QUOTE=brandonj4;34763988][lua] function MyCalcView(ply, pos, angles, fov) local view = {} view.origin = pos-(angles:Forward()*100) view.angles = angles view.fov = fov return view end hook.Add("CalcView", "MyCalcView", MyCalcView) hook.Add("ShouldDrawLocalPlayer", "MyHax ShouldDrawLocalPlayer", function(ply) return true end) [/lua] How would I get this camera to face my frontside? I tried reversing it and that didn't quite work.[/QUOTE] view.angles = (ply:EyePos() - view.origin):Angle()
Reposting this, new page. I keep getting this error when the VGUI is meant to appear within my gamemode. [code] Hook 'CharacterPanels' Failed: attempt to index local 'characterPanel' (a nil value) [/code] the code for the section is [lua] local characterPanel = vgui.Create( "DFrame" ) characterPanel:SetPos( ScrW() / 4, ScrH() / 4 ) characterPanel:SetSize( 800, 570 ) characterPanel:SetTitle( "Character Creation" ) characterPanel:SetVisible( true ) characterPanel:SetDraggable( false ) characterPanel:ShowCloseButton( false ) characterPanel:Show() [/lua] and the hook code is [lua] hook.Add( "InitPostEntity", "CharacterPanels", CreateCharacterPanels ) [/lua] It worked fine before the gmod beta.
Try creating it after the first think call? (Can do this by using a timer)
So, how would I go on about running a .lua file in a server specified in a data (.txt) file? [b][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index33a2-2.html?title=Game.ConsoleCommand]Game.ConsoleCommand [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] Says here that I can't run "lua_openscript" so my idea is obsolete?
Why don't you just do RunString(file.Read("whatever.txt", "DATA"))?
[QUOTE=GranPC;34770453]Why don't you just do RunString(file.Read("whatever.txt", "DATA"))?[/QUOTE] Ok, I'll try that.
OK so this isn't entirely for Garry's Mod but I figured this would be the best place to ask. [lua] math.randomseed(os.time()) inc = math.random(-200,200) [/lua] This always generates the lowest number (-200 in this case). I've tried doing it without a seed and also with non-negative number but it always returns the lowest number.
[QUOTE=leontodd;34770528]OK so this isn't entirely for Garry's Mod but I figured this would be the best place to ask. [lua] math.randomseed(os.time()) inc = math.random(-200,200) [/lua] This always generates the lowest number (-200 in this case). I've tried doing it without a seed and also with non-negative number but it always returns the lowest number.[/QUOTE] Not that convenient but try this [lua] math.randomseed(os.time()) inc = math.random(0,400)-200 [/lua]
[QUOTE=Mrkrabz;34761205]My Collapsible category won't display correct: [URL=http://www.imagebanana.com/view/p20grnd7/Untitled.png][IMG]http://img7.imagebanana.com/img/p20grnd7/thumb/Untitled.png[/IMG][/URL] It seems as it's not opening rather just moving when you select it. This is the code of one of my category. [lua] self.PropsCatD = vgui.Create( "DCollapsibleCategory" ) self.PropsCatD:SetSize( (self.LeftX - 10), self.MY ) self.PropsCatD:SetLabel( "Miscellaneus Props" ) self.PropsContD = vgui.Create( "DPanelList" ) self.PropsContD:EnableHorizontal(true) self.PropsContD:SetAutoSize( true ) self.PropsContD:SetSpacing( 5 ) self.PropsContD:SetPadding( 5 ) self.PropsCatD:SetContents( self.PropsContD ) self.PropsBackground:AddItem( self.PropsCatD ) [/lua] [lua] self.MX = self:GetWide() self.MY = self:GetTall() self.LeftX = (math.floor((self.MX/2 - 10)/66) * 66) + 11 [/lua][/QUOTE] Bump from other page.
[QUOTE=leontodd;34770528]OK so this isn't entirely for Garry's Mod but I figured this would be the best place to ask. [lua] math.randomseed(os.time()) inc = math.random(-200,200) [/lua] This always generates the lowest number (-200 in this case). I've tried doing it without a seed and also with non-negative number but it always returns the lowest number.[/QUOTE] [url]http://codepad.org/yR7oF2qk[/url] Take a look, and guess the error. Took ages to make that on my phone..
[QUOTE=aurum481;34770810]Not that convenient but try this [lua] math.randomseed(os.time()) inc = math.random(0,400)-200 [/lua][/QUOTE] Thanks! [editline]19th February 2012[/editline] [QUOTE=Trivkz;34770939][url]http://codepad.org/yR7oF2qk[/url] Take a look, and guess the error. Took ages to make that on my phone..[/QUOTE] os.time() is the same on the first two?
[QUOTE=leontodd;34770943]Thanks! [editline]19th February 2012[/editline] os.time() is the same on the first two?[/QUOTE] When you run the script the variable "inc" is set, so when you try to use "inc" it will always be the same ( so yeah )
[QUOTE=Mrkrabz;34770908]Bump from other page.[/QUOTE] You need to set the parent, try to change [lua]vgui.Create( "DPanelList" )[/lua] to [lua]vgui.Create( "DPanelList", self.PropsCatD )[/lua]
[QUOTE=matyas;34771013]You need to set the parent, try to change [lua]vgui.Create( "DPanelList" )[/lua] to [lua]vgui.Create( "DPanelList", self.PropsCatD )[/lua][/QUOTE] Didn't seem to work. It's positioned fine, just not opening or something. [lua] FloodMenu = self self:SetTitle("") self:ShowCloseButton(false) self:SetPos(ScrW()/16, ScrH()/8) self:SetSize(ScrW() - (ScrW()/8), ScrH() - (ScrH()/4)) self:SetVisible(false) self.MX = self:GetWide() self.MY = self:GetTall() self.LeftX = (math.floor((self.MX/2 - 10)/66) * 66) + 11 self.KeyboardFocus = false self.LeftTabs = vgui.Create("DPropertySheet") self.LeftTabs:SetParent(FloodMenu) self.LeftTabs:SetPos(0, 0) self.LeftTabs:SetSize(self.LeftX, self.MY) self.RightTabs = vgui.Create("DPropertySheet") self.RightTabs:SetParent(FloodMenu) self.RightTabs:SetPos(self.MX/2, 0) self.RightTabs:SetSize(self.MX/2, self.MY) self.PropsBackground = vgui.Create("DPanelList") self.PropsBackground:SetPos(0, 0) self.PropsBackground:SetSize(self.LeftTabs:GetWide() - 8, self.LeftTabs:GetTall()) self.PropsBackground:SetPadding(2) self.PropsBackground:SetSpacing(2) self.PropsBackground:EnableHorizontal(true) self.PropsBackground:EnableVerticalScrollbar(true) self.PropsCatA = vgui.Create( "DCollapsibleCategory" ) self.PropsCatA:SetSize( (self.LeftX - 10), 100 ) self.PropsCatA:SetLabel( "Wooden Props" ) self.PropsContA = vgui.Create( "DPanelList" ) self.PropsContA:EnableHorizontal(true) self.PropsContA:SetAutoSize( true ) self.PropsContA:SetSpacing( 5 ) self.PropsContA:SetPadding( 5 ) self.PropsCatA:SetContents( self.PropsContA ) self.PropsBackground:AddItem( self.PropsCatA ) self.PropsCatB = vgui.Create( "DCollapsibleCategory" ) self.PropsCatB:SetSize( (self.LeftX - 10), self.MY ) self.PropsCatB:SetLabel( "Plastic Props" ) self.PropsContB = vgui.Create( "DPanelList" ) self.PropsContB:EnableHorizontal(true) self.PropsContB:SetAutoSize( true ) self.PropsContB:SetSpacing( 5 ) self.PropsContB:SetPadding( 5 ) self.PropsCatB:SetContents( self.PropsContB ) self.PropsBackground:AddItem( self.PropsCatB ) self.PropsCatC = vgui.Create( "DCollapsibleCategory" ) self.PropsCatC:SetSize( (self.LeftX - 10), self.MY ) self.PropsCatC:SetLabel( "Metal Props" ) self.PropsContC = vgui.Create( "DPanelList" ) self.PropsContC:EnableHorizontal(true) self.PropsContC:SetAutoSize( true ) self.PropsContC:SetSpacing( 5 ) self.PropsContC:SetPadding( 5 ) self.PropsCatC:SetContents( self.PropsContC ) self.PropsBackground:AddItem( self.PropsCatC ) self.PropsCatD = vgui.Create( "DCollapsibleCategory" ) self.PropsCatD:SetSize( (self.LeftX - 10), self.MY ) self.PropsCatD:SetLabel( "Miscellaneus Props" ) self.PropsContD = vgui.Create( "DPanelList" ) self.PropsContD:EnableHorizontal(true) self.PropsContD:SetAutoSize( true ) self.PropsContD:SetSpacing( 5 ) self.PropsContD:SetPadding( 5 ) self.PropsCatD:SetContents( self.PropsContD ) self.PropsBackground:AddItem( self.PropsCatD ) [/lua] Here is more of the code.
-snip-
[code][lua\includes\modules\usermessage.lua:87] attempt to call field 'Function' (a nil value)[/code] Last thing I did was this: [lua] local Message = Format("%s;;%s [%s] was attacked by %s [%s] for %s HP", d, v:Nick(), v:GetRoleString(), k:Nick(), k:GetRoleString(), amount) umsg.Start( "umsgRecieveDmg", pl ) umsg.String( Message ) umsg.End( ) [/lua]
Sorry, you need to Log In to post a reply to this thread.