• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
[QUOTE=Castiel789;52656839]Sorry if this is the wrong place to be asking this, but my servers (ran from a dedicated server) seem to be 50/50 on whether or not they connect to the steam servers when they boot: "Could not establish connection to Steam servers. (Result = 3)" Changing port etc seems to do nothing, and googled answers seem either irrelevant due to the person's server ALWAYS doing it, or it simply doesn't fix it. Any help is greatly appreciated.[/QUOTE] This happened to me due to the server having multiple IPs due to one Virtual Box inside of the dedicated server. Try starting the server with the +ip command with the local network address of the server.
Was there a change to how PrintTable works, or have I managed to install an addon that broke PrintTable? [code] local tbl = { ["last_stamina_use"] = CurTime(), ["stamina"] = 0, } print("tbl was", tbl) PrintTable(tbl) timer.Simple(0,function() print("tbl is now",tbl) PrintTable(tbl) end) [/code] [code] tbl was table: 0x5e4bf1c8 last_stamina_use = 7317.59765625 stamina = 0 tbl is now table: 0x5e4bf1c8 -- <- The table should be re-printed here. [/code] [code] local function loltable(tbl) for k,v in pairs(tbl) do print(k,":",v) end end local tbl = { ["last_stamina_use"] = CurTime(), ["stamina"] = 0, } print("tbl was", tbl) loltable(tbl) timer.Simple(0,function() print("tbl is now",tbl) loltable(tbl) end) [/code] [code] tbl was table: 0x526e9d90 stamina : 0 last_stamina_use : 7364.3706054688 tbl is now table: 0x526e9d90 stamina : 0 last_stamina_use : 7364.3706054688 [/code]
[img]https://i.imgur.com/UlXGp5D.png[/img] Must be an addon.
How do I use a key to get the value in a table. for example a table with 3 values and i want the value of the 2nd key how would i do this
[QUOTE=bcz;52659626]How do I use a key to get the value in a table. for example a table with 3 values and i want the value of the 2nd key how would i do this[/QUOTE] tbl[2]
[QUOTE=Apickx;52659353]Was there a change to how PrintTable works, or have I managed to install an addon that broke PrintTable? [code] local tbl = { ["last_stamina_use"] = CurTime(), ["stamina"] = 0, } print("tbl was", tbl) PrintTable(tbl) timer.Simple(0,function() print("tbl is now",tbl) PrintTable(tbl) end) [/code] [code] tbl was table: 0x5e4bf1c8 last_stamina_use = 7317.59765625 stamina = 0 tbl is now table: 0x5e4bf1c8 -- <- The table should be re-printed here. [/code] [code] local function loltable(tbl) for k,v in pairs(tbl) do print(k,":",v) end end local tbl = { ["last_stamina_use"] = CurTime(), ["stamina"] = 0, } print("tbl was", tbl) loltable(tbl) timer.Simple(0,function() print("tbl is now",tbl) loltable(tbl) end) [/code] [code] tbl was table: 0x526e9d90 stamina : 0 last_stamina_use : 7364.3706054688 tbl is now table: 0x526e9d90 stamina : 0 last_stamina_use : 7364.3706054688 [/code][/QUOTE] You can check where the function was defined with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/debug/getinfo]debug.getinfo[/url].
Not sure where the best place is to ask about this is, but anyway I had someone come on my server and cause it to lag to the point where it completely froze, they were standing there doing nothing and all I saw in the server console was something along the lines of ' Unknown command 'ECKSDEE' ' :p Is this some simple security problem I can fix up?
Yeah, you got backdoors, you would need to find a backdoor checker script, i'm not sure if it's on workshop
[QUOTE=gonzalolog;52661050]Yeah, you got backdoors, you would need to find a backdoor checker script, i'm not sure if it's on workshop[/QUOTE] I'm pretty sure there's cheats that just have a way of spamming the server console with unknown commands. I don't think that part is a backdoor.
[QUOTE=Castiel789;52660971]Not sure where the best place is to ask about this is, but anyway I had someone come on my server and cause it to lag to the point where it completely froze, they were standing there doing nothing and all I saw in the server console was something along the lines of ' Unknown command 'ECKSDEE' ' :p Is this some simple security problem I can fix up?[/QUOTE] If you're using ULX it might be [URL="https://facepunch.com/showthread.php?t=1574081&p=52545194&viewfull=1#post52545194"]this[/URL].
What's the closest hook to [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/ENTITY/Draw]ENT:Draw[/url] in terms of rendering context? [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PostDrawOpaqueRenderables]GM:PostDrawOpaqueRenderables[/url] seems to work
[B]EDIT:[/B] Refer to [url]http://wiki.garrysmod.com/page/Render_Order[/url]
I have a problem where NPCs that use a SWEP will end up T-Posing while firing. I've set the capabilities and I know for sure the model has the animation ( Combine Super with AR2, Soldier with SMG, etc )
It could be that the SWEP you are using doesnt have translations to AI activities. Usually SWEPs and weapon bases targetted for players dont provide them.
[QUOTE=G4MB!T;52663213]It could be that the SWEP you are using doesnt have translations to AI activities. Usually SWEPs and weapon bases targetted for players dont provide them.[/QUOTE] The swep is derived from the weapon_base so it should have all the animations translated already. I tried moving the translation functions into the base file just for posterity but it still yields them being tposed when firing
Anyone know why I can't resize anything sprayed with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/DecalEx]util.DecalEx[/url]? This is a decal with the size of 1000,1000: [IMG]https://i.imgur.com/5exwxuC.png[/IMG] And one with 0,0 (But I set the texture to white): [IMG]https://i.imgur.com/PEae257.png[/IMG] They're both the same size and aspect ratio and I can't make them bigger
[QUOTE=Kevlon;52665070] They're both the same size and aspect ratio and I can't make them bigger[/QUOTE] Is it possible that they span over 2 different brushes? Maybe try it with a power 2 size.
Anyone know the best way to get information from the mouse? I need to get info from the mouse without changing the players eye angles? Someone mentioned [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/CalcView]GM:CalcView[/url], bit I don't quite understand how to get mouse movements from that cleanly and efficiently. Can someone point me in the right direction?
[QUOTE=-Raven-;52667426]Anyone know the best way to get information from the mouse? I need to get info from the mouse without changing the players eye angles? Someone mentioned [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/CalcView]GM:CalcView[/url], bit I don't quite understand how to get mouse movements from that cleanly and efficiently. Can someone point me in the right direction?[/QUOTE] This sounds like an XY problem to me. What are you trying to do?
[QUOTE=txike;52667437]This sounds like an XY problem to me. What are you trying to do?[/QUOTE] Messing around with vehicles. I want the vehicle to change angles and move based on mouse movement while the players view is locked. I need input from the mouse (as in actual mouse movement), but not sure how to go about getting it. There seems to be no hook for it or anything like that.
Alright so I'm attempting to draw a circle on the map; which works all fine but the issue is that you can't see the circle once you're inside of it, how can I make it render? [CODE]hook.Add("PostDrawOpaqueRenderables", "circletest", function() render.SetColorMaterial() render.DrawSphere(LocalPlayer():GetPos(), 1000, 30, 30, Color(255,255,255,50)) end)[/CODE]
[QUOTE=DahDestroyer;52669216]Alright so I'm attempting to draw a circle on the map; which works all fine but the issue is that you can't see the circle once you're inside of it, how can I make it render? [CODE]hook.Add("PostDrawOpaqueRenderables", "circletest", function() render.SetColorMaterial() render.DrawSphere(LocalPlayer():GetPos(), 1000, 30, 30, Color(255,255,255,50)) end)[/CODE][/QUOTE] One way is to draw the circle inside-out by giving it negative radius [CODE]hook.Add("PostDrawOpaqueRenderables", "circletest", function() render.SetColorMaterial() render.DrawSphere(LocalPlayer():GetPos(), 1000, 30, 30, Color(255,255,255,50)) render.DrawSphere(LocalPlayer():GetPos(), -1000, 30, 30, Color(255,255,255,50)) end)[/CODE] There's probably a "right" way to do it by applying a material that draws on both faces or something.
Is there any way to perform a trace through a wall to get the position of the other side of the wall? I seem to remember someone doing it for some teleportation thing in an old WAYWO. [t]http://i.imgur.com/ywjkHmZ.png[/t]
-snip- Just noticed a mistake
[QUOTE=-Raven-;52667910]Messing around with vehicles. I want the vehicle to change angles and move based on mouse movement while the players view is locked. I need input from the mouse (as in actual mouse movement), but not sure how to go about getting it. There seems to be no hook for it or anything like that.[/QUOTE] I think [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/CreateMove]GM:CreateMove[/url] is what you're looking for. Good catch, txike!
:snip: automerge failed me after 2 posts unsurprisingly
[QUOTE=MPan1;52670164]Is there any way to perform a trace through a wall to get the position of the other side of the wall? I seem to remember someone doing it for some teleportation thing in an old WAYWO.[/QUOTE] There is no clean way to do this -- you have to step through arbitrarily until you find a clear position. Here's an excerpt from some bullet penetration code: [code]-- Config local flExitMaxDistance = 128 -- Max distance before giving up local flExitStepSize = 24 -- Step size local iMask = MASK_SOLID local bShowPenetration = true local DEBUG_LENGTH = 3 local color_altdebug = SERVER and Color(0, 255, 0, 128) or Color(255, 255, 0, 128) -- Penetration local vHitPos = -- Position to test from local vShotDir = -- Ray (normal vector) to trace along local flExitDistance = 0 local tr = {} local tTrace = { mask = iMask, filter = tEnts, output = tr } // try to penetrate object, maximum penetration is 128 inch while (flExitDistance < flExitMaxDistance) do flExitDistance = math.min(flExitMaxDistance, flExitDistance + flExitStepSize) local vHit = vHitPos + flExitDistance * vShotDir tTrace.start = vHit tTrace.endpos = vHit util.TraceLine(tTrace) if (not tr.Hit) then // found first free point goto PositionFound end end -- Nowhere to penetrate do return end ::PositionFound:: tTrace.endpos = vHitPos util.TraceLine(tTrace) local vOtherSide = tr.HitPos -- This is your result if (bShowPenetration) then debugoverlay.Line(vHitPos, vOtherSide, DEBUG_LENGTH, color_altdebug) end[/code]
[QUOTE=code_gs;52670254]There is no clean way to do this[/QUOTE] Can't you just perform one trace forward to hit the wall, one through the wall, and one back so you hit the wall? This seems to work: [CODE] local function BackSide( src, dir, distance ) local tr = util.TraceLine( { -- trace through the wall start = src + dir, endpos = src + dir * distance, mask = MASK_SOLID_BRUSHONLY } ) local tr2 = util.TraceLine( { -- trace back to hit the back of the wall start = tr.HitPos, endpos = tr.HitPos - tr.Normal * distance, mask = MASK_SOLID_BRUSHONLY } ) return tr2 -- seems to actually work end hook.Add( "EntityFireBullets", "TraceTest", function( ent, data ) local tr = util.TraceLine( { -- trace until you hit the front of the wall start = data.Src, endpos = data.Src + data.Dir * data.Distance, mask = MASK_SOLID_BRUSHONLY } ) local tr2 = BackSide( tr.HitPos, tr.Normal, data.Distance ) ent:SetPos(tr2.HitPos) debugoverlay.Sphere( tr2.HitPos, 100, 10, Color( 255, 0, 0 ) ) end ) [/CODE]
[QUOTE=NeatNit;52670199]I think [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/CreateMove]GM:CreateMove[/url] is what you're looking for. Good catch, txike![/QUOTE] Erm.. This is a client side function. I need the server to be constantly updating the angles, so would I just send the server the information every tick via net messages? That sounds disgusting though. Would that slow down the server significantly? Seems like I have no other choice. :/
[QUOTE=-Raven-;52670584]Erm.. This is a client side function. I need the server to be constantly updating the angles, so would I just send the server the information every tick via net messages? That sounds disgusting though. Would that slow down the server significantly? Seems like I have no other choice. :/[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/CUserCmd/SetViewAngles]CUserCmd:SetViewAngles[/url] [editline]11th September 2017[/editline] [QUOTE=MPan1;52670525]Can't you just perform one trace forward to hit the wall, one through the wall, and one back so you hit the wall? This seems to work: [CODE] local function BackSide( src, dir, distance ) local tr = util.TraceLine( { -- trace through the wall start = src + dir, endpos = src + dir * distance, mask = MASK_SOLID_BRUSHONLY } ) local tr2 = util.TraceLine( { -- trace back to hit the back of the wall start = tr.HitPos, endpos = tr.HitPos - tr.Normal * distance, mask = MASK_SOLID_BRUSHONLY } ) return tr2 -- seems to actually work end hook.Add( "EntityFireBullets", "TraceTest", function( ent, data ) local tr = util.TraceLine( { -- trace until you hit the front of the wall start = data.Src, endpos = data.Src + data.Dir * data.Distance, mask = MASK_SOLID_BRUSHONLY } ) local tr2 = BackSide( tr.HitPos, tr.Normal, data.Distance ) ent:SetPos(tr2.HitPos) debugoverlay.Sphere( tr2.HitPos, 100, 10, Color( 255, 0, 0 ) ) end ) [/CODE][/QUOTE] You're correct, that does actually work a lot better -- I didn't know space between brushes was empty. Make sure to use ents.GetAll for the filter so you don't run into anything while working with the world.
Sorry, you need to Log In to post a reply to this thread.