• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[QUOTE=101kl;48046378]The parent is a child of a DListLayout so it's also returning 0,0 as it's GetPos :suicide:[/QUOTE] Sacrifice 3 goats on the next full moon while chanting "Vinh'll fix it".
[QUOTE=Revenge282;48046547]Sacrifice 3 goats on the next full moon while chanting "Vinh'll fix it".[/QUOTE] As tempting as that sounds, i have found a hacky workaround. [lua] local childsize = 75 local x,y = frame:CursorPos() local m,t = child:CursorPos() somepanel:SetPos(x+math.abs(m-childsize), y+math.abs(t-childsize)) [/lua]
Been a long time since I last worked with entities. Did NW calls get changed to use the new net system so it doesn't impact performance like it did before?
[QUOTE=Klaes4Zaugen;48047316]Did NW calls get changed to use the new net system so it doesn't impact performance like it did before?[/QUOTE] Yes, however _Kilburn's NW vars will be rolled back once again unfortunately, as they're still crash-happy, and we'll go back to Garry's unoptimised NW vars.
[QUOTE=Jvs;48047344]Yes, however _Kilburn's NW vars will be rolled back once again unfortunately, as they're still crash-happy, and we'll go back to Garry's unoptimised NW vars.[/QUOTE] When will that happened?
[QUOTE=Klaes4Zaugen;48047346]When will that happened?[/QUOTE] [QUOTE=Robotboy655;48032599]I know NWVars are fucked, I have rolled them back already in Dev branch.[/QUOTE] [QUOTE=Robotboy655;48018487]The update will be out before the summer ends. I am thinking maybe 1st July.[/QUOTE]
[QUOTE=Jvs;48047357][/QUOTE] I usually don't browse Facepunch
Does anyone know if this is caused by an addon or srcds itself? [quote] httpclient.cpp (1541) : Assertion Failed: Bad absolute URL to CHTTPClientRequest constructor, must start with protocol:// Assert( Assertion Failed: Bad absolute URL to CHTTPClientRequest constructor, must start with protocol:// ):/home/buildbot/buildslave_steam/steam_rel_client_linux/build/src/common/httpclient.cpp:1541 Uploading dump (in-process) [proxy ''] /tmp/dumps/assert_20150624211354_1.dmp [/quote] Mentioned dump is [url=https://dev.kuubstudios.com/assert_20150624211354_1.dmp]here[/url]
[img]http://i.imgur.com/kYVVTZE.jpg[/img] So I'm using DPanels and I want to make the panels clickable how do I go about that? Bare in mind they are in a grid [lua] local CardFrameRow = vgui.Create('DGrid', CardRowPanel) CardFrameRow:SetCols(5) CardFrameRow:SetPos(0,0) CardFrameRow:SetColWide(215) CardFrameRow:SetRowHeight(380) for i = 1, 5 do local CardFrames = vgui.Create('DPanel') CardFrames:SetSize(210, 380) CardFrameRow:AddItem(CardFrames) end [/lua]
[QUOTE=FreddiRox!;48051569]99 problems[/QUOTE] Use :MakePopup() your DGrid I guess. You should have posted more of your code though. The base parent (Usually a DFrame) usually has MakePopup get called on it which gives you the mouse pointer.
It's a DPanel not a DFrame, the whole of the code for that function is this: [lua]net.Receive('OpenPack', function () local CardRowPanel = vgui.Create('DPanel') CardRowPanel:SetPos(ScrW()/2-((212*5)/2), ScrH()/2-(340/2)) CardRowPanel:SetSize(215*5+5, 380) CardRowPanel:SetVisible(true) CardRowPanel:SetBackgroundColor(Color(0, 0, 0, 0)) -- The panel slightly overlaps the end of the last card, but who cares right? Or should I say, who cards? Hahahaha, memes. local CardFrameRow = vgui.Create('DGrid', CardRowPanel) CardFrameRow:SetCols(5) CardFrameRow:SetPos(0,0) CardFrameRow:SetColWide(215) CardFrameRow:SetRowHeight(380) for i = 1, 5 do local CardFrames = vgui.Create('DPanel') CardFrames:SetSize(210, 380) CardFrameRow:AddItem(CardFrames) end end ) [/lua] [editline]25th June 2015[/editline] But never mind, that works regardless thank you!
Hey guys, is there a way to check the age of an entity from within the entity itself?
[QUOTE=B10H4Z4RD;48052430]Hey guys, is there a way to check the age of an entity from within the entity itself?[/QUOTE] You could use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/OnEntityCreated]GM/OnEntityCreated[/url] and set a variable on the entity with a value of RealTime, CurTime or os.time. To get the age, compare the time to the same function to used. i.e If you used CurTime, use: [lua] local lifeTime = CurTime() - ent.createdAt; [/lua]
How do I correctly use render.BrushMaterialOverride(), calling it prior to render.RenderView or in PreRender has no effect. [URL="http://facepunch.com/showthread.php?t=1472350"]The code I am using[/URL] works fine for models/entities with ModelMaterialOverride, but I can't get it to work on the world with BrushMaterialOverride.
So, I want to make it so in hammer I can place down a scripted entity. For example, I'm trying to get a 'rt_cheese' that I placed in the map in hammer to create the rt_cheese entity I made for my gamemode. after googling harder i figured it out ok wait no it's still not working for some odd reason, it might be my entities though
[QUOTE=Soren;48053890]So, I want to make it so in hammer I can place down a scripted entity. For example, I'm trying to get a 'rt_cheese' that I placed in the map in hammer to create the rt_cheese entity I made for my gamemode. after googling harder i figured it out ok wait no it's still not working for some odd reason, it might be my entities though[/QUOTE] You just place the entity in hammer and it will work in game; if you want it to work the same as other entities, with a specific visual appearance in hammer and extra key-values for editing, then you need to set up a [URL="https://developer.valvesoftware.com/wiki/FGD"]custom FGD file[/URL]
[QUOTE=wh1t3rabbit;48054047]You just place the entity in hammer and it will work in game; if you want it to work the same as other entities, with a specific visual appearance in hammer and extra key-values for editing, then you need to set up a [URL="https://developer.valvesoftware.com/wiki/FGD"]custom FGD file[/URL][/QUOTE] Yeah, I was just trying it with sent_ball but it wasn't appearing when I loaded up thhe map in my gamemode.
Is there anyway to stop the player animations when a player runs/walks? I am setting a gesture on the player but the running/walking animations seem to overwrite it and cause the hands to go inside the body and strange stuff
[QUOTE=B10H4Z4RD;48044949]Hello all! I was wondering if there was a way to modify a weapon individually. For example, I have this script: How could I modify this to make it give me a version of the weapon I passed it with one value modified? For example, if I passed it [URL="http://pastebin.com/9STz3B8g"]weapon_zm_rifle[/URL], is there any way for the rifle the player receives to have SWEP.ViewModelFlip = true?[/QUOTE] Just use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetWeapon]Player:GetWeapon[/url] to find the weapon entity and then you can modify it to your hearts desire. Example: [lua] local class = "swepname" -- define the swep we are editing/giving ply:Give( class ) -- gives the player the weapon if ply:HasWeapon( class ) then -- check we actually got the weapon first local weapon = ply:GetWeapon( class ) -- find and define the players weapon entity weapon.ViewModelFlip = true -- do whatever you want with it end [/lua]
[QUOTE=FreddiRox!;48051569][img]http://i.imgur.com/kYVVTZE.jpg[/img] So I'm using DPanels and I want to make the panels clickable how do I go about that? Bare in mind they are in a grid [lua] local CardFrameRow = vgui.Create('DGrid', CardRowPanel) CardFrameRow:SetCols(5) CardFrameRow:SetPos(0,0) CardFrameRow:SetColWide(215) CardFrameRow:SetRowHeight(380) for i = 1, 5 do local CardFrames = vgui.Create('DPanel') CardFrames:SetSize(210, 380) CardFrameRow:AddItem(CardFrames) end [/lua][/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/PANEL/OnMousePressed]PANEL/OnMousePressed[/url]
When I stay close to wall, TraceHull stops detecting entities. I know the reason is huge mins and maxs. How to fix this without reducing them? Code: [code]local trace = util.TraceHull({ start = self.Owner:GetShootPos(), endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * 4096, filter = self.Owner, mins = Vector(-20, -20, -20), maxs = Vector(20, 20, 20) })[/code]
Do multiple traces. I usually do a trace line first, if nothing was hit, the do a hull trace.
I'm trying to change the crosshair's colour based on NPC relationship to player. However I'm getting "attempt to call method 'GetRelationship' (a nil value)" Any idea how to fix that? Part of the code: [code] surface.SetTexture( ch1 ) surface.SetDrawColor( 255, 255, 255, 255 ) surface.DrawTexturedRect(x - 8, y - 8, 16, 16) local ent = self.Owner:GetEyeTrace().Entity if IsValid(ent) and ent:IsNPC() and ent:GetRelationship(self.Owner) == D_LI then surface.SetDrawColor( 0, 255, 0, 255 ) end [/code]
[QUOTE=Deagle195;48059945]I'm trying to change the crosshair's colour based on NPC relationship to player. However I'm getting "attempt to call method 'GetRelationship' (a nil value)" Any idea how to fix that? Part of the code: [code] surface.SetTexture( ch1 ) surface.SetDrawColor( 255, 255, 255, 255 ) surface.DrawTexturedRect(x - 8, y - 8, 16, 16) local ent = self.Owner:GetEyeTrace().Entity if IsValid(ent) and ent:IsNPC() and ent:GetRelationship(self.Owner) == D_LI then surface.SetDrawColor( 0, 255, 0, 255 ) end [/code][/QUOTE] Set the color before you draw?
[url=http://facepunch.com/showthread.php?t=1473040&p=48059821#post48059821]Help[/url] :suicide:
Short answer - no way to do it afaik. Relationships are stored on the server and not really networked to the player. If you don't mind networking it, you can do something like this: [code]if SERVER then util.AddNetworkString( "NPC_RELATIONSHIP" ) local function PushUpdate( ) local j, k, v, n for k, v in ipairs( player.GetAll( ) ) do net.Start( "NPC_RELATIONSHIP" ) for j, n in ipairs( ents.GetAll( ) ) do if not n:IsNPC( ) then continue end net.WriteInt( n:EntIndex( ), 16 ) net.WriteInt( n:GetRelationship( v ), 8 ) end net.WriteInt( -4096, 16 ) net.Send( v ) end end timer.Create( "UpdateRelationships", 5, 0, PushUpdate ) else local meta = FindMetaTable( "Entity" ) function meta:GetRelationshipWithLocalPlayer( ) return self.store or D_NU end local function ReceiveUpdate( len ) local index, val repeat index = net.ReadInt( 16 ) val = net.ReadInt( 8 ) if index == -4096 then break end Entity( index ).store = val until index == -4096 end net.Receive( "NPC_RELATIONSHIP", ReceiveUpdate ) end[/code]
Being annoyed by some ammo type fuckery at the moment. Long story short I'm making some sweps and I wanted to try out custom ammo types. I tried using [url]http://wiki.garrysmod.com/page/game/AddAmmoType[/url], and it [I]appears[/I] like it's working. There's a few problems however: - When I have an entity I made give you ammo, it says #ssf_7.62x39mm_ammo*, even though the real name of it is ssf_7.62x39mm. - When a swep tries to use the ammo type I made, the ammo counter disappears as if I had tried to use a non-existent ammo type (see asterisk). - Attempting to get the amount of ammo the player has in reserve via weapn:Ammo1() and self.Owner:GetAmmoCount("ssf_7.62x39mm"), it always returns 0. - If I'm holding a swep that uses the ammo and I pickup more of said ammo, the swep does not realize that I got more ammo and as a result still can't fire/reload. It does however work if I get the ammo, then give myself the swep. *The ammotype definitely exists though because I get the ammo (notification) when I use the entity (it doesn't give ammo at all if you don't use addammotype blablabla...), and because the swep consumes the ammo (keeps reloading until (I think) the reserve ammo runs out, stops firing when the mag is empty, and a custom ammo counter I made returns the ammo in the mag, unlike with reserve ammo). edit: I also just tried using what the notification says when you pick up ammo as ammo and it (the notification's name for the ammo) definitely doesn't exist.
[img]http://puu.sh/iDYQH/3abde9bcec.png[/img] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/ENTITY/GetRelationship]ENTITY/GetRelationship[/url] It's a server only function - you can't use it clientside.
Need some help with this dumb DComboBox. [CODE] for _, v in pairs( weapons.GetList() ) do if v.Kind == WEAPON_HEAVY then local weapon = v.ClassName local printname = v.PrintName dlang:AddChoice(printname, weapon) print( weapon ) end end[/CODE] I give it both a value and a data, yet when printing "weapon" or calling on the button for "data" I'm always given the value. When I put "weapon" as value, it returns "weapon" so I know the problem is that it's not taking the "data" at all... Any help?
[QUOTE=B10H4Z4RD;48060840]Need some help with this dumb DComboBox. [CODE] for _, v in pairs( weapons.GetList() ) do if v.Kind == WEAPON_HEAVY then local weapon = v.ClassName local printname = v.PrintName dlang:AddChoice(printname, weapon) print( weapon ) end end[/CODE] I give it both a value and a data, yet when printing "weapon" or calling on the button for "data" I'm always given the value. When I put "weapon" as value, it returns "weapon" so I know the problem is that it's not taking the "data" at all... Any help?[/QUOTE] Don't use v.PrintName(it would work totally fine but there is no need to), use Weapon:GetPrintName(). [editline]26th June 2015[/editline] Here's a nice bump: [quote=A Fghtr Pilot;1][url=http://facepunch.com/showthread.php?t=1473040]Help[/url] :suicide:[/quote]
Sorry, you need to Log In to post a reply to this thread.