• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
[QUOTE=EthanTheGreat;45714827]-snip-[/QUOTE] So what's the problem?
[QUOTE=Acecool;45714758]longest posted ever[/QUOTE] You should probably create a single dropbox file with all of that information so that when you need to post it again it doesn't take 3 pages of space. Also, congrats on thread post #666.
[QUOTE=Revenge282;45714112]C# is pretty much Win only, sans Mono.[/QUOTE] What's wrong with Mono?
How to use input.IsKeyDown to open a Derma panel so that it wont spam it open 10 times?
[QUOTE=Exho;45719967]How to use input.IsKeyDown to open a Derma panel so that it wont spam it open 10 times?[/QUOTE] [code] lastTime = CurTime() - 0.2 if input.IsKeyDown(KEY) and CurTime() - lastPress > 0.1 then -- code lastPress = CurTime() end [/code]
[QUOTE=AnonTakesOver;45720125][code] lastTime = CurTime() - 0.2 if input.IsKeyDown(KEY) and CurTime() - lastPress > 0.1 then -- code lastPress = CurTime() end [/code][/QUOTE] Or check if the panel object is nil. [lua] local pnl if input.IsKeyDown( KEY ) and not pnl then pnl = vgui.Create( "DFrame" ) -- code end [/lua]
Edit: I am a moron.... Thanks for helping!
[QUOTE=cartman300;45716466]What's wrong with Mono?[/QUOTE] There's nothing wrong with it, it's just that to get C# running outside Windows, you have to have some kind of middleman software. Not really [I]ideal[/I], but it works nicely when you only know C#. I just wish they would push C++ more in school classes. At FSU, unless you go deep into Comp Sci, they try to push you into the C#/Java area, and I think that is kind of dodging bullets.
[QUOTE=Revenge282;45720844]There's nothing wrong with it, it's just that to get C# running outside Windows, you have to have some kind of middleman software. Not really [I]ideal[/I], but it works nicely when you only know C#. I just wish they would push C++ more in school classes. At FSU, unless you go deep into Comp Sci, they try to push you into the C#/Java area, and I think that is kind of dodging bullets.[/QUOTE] C#/Java is what they teach the Computer Science kids at my school as well.
[QUOTE=Exigent;45721066]C#/Java is what they teach the Computer Science kids at my school as well.[/QUOTE] I started doing C++ in school here last year. We should probably bring this thread back on topic now.
[code] [ERROR] expected near '[' 1. unknown - addons/class mod/lua/autorun/server/sv_class_spawn.lua:0 [/code] I don't understand this error whatsoever Is it because I'm making tables like Table[1]["string"] = "thing"
[QUOTE=ROFLBURGER;45721967]Is it because I'm making tables like Table[1]["string"] = "thing"[/QUOTE] Assuming the table structure is setup then it should work. Do you have something along the lines of this? [code] Table = {} Table[1] = {} Table[1]["string"] = "thing" [/code] However, are you sure you're trying to setup a table within a table with the key, string, set to thing. If you're just trying to store value "thing" under the key "string" in the Table variable you'll want this: [code] Table = {} Table["string"] = "thing" [/code]
[QUOTE=ROFLBURGER;45721967][code] [ERROR] expected near '[' 1. unknown - addons/class mod/lua/autorun/server/sv_class_spawn.lua:0 [/code] I don't understand this error whatsoever Is it because I'm making tables like Table[1]["string"] = "thing"[/QUOTE] You'll have to show the code that is causing the error.
I've been having a few problems since around June (I'm a lazy man.) The first two images show that halos appear around every entity. The second two show that when I look at the vent cover on de_prodigy the screen goes entirely black. This affects everyone on the server, and only on the server. [url=http://imgur.com/a/zt9el]Images here[/url]
[QUOTE=zeaga;45725194]I've been having a few problems since around June (I'm a lazy man.) The first two images show that halos appear around every entity. The second two show that when I look at the vent cover on de_prodigy the screen goes entirely black. This affects everyone on the server, and only on the server. [url=http://imgur.com/a/zt9el]Images here[/url][/QUOTE] Update your server
I realize this is an old bug, fixed a few months ago. I have indeed updated my server since it was fixed. It's still affecting my server for some reason.
-snip- Lua errors weren't showing up
[QUOTE=Willox;45724223]You'll have to show the code that is causing the error.[/QUOTE] Solved it. My friend said he had the problem before and it was due to the lua error reporting system. It works now.
What's the best way to render a png or jpg from Internet, without using HTML control? ( because it spawns infinite amount of Awesomium processes )
I believe I've seen / heard of grabbing the contents and either passing it through as a Material, or saving it as a txt then loading that as Material. It is worth a shot..
[QUOTE=Robotboy655;45728982]What's the best way to render a png or jpg from Internet, without using HTML control? ( because it spawns infinite amount of Awesomium processes )[/QUOTE] [url=https://github.com/pixeltailgames/gm-mediaplayer/blob/master/lua/autorun/includes/modules/browserpool.lua]Spawn just one and reuse it[/url].
[QUOTE=HumbleTH;45720326]Or check if the panel object is nil. [lua] local pnl if input.IsKeyDown( KEY ) and not pnl then pnl = vgui.Create( "DFrame" ) -- code end [/lua][/QUOTE] Okay, so I open the panel with the key. That works nicely. But then once I close it using the default button at the top, it wont open again. Cause 'pnl' gets declared after its opened the first time. Is there any fix for this or will I just have to remove the close button?
[QUOTE=Exho;45730150]Okay, so I open the panel with the key. That works nicely. But then once I close it using the default button at the top, it wont open again. Cause 'pnl' gets declared after its opened the first time. Is there any fix for this or will I just have to remove the close button?[/QUOTE] Set pnl to nil when closing it.
[QUOTE=Exho;45730150]Okay, so I open the panel with the key. That works nicely. But then once I close it using the default button at the top, it wont open again. Cause 'pnl' gets declared after its opened the first time. Is there any fix for this or will I just have to remove the close button?[/QUOTE] Something like this: [code]if ( pnl ) then pnl:SetVisible( true ); else pnl = vgui.Create... end[/code] Here are a few tutorials on the subject: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/vgui/open_vgui_based_on_keypress.lua.html[/url] [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/vgui/open_menu_key_tap_open_and_key_hold_release_close.lua.html[/url] [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/vgui/open_menu_key_tap_using_bind.lua.html[/url] And I recommend using this while developing vgui: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_utilities/concommand_clearvgui.lua[/url] put it in addons/acecool/lua/autorun/client/concommand_clearvgui.lua ( bind x clearvgui ); it'll remove all vgui elements on the screen, error'ed or not. It won't remove ( due to GMod bug ) elements you did Panel:ParentToHUD( ) because the hud list doesn't return a table of elements ( reported ).
Well it appears I do derma differently.... I dont have any PANEL:INIT or even a table like Panel. [code] function OpenLoadoutMenu() local ply = LocalPlayer() local pChoice = pChoice or "" -- Declaring our choices. The 'or' part is left over from an idea I had local sChoice = sChoice or "" -- It isnt hurting anyone so might as well keep it local gChoice = gChoice or "" if not CanUseLoadout(ply) then return Text(0, WL_Deny_MSG) end -- Creating the actual frame Frame = vgui.Create( "DFrame" ) -- Frame was declared earlier, so this is local Frame:SetPos( 700, 400 ) Frame:SetSize( 500, 300 ) Frame:SetTitle( WL_Panel_Title ) Frame:SetVisible( true ) Frame:MakePopup() Frame.Paint = function() [/code] [code] hook.Add("Think", "Loadoutkey", function() if input.IsKeyDown( WL_Panel_Key ) not Frame then OpenLoadoutMenu() end end) [/code] [editline]18th August 2014[/editline] [QUOTE=HumbleTH;45730182]Set pnl to nil when closing it.[/QUOTE] See my code snippet above. I dont have a function for closing
[QUOTE=Exho;45730361]Well it appears I do derma differently.... I dont have any PANEL:INIT or even a table like Panel. [code] function OpenLoadoutMenu() local ply = LocalPlayer() local pChoice = pChoice or "" -- Declaring our choices. The 'or' part is left over from an idea I had local sChoice = sChoice or "" -- It isnt hurting anyone so might as well keep it local gChoice = gChoice or "" if not CanUseLoadout(ply) then return Text(0, WL_Deny_MSG) end -- Creating the actual frame Frame = vgui.Create( "DFrame" ) -- Frame was declared earlier, so this is local Frame:SetPos( 700, 400 ) Frame:SetSize( 500, 300 ) Frame:SetTitle( WL_Panel_Title ) Frame:SetVisible( true ) Frame:MakePopup() Frame.Paint = function() [/code] [code] hook.Add("Think", "Loadoutkey", function() if input.IsKeyDown( WL_Panel_Key ) not Frame then OpenLoadoutMenu() end end) [/code] [editline]18th August 2014[/editline] See my code snippet above. I dont have a function for closing[/QUOTE] Well then add it silly: [code] Frame.OnRemove = function() //Do shit end [/code] Also, make the Frame a local variable ( as well as any global variable you have for panels ) UNLESS you use it in another script in another file. [editline]19th August 2014[/editline] [QUOTE=Exho;45730150]Okay, so I open the panel with the key. That works nicely. But then once I close it using the default button at the top, it wont open again. Cause 'pnl' gets declared after its opened the first time. Is there any fix for this or will I just have to remove the close button?[/QUOTE] Check for VALIDITY and use pnl:SetDeleteOnClose( false ): [code] local pnl if input.IsKeyDown( KEY ) and !IsValid( pnl ) then pnl = vgui.Create( "DFrame" ) -- Create pnl:SetDeleteOnClose( false ) -- Don't remove -- code elseif input.IsKeyDown( KEY ) and IsValid( pnl ) and !pnl:IsVisible() then pnl:SetVisible( true ) -- Make it visible end[/code] You know, googling usually helps.
[QUOTE=Robotboy655;45730411] You know, googling usually helps.[/QUOTE] Thats mean :/ I did do a lot of googling related to close and exit buttons but really found nothing. Thanks for that anyways
[QUOTE=Exho;45730361] [code] hook.Add("Think", "Loadoutkey", function() if input.IsKeyDown( WL_Panel_Key ) not Frame then OpenLoadoutMenu() end end) [/code] [/QUOTE] I just woke up, so correct me if wrong, but you are missing an and.
Alright, also I need help with concommand.Add behaving strangely. All 3 of these commands are declared on the server. Sorry if I come off as needy, I just have questions. [code] concommand.Add( "wl_open", function(ply) -- The console command it uses net.Start("OpenLoadoutMenu") net.Send(ply) end ) concommand.Add( "wl_version", function(ply) -- Just cause I like to be able to tell what version a server is running print(ply:Nick().." requested version") ply:PrintMessage( HUD_PRINTCONSOLE, "**** Exho's Weapon Loadout Addon ****" ) ply:PrintMessage( HUD_PRINTCONSOLE, "Version "..WL_ver..". Last edited on "..WL_dat) ply:PrintMessage( HUD_PRINTCONSOLE, "**** Contact at STEAM_0:0:53332328 ****" ) end ) concommand.Add( "wl_print", function(ply) local p = ply:GetPData("TTTPrimary", "none") local s = ply:GetPData("TTTSecondary", "none") local g = ply:GetPData("TTTGrenade", "none") local tab = {p,s,g} net.Start("LoadoutPrint") net.WriteTable(tab) -- Sends the weapon table to the player net.Send(ply) end) [/code] [code] net.Receive( "OpenLoadoutMenu", function( len, ply ) OpenLoadoutMenu() end) [/code] So I do this and what not, it works fine in a local game and wl_version and wl_print work fine in Servers but wl_open does not... It mentions FCVAR_SERVER_CAN_EXECUTE and tells me that it prevented me from running the command. So I look into concommand flags but inbetween my function there is "function autoCompleteFunc, string helpText," and I dont know what to do with that so that its ignored... I can't find any recent examples of using concommand.Add with flags either. My questions: 1. How do I properly use flags with concommands when I dont want the other 2 options 2. Why on earth do 2 of my commands work on the client but the third doesnt? Thanks
[QUOTE=Exho;45730766] My questions: 1. How do I properly use flags with concommands when I dont want the other 2 options 2. Why on earth do 2 of my commands work on the client but the third doesnt? [/QUOTE] 1) Use nil or the default value which you can find on the wiki 2) I'd like to see a screencap of the error 3) Why do you create a SERVERSIDE concommand to send a net message to CLIENT and open a CLIENTSIDE menu? Why not just make a clientside concommand to call the OpenLoadoutMenu function?
Sorry, you need to Log In to post a reply to this thread.