• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
[QUOTE=RalphORama;52247957]Is there a good way to reload scripts when just playing around with ideas? I'm working on a SWEP and every time I make changes I have to restart my server.[/QUOTE] Unless you have the "-disableluarefresh" startup parameter set it should auto refresh just like any other Lua script.
[QUOTE=bigdogmat;52248017]Unless you have the "-disableluarefresh" startup parameter set it should auto refresh just like any other Lua script.[/QUOTE] That works sometimes, but when I change the ammo type of the SWEP (or add/remove my custom ammo type), I get "could not index a global SWEP" error, and my changes don't show up in game. When I change maps (via map <mapname>) in console, it breaks everything. I'm not sure what's going on. [B]EDIT:[/B] Also, is there an easy way to set the ammount of ammo in the current clip when another instance of the weapon is picked up? I'm tweaking a pepper spray addon. I'd like to make it so whenever a pepper spray canister is picked up (via SWEP:EquipAmmo), no ammo goes to the reserve. Instead, the current clip is immediately set to 10. I have the following, but it doesn't work. [CODE]function SWEP:EquipAmmo(ply) self:SetClip1(10) end[/CODE] Should I instead do something like [CODE]function SWEP:EquipAmmo(ply) ply:SetClip1(10)? end[/CODE]
Is there a way to outline anti-alias text without having it look so weird? [t]https://i.imgur.com/r3dwKS7.png[/t]
[QUOTE=JasonMan34;52248768]Is there a way to outline anti-alias text without having it look so weird? [t]https://i.imgur.com/r3dwKS7.png[/t][/QUOTE] Was about to just say no, but come to think of it... You can render it aliased and bigger onto a different render target with a transparent background, give it a thick outline, then draw that render target scaled down onto the original screen. This gives the effect of anti-aliasing. The downside is that you have to add the outline yourself, which isn't too easy.
[QUOTE=JasonMan34;52248768]Is there a way to outline anti-alias text without having it look so weird? [t]https://i.imgur.com/r3dwKS7.png[/t][/QUOTE] I think there's a draw.OutlinedText (or something similar) it also let's you control the colour of the outline. [editline]19th May 2017[/editline] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/draw/SimpleTextOutlined]draw.SimpleTextOutlined[/url]
[QUOTE=MPan1;52244728][url]https://facepunch.com/showthread.php?t=880347[/url] has a few useful replies[/QUOTE] So ive manged to edit a car and chaning things for my mod but now im stuck at editing the hull of the vehicle?? Also, chaing the smd file to just anything ex:barrel would that work? or is it possible?
[QUOTE=LegoGuy;52249099]I think there's a draw.OutlinedText (or something similar) it also let's you control the colour of the outline. [editline]19th May 2017[/editline] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/draw/SimpleTextOutlined]draw.SimpleTextOutlined[/url][/QUOTE] Oh shit you're right. That's a perfect solution.
[QUOTE=code_gs;52237998]Add the EF_NODRAW flag to the viewmodel to make it invisible to the local player, or to the ActiveWeapon to make it invisible to others. Also, use :IsValid() instead of NULL a comparison.[/QUOTE] Tried it, didn't work. I'm not sure if that has to be done within the swep code, because if it does, that can't work for my situation. Any other ideas? :/ Also, sorry for the really late reply.
I need to render a model at screen coordinates. Is a DModelPanel my best bet?
Yes
Is there a way to find anything on this forum without it timing out? I'm trying to find any of my posts that have [CODE] in them but I can't. I want to see if any of them are worth putting on GitHub
[code] net.Receive("finished_sort_vgui", function(len , ply) local house = tonumber(houseSettings.ReadHouse(ply:SteamID64()) || "") local models = houseSettings['models'] if(house>4) then house=4 end if(house<1) then house=1 end net.Start('send_model_vgui') net.WriteTable(models[house]) net.WriteInt(house,32) net.Send(ply) net.Start("printHouseMessage") //net.WriteString(houseSettings['house_colors'][house][1].."Welcome "..ply:Name().." to "..houseSettings['houses'][house].."!"..houseSettings['house_colors'][house][2]) net.WriteString("Welcome, "..ply:Name()..", &#1074; "..houseSettings['houses'][house].."!") net.Broadcast() end)[/code] error:[url]http://imgur.com/a/2QTKa[/url] line 126: [code] if(house>4) then house=4 end [/code]
[QUOTE=ping33;52253016][code] net.Receive("finished_sort_vgui", function(len , ply) local house = tonumber(houseSettings.ReadHouse(ply:SteamID64()) || "") local models = houseSettings['models'] if(house>4) then house=4 end if(house<1) then house=1 end net.Start('send_model_vgui') net.WriteTable(models[house]) net.WriteInt(house,32) net.Send(ply) net.Start("printHouseMessage") //net.WriteString(houseSettings['house_colors'][house][1].."Welcome "..ply:Name().." to "..houseSettings['houses'][house].."!"..houseSettings['house_colors'][house][2]) net.WriteString("Welcome, "..ply:Name()..", &#1074; "..houseSettings['houses'][house].."!") net.Broadcast() end)[/code] error:[url]http://imgur.com/a/2QTKa[/url] line 126: [code] if(house>4) then house=4 end [/code][/QUOTE] tonumber( "" ) will return nil, instead of using || inside the tonumber arguments you should use it outside in case tonumber returns nil, and use 0 instead of "", like this [code]local house = tonumber(houseSettings.ReadHouse(ply:SteamID64())) || 0[/code]
I need to draw a line of variable thickness between two arbitrary points. Does anyone have a surface.DrawLine() function with a thickness argument or similar?
Is there any way to get the players view x1, y1, x2, y2 in vectors?
[QUOTE=IcarusCoding;52253771]Is there any way to get the players view x1, y1, x2, y2 in vectors?[/QUOTE] [url]http://wiki.garrysmod.com/page/Player/GetShootPos[/url]
[QUOTE=a1steaksa;52253692]I need to draw a line of variable thickness between two arbitrary points. Does anyone have a surface.DrawLine() function with a thickness argument or similar?[/QUOTE] Only thing I can think of is using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/surface/DrawPoly]surface.DrawPoly[/url] to paint a rectangle
anyone have an example of a point-and-click style camera?
.
[QUOTE=unrezt;52254333]anyone have an example of a point-and-click style camera?[/QUOTE] What do you mean? Like when you hold open the C menu and click with the mouse? [editline]21st May 2017[/editline] [QUOTE=IcarusCoding;52253771]Is there any way to get the players view x1, y1, x2, y2 in vectors?[/QUOTE] I don't understand the question :(
[QUOTE=NeatNit;52255090]What do you mean? Like when you hold open the C menu and click with the mouse?[/QUOTE] Think Runescape, or Diablo, or any point and click game really... when you click, your mouse position is projected from the screen into the world and your character moves to it.
[QUOTE=unrezt;52255126]Think Runescape, or Diablo, or any point and click game really... when you click, your mouse position is projected from the screen into the world and your character moves to it.[/QUOTE] Do you want it to be top-down or from the first-person view of the player?
[QUOTE=cody1111;52255305]Do you want it to be top-down or from the first-person view of the player?[/QUOTE] Ideally it should be able to zoom and rotate around the character model with the scroll wheel. I can handle the camera/calcview parts, it's the mouse click position to world position and making the playermodel walk there bit that's troubling me.
[QUOTE=unrezt;52255335]mouse click position to world position[/quote]Get the mouse position, use gui.ScreenToVector, and run a trace from the camera position in that direction. The HitPos is the world position, and you also get which entity was clicked. [QUOTE=unrezt;52255335]and making the playermodel walk there[/QUOTE] This I don't know much about. You might have luck replacing the player with an NPC and ordering the NPC to move there. Pathfinding is the issue, and Source already does that pretty well, so don't try to reinvent that wheel.
Is there a function that returns the panel that is currently open on the player's screen?
[QUOTE=bilbasio;52257321]Is there a function that returns the panel that is currently open on the player's screen?[/QUOTE] There's [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/vgui/GetHoveredPanel]vgui.GetHoveredPanel[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/vgui/GetKeyboardFocus]vgui.GetKeyboardFocus[/url] but I don't think what you want exists. What will it return if multiple panels are open?
[QUOTE=JasonMan34;52257330]There's [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/vgui/GetHoveredPanel]vgui.GetHoveredPanel[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/vgui/GetKeyboardFocus]vgui.GetKeyboardFocus[/url] but I don't think what you want exists. What will it return if multiple panels are open?[/QUOTE] A table of panels I suppose, because I want to modify elements in a panel using the net library but I must have a way to get the panel with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/net/Receive]net.Receive[/url].
[QUOTE=bilbasio;52257348]A table of panels I suppose, because I want to modify elements in a panel using the net library but I must have a way to get the panel with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/net/Receive]net.Receive[/url].[/QUOTE] Can you describe what you're trying to do? I'm guessing you're only looking for a panel of your custom type.
[QUOTE=NeatNit;52257441]Can you describe what you're trying to do? I'm guessing you're only looking for a panel of your custom type.[/QUOTE] I'm making a trading menu, I need to update what the other player puts in the menu with the net library so I need to access the panel in the net.Receive since I can't put it in the panel's base.
[QUOTE=bilbasio;52257465]I'm making a trading menu, I need to update what the other player puts in the menu with the net library so I need to access the panel in the net.Receive since I can't put it in the panel's base.[/QUOTE] Simplest solution I can think of is to give each trading session a unique ID, and identify the correct panel using this ID.
Sorry, you need to Log In to post a reply to this thread.