• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
Anyone know how to make text actually wrap around something? I've tried a whole bunch of combinations but it doesn't fucking work. [t]http://i.imgur.com/AQT2GfH.jpg[/t] [code] local Tag = vgui.Create( "DLabel", ListItem ) Tag:SetPos( 10, 60 ) Tag:SetText( Class[i]["description"] ) Tag:SetFont( "Trebuchet18" ) Tag:SetDark(true) Tag:SetAutoStretchVertical( true ) Tag:SetWrap( true ) Tag:SizeToContents()[/code]
[QUOTE=Robotboy655;45731015]1) Use nil or the default value which you can find on the wiki 2) I'd like to see a screencap of the error 3) Why do you create a SERVERSIDE concommand to send a net message to CLIENT and open a CLIENTSIDE menu? Why not just make a clientside concommand to call the OpenLoadoutMenu function?[/QUOTE] 1) So "autoCompleteFunc=nil"? There are no examples of all the function arguments being used on the Wiki (or the other 2 wikis) which is confusing. 2) Well I joined the random server I found my addon on and the loadout menu seems to work fine... I SWEAR I AM NOT CRAZY!!! Anyways, this isnt all that helpful but it was red text and said something to the degree of "FCVAR_SERVER_CAN_EXECUTE prevented 'wl_open' from being run" even though I had no flags. 3) I never said I was smart... Sorry for wasting your time.
I'm having problems with NPC zombies and custom models. NPC_Zombie, NPC_Zombine, and NPC_FastZombie all refuse to use the SetModel command that I pass it. Relevant Code: [lua] self.ent1 = ents.Create("npc_zombine") self.ent1:SetPos(self:GetPos()) self.ent1:SetAngles(self:GetForward():Angle()) self.ent1:SetModel( "models/jessev92/hecu_zombie_npc.mdl" ) [/lua] Do zombies just not have the ability to set models, or is this a bug?
So I've been working on a custom gamemode for a while now and want to test it on a local dedicated server. I've followed some instructions on SteamCMD, have the server able to run and can switch it to my gamemode, but when I connect to it I just get: [CODE]Couldn't include file 'mygamemode\gamemode\cl_init.lua' (File not found) (<nowhere>)[/CODE] Is this a failure to send the files I've called AddCSLuaFile on, due to a failure in switching to the gamemode on the server? I'm pretty green to Garry's Mod in general, let alone writing gamemodes or administrating a server, so sorry if my framing of the problem is poor. [B]Edit:[/B] I'm dumb. I didn't occur to me until right after posting that I had been googling everything except for the error message. Googled that and bam, solved my problem. Needed to move calling "gamemode" from server.cfg to autoexec.cfg.
Is there a simple debug/debugwhite texture that isn't affected by lighting? I just want to render a white rotated rect and color it :/
[QUOTE=CrashLemon;45733013]Is there a simple debug/debugwhite texture that isn't affected by lighting? I just want to render a white rotated rect and color it :/[/QUOTE] [code] surface.SetTexture(0) [/code]
Only use size to contents and set multiline and ListItem needs to have setwrap. [QUOTE=ROFLBURGER;45731233]Anyone know how to make text actually wrap around something? I've tried a whole bunch of combinations but it doesn't fucking work. [t]http://i.imgur.com/AQT2GfH.jpg[/t] [code] local Tag = vgui.Create( "DLabel", ListItem ) Tag:SetPos( 10, 60 ) Tag:SetText( Class[i]["description"] ) Tag:SetFont( "Trebuchet18" ) Tag:SetDark(true) Tag:SetAutoStretchVertical( true ) Tag:SetWrap( true ) Tag:SizeToContents()[/code][/QUOTE] [editline]19th August 2014[/editline] Ok, i am trying to get the printname of all weapons on the server and set that text to a dbutton, [LUA] for k, v in pairs( weapons.GetList() ) do local wep = vgui.Create( "DButton" ) wep:SetText( (v.PrintName ) end [/LUA] On set text i get attempt to use nil value. [editline][/editline] Fixed, some weapons on the server had nil printnames.
[QUOTE=TheBerryBeast;45733145]Only use size to contents and set multiline and ListItem needs to have setwrap. [/QUOTE] Couldn't get that working, probably due to how I got it set up. Is there a way to color certain areas of text with a DLabel without creating multiple Dlabels?
[QUOTE=ROFLBURGER;45733346]Couldn't get that working, probably due to how I got it set up. Is there a way to color certain areas of text with a DLabel without creating multiple Dlabels?[/QUOTE] No, not without multiple labels or your own Paint function.
Not true rabbit. [lua] local mark = markup.Parse('<color=255,102,102>'..dlabel:GetText()..'</color>') dlabel.Draw = function() mark:Draw(0,0) end [/lua] You can also wrap text by passing a max width for the second parameter on parse.
[QUOTE=Robotboy655;45728982]What's the best way to render a png or jpg from Internet, without using HTML control? ( because it spawns infinite amount of Awesomium processes )[/QUOTE] You need to be able to obtain the binary data (which can be formatted as a jpg or a png) from that image somehow. Perhaps you can use the included steam browser to transfer the data instead. Then again, there's no way I can think of to convert said binary data back into a image for rendering (png, jpg). (render.Capture for example, you can only convert to a txt file, and there's no function to change it back to a jpg that I know of) I actually wanted to do something similar, however I never wanted/considered using DHTML and GetHTMLMaterial because it's hacky. EDIT: That's sick
[QUOTE=Robotboy655;45728982]What's the best way to render a png or jpg from Internet, without using HTML control? ( because it spawns infinite amount of Awesomium processes )[/QUOTE] Write it to a file in data and use this 'feature': [url]http://facepunch.com/showthread.php?t=1413999&p=45654585&viewfull=1#post45654585[/url]
Is there anyway in lua to write text out like this? [img]http://puu.sh/aZ1g0/1da9ea8c6f.png[/img]
Iterate over each character in a string and grab each character's size so you can stack them on top of each other.
[QUOTE=NiandraLades;45737126]Is there anyway in lua to write text out like this? [IMG]http://puu.sh/aZ1g0/1da9ea8c6f.png[/IMG][/QUOTE] [code] local function DrawTextVert(x,y,text,col,font) col = col or color_white font = font or "Default" text = text:gsub(".", "%1\n") draw.DrawText(text, font, x, y, col, 0) end [/code] May be sh*t because it calls :gsub() each time but it works
Is using FindInSphere at the hitposition of a trace bad? The trace will be called fairly often as its a 3d2d object that I am drawing and I want to make it so that people dont necessarily have to look directly at the object but in its general area.
heey guys, i've just installed the Silent AWP and the silenced m4a1 from here: [url]http://facepunch.com/showthread.php?t=1238474[/url] But now it seem's to happen that on some map's the AWP spawns on the ground as a normal weapon with the same ammo/damage rate. This is what i don't want to happen ofcourse the AWP should be traitor only. Will it help changing SWEP.AutoSpawnable = true to false?
[QUOTE=NiandraLades;45737126]Is there anyway in lua to write text out like this? [img]http://puu.sh/aZ1g0/1da9ea8c6f.png[/img][/QUOTE] [lua]local function VertiText(text, font, x, y) font = font or "targetid" col = col or color_white for i = 1, string.Len( text ) do draw.SimpleText( text[i], font, x, y + (15 * i ), col ) end end[/lua] Untested, written on school laptop, 100% pseudo. Method might not be the best but it should work, not sure to be perfectly honest! :D EDIT -- Don't remember if it's string.Len or string.len; I'm sure you can figure it out yourself.
[QUOTE=NoFearzz;45742026]heey guys, i've just installed the Silent AWP and the silenced m4a1 from here: [url]http://facepunch.com/showthread.php?t=1238474[/url] But now it seem's to happen that on some map's the AWP spawns on the ground as a normal weapon with the same ammo/damage rate. This is what i don't want to happen ofcourse the AWP should be traitor only. Will it help changing SWEP.AutoSpawnable = true to false?[/QUOTE] Yes. You really could have googled that.
How would I change how a certain [B]existing[/B] custom panel type is drawn? Lets say there's a gamemode that registers a certain panel via vgui.Register, how would I retrieve the information from that panel so I can change its Paint function and affect every panel created using it?
[QUOTE=CrashLemon;45744080]How would I change how a certain [B]existing[/B] custom panel type is drawn? Lets say there's a gamemode that registers a certain panel via vgui.Register, how would I retrieve the information from that panel so I can change its Paint function and affect every panel created using it?[/QUOTE] I'm pretty sure you do it with [URL="http://wiki.garrysmod.com/page/vgui/GetControlTable"]vgui.GetControlTable[/URL]("TheirCustomPanelType") Untested but seems likely:[lua]local PANEL = vgui.GetControlTable("CustomPanel") PANEL.Paint = function(self,w,h) --new paint function end[/lua]
[QUOTE=wh1t3rabbit;45744177]I'm pretty sure you do it with [URL="http://wiki.garrysmod.com/page/vgui/GetControlTable"]vgui.GetControlTable[/URL]("TheirCustomPanelType") Untested but seems likely:[lua]local PANEL = vgui.GetControlTable("CustomPanel") PANEL.Paint = function(self,w,h) --new paint function end[/lua][/QUOTE] Yep, it works like expected, thanks a bunch.
Anyone know if the cell phone model still exists in gmod vanilla? and if so what is the path?
[QUOTE=BFG9000;45744229]Anyone know if the cell phone model still exists in gmod vanilla? and if so what is the path?[/QUOTE] It got removed, but I can upload the model and material; give me a minute. Edit: [url=http://www.mediafire.com/download/03sqsj489tyair3/CameraPhone.rar]Download[/url]
Is there any existing example of drawing text above a player's head? I've tried the example on the old wiki, but it doesn't seem to work. This is my code: [lua] local tr = util.TraceLine{ start = EyePos(), endpos = EyePos() + EyeAngles():Forward() * 1000, filter = function( ent ) return ent:IsPlayer() and ( not ent == LocalPlayer() ) end } if tr.Hit then if tr.HitGroup == 1 then local offset = Vector( 0, 0, 85 ) local ang = LocalPlayer():EyeAngles() local pos = tr.Entity:GetPos() + offset + ang:Up() ang:RotateAroundAxis( ang:Forward(), 90 ) ang:RotateAroundAxis( ang:Right(), 90 ) cam.Start3D2D( pos, Angle( 0, ang.y, 90 ), 0.25 ) draw.DrawText( tr.Entity:GetID() .. "\n" .. tr.Entity:Health(), "TargetID", 2, 2, Color( 255, 255, 255 ), TEXT_ALIGN_CENTER ) cam.End3D2D() end end [/lua] It's all inside HUDPaint and :GetID() is a valid function. There's no errors either.
Print something inside the if statements to ensure the code is being reached.
[QUOTE=Jeezy;45747552]Print something inside the if statements to ensure the code is being reached.[/QUOTE] Yeah, it's being reached and I still get nothing [editline]August 20, 2014[/editline] It seems like the filter is being fully ignored, it prints even if the trace doesn't hit a player..
Ok, im making a little mining system for a gamemode im working on and everything is working fine apart from displaying the data in a gui. Server: [CODE] util.AddNetworkString( "RockData" ) util.AddNetworkString( "SendRocks" ) -- This just sends the updated rock data to the user. net.Receive( "RockData", function( len, ply ) rock = ply:GetNWInt("rock") bronze = ply:GetNWInt("bronze") silver = ply:GetNWInt("silver") gold = ply:GetNWInt("gold") diamond = ply:GetNWInt("diamond") onyx = ply:GetNWInt("onyx") net.Start( "SendRocks" ) net.WriteString(rock) net.WriteString(bronze) net.WriteString(silver) net.WriteString(gold) net.WriteString(diamond) net.WriteString(onyx) net.Send(ply) end ) [/CODE] Client: [CODE] net.Receive( "SendRocks", function( len, ply ) rock = net.ReadString(); bronze = net.ReadString(); silver = net.ReadString(); gold = net.ReadString(); diamond = net.ReadString(); onyx = net.ReadString(); print(tonumber(rock)) print(bronze) print(silver) print(gold) print(diamond) print(onyx) end ) function RequestRock() net.Start( "RockData" ) net.WriteString( "Hello i want my fucking rocks please" ) net.SendToServer() end concommand.Add("TestRock", RequestRock) function RockMenu(ply) local frame = vgui.Create("DFrame") frame:SetSize(700,400) frame:SetTitle("Basewars Rock Menu") frame:MakePopup() frame:ShowCloseButton(true) frame:SetPos(ScrW()/2-350,ScrH()/2-200) function frame:Paint(w,h) draw.RoundedBox(0,0,0,700,500,Color(0,0,0,230)) draw.RoundedBox(0,0,0,700,25,Color(0,0,0,255)) end local rock = vgui.Create( "DButton", frame ) rock:SetSize( 680, 30 ) rock:SetPos( 10, 30 ) rock:SetText( "Rock(s):"..tonumber(rock) ) -- cant get the rocks to display at alll in here, i get the error below this is 479 rock.DoClick = function( rock ) DropRock(ply) end local bronze = vgui.Create( "DButton", frame ) bronze:SetSize( 680, 30 ) bronze:SetPos( 10, 65 ) bronze:SetText( "Bronze(s):" ) bronze.DoClick = function( bronze ) end local silver = vgui.Create( "DButton", frame ) silver:SetSize( 680, 30 ) silver:SetPos( 10, 100 ) silver:SetText( "Silver(s):" ) silver.DoClick = function( silver ) end local gold = vgui.Create( "DButton", frame ) gold:SetSize( 680, 30 ) gold:SetPos( 10, 135 ) gold:SetText( "Gold(s):" ) gold.DoClick = function( gold ) end local diamon = vgui.Create( "DButton", frame ) diamon:SetSize( 680, 30 ) diamon:SetPos( 10, 170 ) diamon:SetText( "Diamond(s):" ) diamon.DoClick = function( diamon ) end local onyx = vgui.Create( "DButton", frame ) onyx:SetSize( 680, 30 ) onyx:SetPos( 10, 205 ) onyx:SetText( "Onyx(s):" ) onyx.DoClick = function( onyx ) end function rock:Paint(w,h) draw.RoundedBox(0,0,0,680,30,Color(127, 140, 141,230)) end function bronze:Paint(w,h) draw.RoundedBox(0,0,0,680,30,Color(127, 140, 141,230)) end function silver:Paint(w,h) draw.RoundedBox(0,0,0,680,30,Color(127, 140, 141,230)) end function gold:Paint(w,h) draw.RoundedBox(0,0,0,680,30,Color(127, 140, 141,230)) end function diamon:Paint(w,h) draw.RoundedBox(0,0,0,680,30,Color(127, 140, 141,230)) end function onyx:Paint(w,h) draw.RoundedBox(0,0,0,680,30,Color(127, 140, 141,230)) end end net.Receive( 'rmenu', RockMenu ) [/CODE] [CODE] [ERROR] gamemodes/basewars/gamemode/cl_init.lua:479: attempt to concatenate a nil value 1. func - gamemodes/basewars/gamemode/cl_init.lua:479 2. unknown - lua/includes/modules/net.lua:32 [/CODE] Can't get it to display in the DButton's label.
[QUOTE=HumbleTH;45747661]Yeah, it's being reached and I still get nothing [editline]August 20, 2014[/editline] It seems like the filter is being fully ignored, it prints even if the trace doesn't hit a player..[/QUOTE] Have you tried doing it in this hook? [url]http://wiki.garrysmod.com/page/GM/HUDDrawTargetID[/url] Or this one: [url]http://wiki.garrysmod.com/page/GM/PostDrawOpaqueRenderables[/url]
[QUOTE=Lucky9Two;45744281]It got removed, but I can upload the model and material; give me a minute. Edit: [url=http://www.mediafire.com/download/03sqsj489tyair3/CameraPhone.rar]Download[/url][/QUOTE] Thank you. Perhaps I'll request it be put back into the game by default.
Sorry, you need to Log In to post a reply to this thread.