• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
How could I make a sound that has no position? One that is always at full volume, with no directional bias?
[QUOTE=WalkingZombie;46115466]How could I make a sound that has no position? One that is always at full volume, with no directional bias?[/QUOTE] [url]http://wiki.garrysmod.com/page/surface/PlaySound[/url]
[QUOTE=WalkingZombie;46115466]How could I make a sound that has no position? One that is always at full volume, with no directional bias?[/QUOTE] EmitSound with SoundLevel set to 0.
Yeah, I want to be able to change the pitch, so I do hope Robot is right
Hey. I'm new to lua, so I've made a custom hud. I put the cl_init into Program Files(x86) -> Steam -> Steam Apps -> common -> garrysmod -> garrysmod -> gamemodes -> base -> gamemode. But when I play sandbox I get: [LUA] ERROR] gamemodes/sandbox/gamemode/cl_init.lua:86: attempt to call field 'PostRenderVGUI' (a nil value) 1. unknown - gamemodes/sandbox/gamemode/cl_init.lua:86 [/LUA] Here is the script: [LUA]function hidehud(name) for l, v in pairs{"CHudHealth", "CHudBattery"} do if name == v then return false end end end hook.add("HUDShouldDraw", "hidehud", hidehud) function TestHud() local ply = LocalPlayer() local HP = ply:Health() local Velocity = ply:CMoveData:GetSideSpeed() draw.RoundedBox( 4, 130, ScrH() - 100, 200, 40, Color( 40, 40, 40, 120 ) ) draw.RoundedBox( 4, 130, ScrH() - 100, math.Clamp( HP, 0, 200)*2, 40, Color( 220, 108, 108, 255 ) ) draw.RoundedBox( 4, 130, ScrH() - 100, math.Clamp( HP, 0, 200)*2, 15, Color( 255, 255, 255, 40 ) ) draw.SimpleText( Health: HP, default, 130, ScrH() - 80, Color( 255, 255, 255, 255 ), 0, 0 ) hook.add( "HUDPaint", "TestHud", TestHud ) [/LUA] Thanks.
Put your script to addons/myfantasticaddon/lua/autorun/client/cl_myfantastichud.lua
[QUOTE=feldma;46117287]Hey. I'm new to lua, so I've made a custom hud. I put the cl_init into Program Files(x86) -> Steam -> Steam Apps -> common -> garrysmod -> garrysmod -> gamemodes -> base -> gamemode. But when I play sandbox I get: -snip- Here is the script: -snip- Thanks.[/QUOTE] also you should add and end before hook.Add (case sensitive!).
Now it's not coming up with logs etc. Current code: [LUA] function hidehud(name) for l, v in pairs{"CHudHealth", "CHudBattery"} do if name == v then return false end end end hook.Add("HUDShouldDraw", "hidehud", hidehud) end function TestHud() local ply = LocalPlayer() local HP = ply:Health() local Velocity = ply:CMoveData:GetSideSpeed() draw.RoundedBox( 4, 130, ScrH() - 100, 200, 40, Color( 40, 40, 40, 120 ) ) draw.RoundedBox( 4, 130, ScrH() - 100, math.Clamp( HP, 0, 200)*2, 40, Color( 220, 108, 108, 255 ) ) draw.RoundedBox( 4, 130, ScrH() - 100, math.Clamp( HP, 0, 200)*2, 15, Color( 255, 255, 255, 40 ) ) draw.SimpleText( Health: HP, default, 130, ScrH() - 80, Color( 255, 255, 255, 255 ), 0, 0 ) end [/LUA] I've put it in: common -> garrysmod -> garrysmod -> addons -> testhud (it's a folder) -> lua -> autorun -> client -> cl_testhud.lua. Thanks for helping.
[code] function hidehud(name) for l, v in pairs( {"CHudHealth", "CHudBattery"} ) do if name == v then return false end end end hook.Add("HUDShouldDraw", "hidehud", hidehud) function TestHud() local ply = LocalPlayer() local HP = ply:Health() local Velocity = ply:GetVelocity():Length() draw.RoundedBox( 4, 130, ScrH() - 100, 200, 40, Color( 40, 40, 40, 120 ) ) draw.RoundedBox( 4, 130, ScrH() - 100, math.Clamp( HP, 0, 200)*2, 40, Color( 220, 108, 108, 255 ) ) draw.RoundedBox( 4, 130, ScrH() - 100, math.Clamp( HP, 0, 200)*2, 15, Color( 255, 255, 255, 40 ) ) draw.SimpleText( "Health:" .. HP, default, 130, ScrH() - 80, Color( 255, 255, 255, 255 ), 0, 0 ) end hook.Add("HUDPaint", "myunique_hookname", TestHud) [/code]
[QUOTE=Giraffen93;46102470]the json string is too big too the returned html page is 8kb, shouldn't be a problem, but it exceeds 64kb while in gmod[/QUOTE] i totally forgot about util.compress now it's the regular size and networks well
[QUOTE=Robotboy655;46115975]EmitSound with SoundLevel set to 0.[/QUOTE] Problematic. It works, but I need to be able to terminate the sound, as it automatically loops.
[QUOTE=Smt;46114505]worlds most noob question ever why won't [code]string.Replace(ent.Model,".mdl",".png")[/code] work? ent.Model [i]should[/i] be returning a model path as a string ("models/props_lab/reciever01b.mdl", etc) - i know it's probably a horrible way of doing this, but why won't that work? only error i get is : [code][ERROR] lua/includes/extensions/string.lua:190: attempt to index local 'str' (a nil value)[/code] i mean im not a total tard, i guess it isn't getting a string or something along those lines but i dont really get why i don't think i should try fixing gamemodes that were already shitty in gm12 while i still suck at lua[/QUOTE] it's because a dot is used as a pattern match for any character instead you need to use % to escape it, like so [LUA]ent:GetModel():gsub( "%.mdl", "%.png" )[/LUA] read up on patterns [URL=http://www.lua.org/pil/20.2.html]here[/URL] if you want to do it even [i]better[/i], you can anchor the search to the end of the string with $ [LUA]ent:GetModel():gsub( "%.mdl$", "%.png$" )[/LUA]
How does one disable mipmaps from a texture? Also, is there a way I can get a table of ALL materials that were cached?
[QUOTE=EthanTheGreat;46120718]How does one disable mipmaps from a texture? Also, is there a way I can get a table of ALL materials that were cached?[/QUOTE] You can't really do that, you could try using "$nomip" "1" in the .vmt or simply don't include mipmaps into your texture. Also, there's is no way to do that with Lua. You can see that with +mat_texture_list though.
-snip solved-
What would the code look like to paint over the Derma Frame close button?
[QUOTE=Exho;46122270]What would the code look like to paint over the Derma Frame close button?[/QUOTE] Overriding [url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dframe.lua#L39[/url] would work, no? panel.btnClose.Paint = function()
Alright that makes sense, thanks. Also do the voice visualizers and Shout Map Vote addons use ply:VoiceVolume to measure how loud it is?
[QUOTE=Exho;46122270]What would the code look like to paint over the Derma Frame close button?[/QUOTE] I usually just remove the close button, then paint a DButton, then locate it wherever I want. Then add pnl:Close() on the button's OnClick function. [img]http://i.gyazo.com/13ef8fb1368f5989759282816f34c19f.png[/img] [editline]..[/editline] [QUOTE=Exho;46122440]Also do the voice visualizers and Shout Map Vote addons use ply:VoiceVolume to measure how loud it is?[/QUOTE] Most likely, I used that function to add a fade effect to my custom voice notify thing in bottom right corner. You should ask the creators, though.
-snip solved-
Is there some kind of quicker way for getting onto a server with custom content? I freshly installed GMod and joined a server with a bunch of custom content and I had to download nothing. I'm not sure if this really fits this thread but I stopped doing server maintenance/owning since GMod 13 released and it seems like there's a much quicker way than FastDL for clients to download content. Am I wrong? A lot of people complain about DL times but I have FastDL and everything compressed. -.-
How does the physgun work? As in how does it not move objects through walls? Trying to duplicate the behavior with a swep.
Does anyone that uses clockwork or plays on a server know what setting a door as "false" means?
[QUOTE=Giraffen93;46128360]How does the physgun work? As in how does it not move objects through walls? Trying to duplicate the behavior with a swep.[/QUOTE] AFAIK it is using an [URL="http://wiki.garrysmod.com/page/constraint/Elastic"]elastic constraint[/URL]. I am not quite sure about this though, all I know is that it is probably using one of the constraints available. Unfortunately there is little documentation (as usual) on constraints. Just take a look into the ttt weapon_zm_carry.lua. That swep is using weld to set the position. If you use elastic instead you can probably replicate the physgun behaviour.
I've been trying to see what has been causing this issue: [t]https://dl.dropboxusercontent.com/u/17839069/C_176.png[/t] If you look closely, the spoiler texture has this weird effect which I originally thought mipmaps. In this picture as you can see the aliasing is absolutely horrible. The VTF's Code is: [code] "VertexlitGeneric" { "$basetexture" "models/tdmcars/shared/carbonfiber" "$blendtintbybasealpha" 1 } [/code] My Lua Code: [lua] self.TestMat = CreateMaterial( "y", "UnlitGeneric", { ["$nomip"] = 1, ["$alpha"] = 0 } ) self.TestMat:SetTexture( "$basetexture", "models/tdmcars/shared/carbonfiber" ) [/lua] And the texture has one flag which I assume is the issue: Eight Bit Alpha I've tried already doing "$nomip" 1 Perhaps someone can help me. I don't want to consider recreating the texture unless it's the ONLY alternative to it. It might have to do with the filter the texture is going through. My GMODs setting for texture aliasing is set to Anisotropic 16x.
[QUOTE=highvoltage;46128444]Does anyone that uses clockwork or plays on a server know what setting a door as "false" means?[/QUOTE] Setting a door as false makes it unbreachable, unownable, invalid for Combine locks and makes sure the script never draws its overlay.
[QUOTE=Khub;46131741]Setting a door as false makes it unbreachable, unownable, invalid for Combine locks and makes sure the script never draws its overlay.[/QUOTE] So it's for doors that should be always accessible by everybody? Hidden just hides the overlay?
[QUOTE=highvoltage;46132709]So it's for doors that should be always accessible by everybody? Hidden just hides the overlay?[/QUOTE] [lua] -- Called when a player attempts to use a door. function Clockwork:PlayerCanUseDoor(player, door) -- ... if (self.entity:IsDoorFalse(door)) then return false; end; --- ... end; [/lua] It appears it also makes the door unusable. So /DoorSetFalse kind of seals the door shut and hides the overlay.
Does anyone know how I could have a game crash report read? Or read it myself? Garry's Mod just keeps crashing right after the start up screen pops up.
[url]http://dumps.metastruct.uk.to/[/url]
Sorry, you need to Log In to post a reply to this thread.