• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
I am trying to create a simple menu that gives me a couple of ULX options. There's one that is banning, but if I use RunConsoleCommand, the ULX cantarget thing "!%<group>" is ignored. Is there a better way to run a console command other than RunConsoleCommand, so that the ulx canttarget is included?
Do nan and inf already have existing definitions in gLua? (math.inf = 1/0 and math.nan = 0/0)
What can I do to allow camera movement but still make interactive derma?
[QUOTE=Busan1;48181698]What can I do to allow camera movement but still make interactive derma?[/QUOTE] As in with gui.EnableScreenClicker enabled but still allowing the player to look around? I don't really know how that would work, should you be asking about that Your best bet would be to use PlayerBindPress and do and check if players have pressed certain keys, then do a doclick function in one of your derma elements or something, but for mouse cursors no idea
[QUOTE=MPan1;48181529]Do nan and inf already have existing definitions in gLua? (math.inf = 1/0 and math.nan = 0/0)[/QUOTE] from memory, inf is math.huge() or something.
-snip- Worked it out.
I realize that Space Combat is outdated for gmod 13, but most things do work. Although, I'm experiencing a rather annoying error, also causing the ship cores to be unfunctional; [CODE][ERROR] addons/spacecombat/lua/entities/ship_core_base/init.lua:187: attempt to call field 'GetAllWeldedEntities' (a nil value) 1. CalcHealth - addons/spacecombat/lua/entities/ship_core_base/init.lua:187 2. CalcHealth - addons/spacecombat/lua/entities/ship_core_amarr/init.lua:107 3. Think - addons/spacecombat/lua/entities/ship_core_base/init.lua:820 4. unknown - addons/spacecombat/lua/entities/ship_core_amarr/init.lua:112 [/CODE] The code in which the error is occuring: [url]http://pastebin.com/UHckWKic[/url]
I'm stressing myself the fuck out. I'm using a DModelPanel and want to display a weapon without rotation, and show the side of it but I can't figure it out. [lua] local WeaponModel = vgui.Create( "DModelPanel", ListItem ) WeaponModel:SetPos(90, 0) WeaponModel:SetSize( 260, 80 ) WeaponModel:SetModel(v.Model) function WeaponModel:LayoutEntity(ent) -- disables the rotation end [/lua] Like this: [img]http://i.imgur.com/jbfSOhw.png?1[/img]
[QUOTE=Persious;48186947]I'm stressing myself the fuck out. I'm using a DModelPanel and want to display a weapon without rotation, and show the side of it but I can't figure it out. local WeaponModel = vgui.Create( "DModelPanel", ListItem ) WeaponModel:SetPos(90, 0) WeaponModel:SetSize( 260, 80 ) WeaponModel:SetModel(v.Model) function WeaponModel:LayoutEntity(ent) -- disables the rotation end Like this: [IMG]http://i.imgur.com/jbfSOhw.png?1[/IMG][/QUOTE] Playing around with SetCamPos and SetLookAt can be a bitch with weapon models. For some reason weapon models always seem to be displayed MUCH smaller than the DModelPanel's size itself, so just play around with SetLookAt and SetCamPos. But beware, you're in for a world of hurt trying to do this, it takes forever trying to find a good position. [editline]12th July 2015[/editline] Honestly what I'd do is spawn your weapon model, take a picture of it in GM construct's white room, find the screenshot in your garrysmod/screenshots directory and then edit it to your liking, then create a DImageButton with the image. Of course you'll need to make it smaller though so it'll fit on your dpanel or dframe.
[QUOTE=MegaTronJohn;48187115]Playing around with SetCamPos and SetLookAt can be a bitch with weapon models. For some reason weapon models always seem to be displayed MUCH smaller than the DModelPanel's size itself, so just play around with SetLookAt and SetCamPos. But beware, you're in for a world of hurt trying to do this, it takes forever trying to find a good position. [editline]12th July 2015[/editline] Honestly what I'd do is spawn your weapon model, take a picture of it in GM construct's white room, find the screenshot in your garrysmod/screenshots directory and then edit it to your liking, then create a DImageButton with the image. Of course you'll need to make it smaller though so it'll fit on your dpanel or dframe.[/QUOTE] Well I'm using a table of weapons with their model and looping through them and then creating multiple panels with the DModelPanel, that's why I didnt want to use the DImageButton.
Not really a problem, but something that it didn't feel worthy of it's own thread. [QUOTE=Danny1828;48128871]Naval play 2 fun continuous, this time with even more of the SGC clan members involved: [url]http://pastebin.com/37aXn7S7[/url] Also, I was inspecting the recently added .50 mg model, turns out its not too great: [t]http://puu.sh/iObYT/cb1ec95ab7.png[/t] [t]http://puu.sh/iObzj/1b3925fdea.png[/t] After the author claimed the wireframe was not what it actually was, I decided to open it in 3ds max and see for myself, see for yourself: [t]http://puu.sh/iOdF5/9d51ed1c6f.png[/t] Its rather obvious that there is a massive waste, the model consists of 9178 tris in total.[/QUOTE] How do you make a model THIS BADLY? Like, how does the bottom half of the ammo box which is pretty much a cube, take up almost a thousand polys? It makes me wonder if he even made the model.
[CODE]hook.Remove("TTTBeginRound", calling_ply:UniqueID .. "_traitor")[/CODE] Error: [IMG]http://i.imgur.com/iIuCIjC.png[/IMG] hook.Add code [CODE]hook.Add("TTTBeginRound", calling_ply:UniqueID() .. "_traitor", function() calling_ply:SetRole(ROLE_TRAITOR) calling_ply:AddCredits(2) end ) [/CODE]
forgot () on UniqueID
[QUOTE=zerf;48188573]forgot () on UniqueID[/QUOTE] Thanks
[QUOTE=Persious;48187279]Well I'm using a table of weapons with their model and looping through them and then creating multiple panels with the DModelPanel, that's why I didnt want to use the DImageButton.[/QUOTE] I found a good cam position and lookat position for any weapon that is used with a dmodelpanel. Here's my code, feel free to copy + paste it: [lua]local attachmentmenu = vgui.Create( "DFrame" ) attachmentmenu:SetSize( 600, 400 ) attachmentmenu:Center() attachmentmenu:ShowCloseButton( false ) attachmentmenu:SetTitle( "Attachments and Weapons" ) function attachmentmenu:Paint( w, h ) draw.RoundedBox( 8, 0, 0, w, h, Color( 101, 100, 105, 255 ) ) end attachmentmenu:Hide() local weapon = vgui.Create( "DModelPanel", attachmentmenu ) weapon:SetPos( 60, 100 ) weapon:SetSize( 150, 80 ) weapon:SetModel( "models/weapons/w_smg_mp5.mdl" ) function weapon:LayoutEntity( ent ) return end weapon:SetCamPos( Vector( 5, -20, 10 ) ) weapon:SetLookAt( Vector( 5, 10, 0 ) ) weapon:SetFOV( 110 ) [/lua] But if you wanted to use ImageButtons, why not assign an image to your weapon table? [lua]local tabweps = {} tabweps["MP5"] = {["Image"] = {"exampleimage.png"} } for k, v in pairs(tabweps) do --set the image here end [/lua] But that would only be if you wanted to use images. Refer to my code above the image code if you want to use DModelPanels, though of course it'll need a bit of editing for your purpose.
How do you do a radial scissor on a texture that is on the players HUD? I am trying to make a bar that curves like this: [IMG]http://i.gyazo.com/42f57bcc8c10ade656c0ea52a9c564df.png[/IMG] The bar will increase in thickness as it goes around in a circle. This is also currently a image that is on the screen fully drawn out.
Anyone know how to draw a rounded box like draw.RoundedBox but not filled in? Just outlined?
[QUOTE=MegaTronJohn;48190645]Anyone know how to draw a rounded box like draw.RoundedBox but not filled in? Just outlined?[/QUOTE] There are 3 ways you can do that. 1) Use a expensive algorithm that might cause fps drops to clients to produce a circle on the screen(I would need to look for this to give it to you its on facepunch somewhere) 2) You can use:(Easiest way but limiting on the size of the thickness of the line) [lua] surface.DrawCircle( number originX, number originY, number radius, table color ) [/lua] 3)Use a texture (This is the most effecient way that is most versatile)
How would I go about rendering a clientside model where the player looks when he holds a specific swep?
anyone who knows how to block non numircal values in DTextEntry can't seem to find any documentation
I'm displaying text from a table onto a derma menu, every 45 characters into a string I want to insert a \n, so it looks nice and doesn't get cut off - how do I do this automatically without having to have \n in my table of strings? I swear there's a string.function for inserting characters at a specific place but the name escapes me
Hey, not sure how to go about this. I'm working on my NPC Base and I'm creating tables for the speech/conversation. I've been trying to get the tables shared but ENT:Initialize seems to not allow shared/client lua. These tables have functions in them so they cant be sent over net. I've found a horrible temp fix by just leaving the funcs as strings and compiling them so they can be sent over net. Anyone have a better solution? [editline]13th July 2015[/editline] [QUOTE=NiandraLades;48193597]I'm displaying text from a table onto a derma menu, every 45 characters into a string I want to insert a \n, so it looks nice and doesn't get cut off - how do I do this automatically without having to have \n in my table of strings? I swear there's a string.function for inserting characters at a specific place but the name escapes me[/QUOTE] I can give you a helper function that I use in my framework that detects when text has reached the end of a panel and inserts a \n, if you wish. Maybe you could work off that.
[QUOTE=Pigsy;48194018]Hey, not sure how to go about this. I'm working on my NPC Base and I'm creating tables for the speech/conversation. I've been trying to get the tables shared but ENT:Initialize seems to not allow shared/client lua. These tables have functions in them so they cant be sent over net. I've found a horrible temp fix by just leaving the funcs as strings and compiling them so they can be sent over net. Anyone have a better solution? [editline]13th July 2015[/editline] I can give you a helper function that I use in my framework that detects when text has reached the end of a panel and inserts a \n, if you wish. Maybe you could work off that.[/QUOTE] Oh whoa that's useful, could you show the me that too?
So i want to make my own little hud for my gamemode that im working on (im brand new to this) and my question is how do i remove the default healthbar? not like a console thingy but more from the files. Is there a way? [IMG]http://i.gyazo.com/68ccd3871d943cf51db46eb2fbcf0968.png[/IMG]
[QUOTE=thekillersan;48199018]So i want to make my own little hud for my gamemode that im working on (im brand new to this) and my question is how do i remove the default healthbar? not like a console thingy but more from the files. Is there a way? [IMG]http://i.gyazo.com/68ccd3871d943cf51db46eb2fbcf0968.png[/IMG][/QUOTE] [url]http://wiki.garrysmod.com/page/GM/HUDShouldDraw[/url] [url]http://wiki.garrysmod.com/page/HUD_Element_List[/url]
[url]http://wiki.garrysmod.com/page/HUD_Element_List[/url] [lua] local shoulddraw = {CHudHealth = false, CHudAmmo = false} hook.Add("HUDShouldDraw", "name", function(ele) return shoulddraw[ele] end) [/lua] [editline]13th July 2015[/editline] ROOD
[QUOTE=Jeff Scott;48199115][url]http://wiki.garrysmod.com/page/GM/HUDShouldDraw[/url] [url]http://wiki.garrysmod.com/page/HUD_Element_List[/url][/QUOTE] Thanks for the answer! [editline]14th July 2015[/editline] Well back to me i guess.. [ERROR] gamemodes/kvidingerp/gamemode/init.lua:48: attempt to call method 'kill' (a nil value) 1. v - gamemodes/kvidingerp/gamemode/init.lua:48 2. unknown - lua/includes/modules/hook.lua:84 Code: 43: hook.Add( 'PlayerSay', 'KillCommand', function( ply, text) 44: 45: text = string.lower( text ) 46: if ( string.sub( text, 1) == "/kill") then 47: 48: ply:kill() 49: ply:ChatPrint( "Killed.." ) 50: end 51: end ) This is the guy that im watching to learn lua. Knows what he is doing and yeah, any other stuff i should watch to get started?? [url]https://www.youtube.com/user/MrCosmicSeagull[/url]
[QUOTE=thekillersan;48199239] Well back to me i guess.. [ERROR] gamemodes/kvidingerp/gamemode/init.lua:48: attempt to call method 'kill' (a nil value) 1. v - gamemodes/kvidingerp/gamemode/init.lua:48 2. unknown - lua/includes/modules/hook.lua:84 [/QUOTE] [url]http://wiki.garrysmod.com/page/Player/Kill[/url] re-read line 48
[QUOTE=thekillersan;48199239]Thanks for the answer! [editline]14th July 2015[/editline] Well back to me i guess.. [ERROR] gamemodes/kvidingerp/gamemode/init.lua:48: attempt to call method 'kill' (a nil value) 1. v - gamemodes/kvidingerp/gamemode/init.lua:48 2. unknown - lua/includes/modules/hook.lua:84 Code: 43: hook.Add( 'PlayerSay', 'KillCommand', function( ply, text) 44: 45: text = string.lower( text ) 46: if ( string.sub( text, 1) == "/kill") then 47: 48: ply:kill() 49: ply:ChatPrint( "Killed.." ) 50: end 51: end ) This is the guy that im watching to learn lua. Knows what he is doing and yeah, any other stuff i should watch to get started?? [url]https://www.youtube.com/user/MrCosmicSeagull[/url][/QUOTE] I know Jeff Scott already provided an answer but I don't think you'll understand what he means, so I'll post the exact problem. Lua is case sensitive, so doing ply:kill() is not the same as as ply:Kill(). Don't do ply:kill(), do ply:Kill().
[QUOTE=MegaTronJohn;48199381]I know Jeff Scott already provided an answer but I don't think you'll understand what he means, so I'll post the exact problem. Lua is case sensitive, so doing ply:kill() is not the same as as ply:Kill(). Don't do ply:kill(), do ply:Kill().[/QUOTE] I see what you guys are telling me and yeah i know lua is senitive. My own fault not looking properly, but thanks!!
Sorry, you need to Log In to post a reply to this thread.