• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
How do I get a model to always render even when its render bounds are not in my line of sight? Tried messing with set render bounds, didnt work
[QUOTE=VIoxtar;49589940]How do I get a model to always render even when its render bounds are not in my line of sight? Tried messing with set render bounds, didnt work[/QUOTE] You mean like this? [img]http://i.imgur.com/zHu0h00.png[/img] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/DrawModel]Entity:DrawModel[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/cam/Start3D]cam.Start3D[/url] [code]hook.Add( "HUDPaint", "3d_camera_example", function() cam.Start3D() for id, ply in pairs( player.GetAll() ) do ply:DrawModel() end cam.End3D() end )[/code]
[QUOTE=MPan1;49589658]:snip: Figured it out [B]EDIT:[/B] Nope, I didn't This is probably a really simple maths question, but: If I had a screen width of [B]1920[/B], then I want a variable to be set as [B]100[/B]. If I had a screen width of [B]1176[/B], then I want a variable to be set as [B]84[/B]. Or as close to the second number as possible. What equation am I meant to do to the first number to get it as close as possible to the second one? Also, I want the equation to be the same for both numbers so it works for all screen resolutions. How could I do this? [B]EDIT:[/B] Nevermind, I'll just use different numbers[/QUOTE] I know you said nevermind, but I'm curious. What are you using this for? Why do you need a number to be 100 if the screen's width is 1920, and 84 if the screen's width is 1176?
I'm trying to somewhat "animate" the player's view offsets by using LerpVector. I got it working in the PlayerTick hook but because PlayerTick doesn't seem to run fast enough the transition is noticeably choppy and ugly. Is there a better way I could be doing this? I've thought about using a Think hook but since it doesn't supply a player entity like PlayerTick does I would need to do a loop and check every player every time Think is called, which seems [b]extremely[/b] heavy and not the best way.
[QUOTE=roastchicken;49590393]I know you said nevermind, but I'm curious. What are you using this for? Why do you need a number to be 100 if the screen's width is 1920, and 84 if the screen's width is 1176?[/QUOTE] Well, it's for the [URL="https://www.youtube.com/watch?v=YDPl3QdGuqw"]Dinosaur Game[/URL] I'm trying to do-I have a variable defining the size of everything at the top of the code so it can all look the same on all screen resolutions and size 100 looked good to me for 1920 and 84 for 1176
[QUOTE=MPan1;49589658]:snip: Figured it out [B]EDIT:[/B] Nope, I didn't This is probably a really simple maths question, but: If I had a screen width of [B]1920[/B], then I want a variable to be set as [B]100[/B]. If I had a screen width of [B]1176[/B], then I want a variable to be set as [B]84[/B]. Or as close to the second number as possible. What equation am I meant to do to the first number to get it as close as possible to the second one? Also, I want the equation to be the same for both numbers so it works for all screen resolutions. How could I do this? [B]EDIT:[/B] Nevermind, I'll just use different numbers[/QUOTE] I guess I'll answer this for anyone else looking at this thread. Basically, what you want to do, is get the difference between 1920 and 1176, which is 744. We also want the difference between 100 and 84, which is 16. So now we have a ratio between the two, 744:16. Using this, we can work out the width of the UI at any resolution. If we divide 744 by 16 then we get 46.5. Now, we can work out what we need to take away from 100 by using (1920-ScrW())/46.5. Take the result away from 100 for the new UI width. Works for scaling up and down. There you have it, hope it helps.
Hi people, is there a way to get the color or intensity of the light affecting the player model? I know there is render.GetLightColor(player position), but sometimes it feels like the player model has more light than what this function returns.
Hey, really quickly: Is there a way to enable a horizontal scroll bar for the dscrollpanel?
[QUOTE=john55223;49594759]Hey, really quickly: Is there a way to enable a horizontal scroll bar for the dscrollpanel?[/QUOTE] [CODE]htmlpanel:RunJavaScript("document.body.style.overflowX = 'scroll'")[/CODE]
[QUOTE=BillyOnWiiU;49594796][CODE]htmlpanel:RunJavaScript("document.body.style.overflowX = 'scroll'")[/CODE][/QUOTE] Thanks for pointing me in the right direction! When using your function, the scrollbar is always visible, however, it doesn't "activate" even when the children of the panel overflow on the x axis. I changed it from "scroll" to auto because I only want it visible if it is necessary. Now, it isn't visible, even when the content overflows in the x axis, so I figure that the way I am adding the children (local child = dhtml:Add("DPanel")) then (child:Dock(LEFT)) isn't the proper way to do it.
[QUOTE=john55223;49594866]Thanks for pointing me in the right direction! When using your function, the scrollbar is always visible, however, it doesn't "activate" even when the children of the panel overflow on the x axis. I changed it from "scroll" to auto because I only want it visible if it is necessary. Now, it isn't visible, even when the content overflows in the x axis, so I figure that the way I am adding the children (local child = dhtml:Add("DPanel")) then (child:Dock(LEFT)) isn't the proper way to do it.[/QUOTE] Yeah -- Lua won't "activate" a scrollbar. You're getting to more CSS and HTML stuff here. What's your HTML? If you're using a div instead of body for "content" that you want to overflow you'll have to change that's CSS instead.
Could someone tell me why this would crash my TTT server when the round end timer hits 0:00? [code] if (SERVER) then hook.Add("TTTEndRound", "PostRoundDeathmatchRespawner", function() RunConsoleCommand("ulx", "respawn", "*", "1") RunConsoleCommand("ulx", "csay", "It's post-round deathmatch time!") timer.Create("RespawnTimer", 5, 5, function() RunConsoleCommand("ulx", "respawn", "*", "1") end) timer.Create("MessageTimer", 6, 3, function() RunConsoleCommand("ulx", "csay", "It's post-round deathmatch time!") end) end ) end [/code]
[QUOTE=BillyOnWiiU;49594995]Yeah -- Lua won't "activate" a scrollbar. You're getting to more CSS and HTML stuff here. What's your HTML? If you're using a div instead of body for "content" that you want to overflow you'll have to change that's CSS instead.[/QUOTE] CSS? Have no idea what that even is. I litterly have the following: [lua] local hList = frame:Add("DHTML") hList:RunJavascript("document.body.style.overflowX = 'auto') [/lua] Then later, [lua] for 1, 10 do local testPanel = hList:Add("DPanel") testPanel:SetWidth(75) testPanel:Dock(LEFT) end [/lua] I quite frankly have no idea what I am doing when it comes to "CSS" and HTML in gmod. (and I have no idea what CSS is)
[QUOTE=Windwhistle;49595006]Could someone tell me why this would crash my TTT server when the round end timer hits 0:00? [code] if (SERVER) then hook.Add("TTTEndRound", "PostRoundDeathmatchRespawner", function() RunConsoleCommand("ulx", "respawn", "*", "1") RunConsoleCommand("ulx", "csay", "It's post-round deathmatch time!") timer.Create("RespawnTimer", 5, 5, function() RunConsoleCommand("ulx", "respawn", "*", "1") end) timer.Create("MessageTimer", 6, 3, function() RunConsoleCommand("ulx", "csay", "It's post-round deathmatch time!") end) end ) end [/code][/QUOTE] I'm guessing the amount of times you're running it is causing it to overflow.
[QUOTE=Mikey Howell;49595106]I'm guessing the amount of times you're running it is causing it to overflow.[/QUOTE] How many times would you recommend I run it?
[QUOTE=Windwhistle;49595323]How many times would you recommend I run it?[/QUOTE] you only need to run it once...
How to shorten/change bone lengths in Gmod? first pic is with default fov: [url]http://postimg.org/image/yp9xvmj6r/[/url] second pic is 120 fov: [url]http://postimg.org/image/488bsogwz/[/url] in the second pic, how can i shorten the length of the right arm so that it doesn't look silly? i've looked at the wiki, done some searches on here.... i found that i can do things like: [lua] Entity(1):ManipulateBoneScale(9, Vector(1,1,1)) [/lua] where 9 is ValveBiped.Bip01_R_UpperArm, but changing the Vector values doesn't effect bone length. any ideas would be appreciated.. edit to add or any other way to get player model back to normal w/o effecting the rest of the fov? (is there a fov that just effects the player model)
No you don't change the bone length, change the FOV on the SWEP.
^ i was just editing my question above to ask if something like that was possible. thanks i will google fov swep change. edit: where can i find the file to edit the swep fov or can i write a lua script to do this?
How does ents.FindInBox work internally? Does it loop through all entities in the map like ents.GetByClass?
Is there still no simple way to find a weapons print name server side? I would swear it should just be there because its in shared but a quick Google suggests otherwise.
Hello, I want to sort a table. All the strings in the table should be sorted by alphabet, but I have never done that before. Can somebody give me an example? Example table: {"b", "2", "c", "3", "a", "1"} should be sorted to be: {"1", "2", "3", "a", "b", "c"} [url]http://wiki.garrysmod.com/page/table/sort[/url] I don't know hot to use the 2nd argument here.
how do you disable the the click on a swep when youre out of ammo
[QUOTE=P4sca1;49597187]Hello, I want to sort a table. All the strings in the table should be sorted by alphabet, but I have never done that before. Can somebody give me an example? Example table: {"b", "2", "c", "3", "a", "1"} should be sorted to be: {"1", "2", "3", "a", "b", "c"} [URL]http://wiki.garrysmod.com/page/table/sort[/URL] I don't know hot to use the 2nd argument here.[/QUOTE] The second argument is a function, and it's called with 2 arguments to compare. The return for the function is boolean which when true will make the first argument come before the second. So for what you want it'd be used like [CODE]table.sort(table, function(a, b) return a < b end)[/CODE] Though this is also the default behavior of this function so you can just call it without the sorter function, ie [CODE]table.sort(table)[/CODE] Only use this if the table you're sorting uses string or number values, but not both, as the < operator can't compare a string and a number. If you're mixing value types then you have to add checks within the sorter function. If you're still confused [URL="http://www.lua.org/manual/5.3/manual.html#pdf-table.sort"]this'll[/URL] probably explain a bit better.
[QUOTE=Mikey Howell;49596015]you only need to run it once...[/QUOTE] That's boring. My TTT server still crashes when someone kills another player. I assume it's something to do with physics or something. I have gs_entitycatcher.
Now that we can save/load png and jpg files, is it possible to use a png with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/SpriteTrail]util.SpriteTrail[/url]? I know it requires a texture (vtf etc) but is it possible to get a png working without too much hackery? I'm guessing I'd have to remake the trail code to work with materials.
[QUOTE=Mrkrabz;49598483]Now that we can save/load png and jpg files, is it possible to use a png with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/SpriteTrail]util.SpriteTrail[/url]? I know it requires a texture (vtf etc) but is it possible to get a png working without too much hackery? I'm guessing I'd have to remake the trail code to work with materials.[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/Material]Global.Material[/url] ?
[QUOTE=YourStalker;49600052][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/Material]Global.Material[/url] ?[/QUOTE] util.SpriteTrail wants a path to the vmt
Is there a possible way to exclude an entity class from being removed on a map cleanup?
So I've got a table that is stored as [code]local tbl = { ["SteamID 1"] = true, ["SteamID 2"] = true, ["SteamID 3"] = true, }[/code] How would I add to this table with something like table.Add()?
Sorry, you need to Log In to post a reply to this thread.