• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[QUOTE=MattJeanes;47608142]Is there an easy way to get a player to spectate something but keep the actual player where they were and frozen? I don't think Player:Lock/Freeze would work because you wouldn't be able to rotate the view but maybe it could work mixed with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/StartCommand]GM/StartCommand[/url]?[/QUOTE] Managed to get this working by using CalcView and StartCommand so follow up: How can I make it so things that use GetViewEntity() use my clientside CalcView pos?
How do I make a concommand talk to the server?
[QUOTE=Ott;47615571]How do I make a concommand talk to the server?[/QUOTE] Use the [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG][URL="http://wiki.garrysmod.com/page/Category:net"]net library.[/URL]
That's disappointing. ULX doesn't use net library.
[QUOTE=Ott;47615571]How do I make a concommand talk to the server?[/QUOTE] Why don't you just make the concommand on the server?
Because I need autocomplete.
Hey, so aparently the code I'm using in my depth pass is causing clientside models to lag. What's the best hook? Currently using PostDrawTranslucentRenderables, and the depth pass works but causes the attachments in things like CW2.0 to not follow correctly.
Is it possible to give weapon to a DModelPanel entity / make a DModelPanel player/npc model hold a weapon?
Create another clientside model and bonemerge it to the entity in the model panel. You have to edit the panel in a couple of places, though, since DModelPanel does its rendering manually. [lua] -- Variant of DModelPanel with extra Set/GetWeaponModel() method local PANEL = {} AccessorFunc(PANEL, "Weapon", "Weapon") function PANEL:SetModel(mdl) -- Have to do this. C_BaseFlex is bugged and doesn't GC if IsValid(self.Entity) then self.Entity:Remove() self.Entity = nil end if IsValid(self.Weapon) then self.Weapon:Remove() self.Weapon = nil end if not ClientsideModel then return end self.Entity = ClientsideModel(mdl, RENDER_GROUP_OPAQUE_ENTITY) if not IsValid(self.Entity) then return end self.Entity:SetNoDraw(true) local seq = self.Entity:LookupSequence("walk_all") if seq <= 0 then seq = self.Entity:LookupSequence("WalkUnarmed_all") end if seq <= 0 then seq = self.Entity:LookupSequence("walk_all_moderate") end if seq > 0 then self.Entity:ResetSequence(seq) end end function PANEL:SetWeaponModel(mdl) if not IsValid(self.Entity) then return end if IsValid(self.Weapon) then self.Weapon:Remove() self.Weapon = nil end if not ClientsideModel then return end self.Weapon = ClientsideModel(mdl, RENDER_GROUP_OPAQUE_ENTITY) if not IsValid(self.Weapon) then return end self.Weapon:SetNoDraw(true) self.Weapon:SetParent(self.Entity) self.Weapon:AddEffects(EF_BONEMERGE) end function PANEL:GetWeaponModel() return IsValid(self.Weapon) and self.Weapon:GetModel() end function PANEL:DrawModel() local curparent = self local rightx = self:GetWide() local leftx = 0 local topy = 0 local bottomy = self:GetTall() local previous = curparent while curparent:GetParent() do curparent = curparent:GetParent() local x, y = previous:GetPos() topy = math.max(y, topy + y) leftx = math.max(x, leftx + x) bottomy = math.min(y + previous:GetTall(), bottomy + y) rightx = math.min(x + previous:GetWide(), rightx + x) previous = curparent end render.SetScissorRect(leftx, topy, rightx, bottomy, true) self.Entity:DrawModel() if IsValid(self.Weapon) then self.Weapon:DrawModel() end render.SetScissorRect(0, 0, 0, 0, false) end function PANEL:Paint() if not IsValid(self.Entity) then return end self:LayoutEntity(self.Entity, self.Weapon) local x, y = self:LocalToScreen(0, 0) local w, h = self:GetSize() local ang = self.aLookAngle or (self.vLookatPos - self.vCamPos):Angle() cam.Start3D(self.vCamPos, ang, self.fFOV, x, y, w, h, 5, self.FarZ) cam.IgnoreZ(true) render.SuppressEngineLighting(true) render.SetLightingOrigin(self.Entity:GetPos()) render.ResetModelLighting(self.colAmbientLight.r/255, self.colAmbientLight.g/255, self.colAmbientLight.b/255) render.SetColorModulation(self.colColor.r/255, self.colColor.g/255, self.colColor.b/255) render.SetBlend(self.colColor.a/255) for i = 0, 6 do local col = self.DirectionalLight[i] if col then render.SetModelLighting(i, col.r/255, col.g/255, col.b/255) end end self:DrawModel() render.SuppressEngineLighting(false) cam.IgnoreZ(false) cam.End3D() self.LastPaint = RealTime() end function PANEL:OnRemove() if IsValid(self.Entity) then self.Entity:Remove() end if IsValid(self.Weapon) then self.Weapon:Remove() end end vgui.Register("ExtModelPanel", PANEL, "DModelPanel") [/lua]
How to use file.Write and file.Read to save player data and use it later?
[QUOTE=Scarface3353;47620464]How to use file.Write and file.Read to save player data and use it later?[/QUOTE] Step 1: Dont use files. Step 2: Look into databasing. Garry's Mod comes bundled with an SQLite database but I would personally recommend MySQL. Step 3: Profit? If you must use files, you first need to specify the structure you want the data to be saved as. Generally you can use the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/TableToKeyValues]util.TableToKeyValues[/url] function and write that to the file. To load the data, read from the file and use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/KeyValuesToTable]util.KeyValuesToTable[/url].
Could someone make a wiki tutorial of the order in which rendering hooks are called during a frame? This would be really handy.
[url]http://wiki.garrysmod.com/page/Render_Order[/url]
[QUOTE=Willox;47620539][url]http://wiki.garrysmod.com/page/Render_Order[/url][/QUOTE] It's missing all the entity callbacks and whatnot D:
I'm trying to hide a view model without preventing the accompanying functions from being being called. You used to be able to do this by setting the view model's material to debug/hsv, but it doesn't seem to work any more. Any alternatives?
use engine/occlusionproxy instead
[QUOTE=Tomelyr;47621022]use engine/occlusionproxy instead[/QUOTE] It works, thanks!
Would it be possible to use a table of vectors and see if a entity was within the boundaries of this table of vectors?
[QUOTE=Llamalord;47621227]Would it be possible to use a table of vectors and see if a entity was within the boundaries of this table of vectors?[/QUOTE] Do you already have the entity or are you searching for it? If you already have it, some maths on the individual coordinates of the vectors should provide some help (Higher level of maths than I ever bothered to understand, so you will have to ask someone who is studying maths at university). But to answer your question, yes, it's more than possible.
[QUOTE=James xX;47621551]Do you already have the entity or are you searching for it? If you already have it, some maths on the individual coordinates of the vectors should provide some help (Higher level of maths than I ever bothered to understand, so you will have to ask someone who is studying maths at university). But to answer your question, yes, it's more than possible.[/QUOTE] But would putting it on a THINK hook be expensive?
[QUOTE=Llamalord;47621602]But would putting it on a THINK hook be expensive?[/QUOTE] That would depend on how many vectors define the boundaries.
-snip-
[QUOTE=AK to Spray;47621893]This is a wild guess, but you could get the highest and lowest value for x, y, and z out of all of the vectors in your table. Then, if each of the coordinates of the entity's vector is in between (or equal to either of) the highs and lows, it should be in the boundaries.[/QUOTE] The would only work for a box shaped boundary.
Something probably stupidly simple here that is annoying me so I wrote this example code. [lua]chat.AddText( "Your number plus five is: ", Color( 100, 255, 100 ), net.ReadDouble() )[/lua] When this code is ran it only says "Your number plus five is: ", if I remove the color part though it shows up fine. What am I doing wrong :P
Add a color to the beginning
[QUOTE=Ott;47622330]Add a color to the beginning[/QUOTE] Oh, so I have to add a color to the beginning so I can change it later on? Thanks
[QUOTE=YourStalker;47622368]Oh, so I have to add a color to the beginning so I can change it later on? Thanks[/QUOTE] [URL="http://wiki.garrysmod.com/page/chat/AddText"]( Color, String (text), Player, Anything else )[/URL] That's the format. Hope it helps.
How can I rotate text using the surface and draw libraries?
How do I set where a DColorMixer should be set at? like I want it to be set to Color( 0, 255, 0 ), so the indicator things are in that positions. nevermind it was just SetColor(), was trying with SetVector
[QUOTE=_FR_Starfox64;47624055]How can I rotate text using the surface and draw libraries?[/QUOTE] [url]http://facepunch.com/showthread.php?t=1089200&p=32614030&viewfull=1#post32614030[/url]
Sorry, you need to Log In to post a reply to this thread.