• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
[QUOTE=G4MB!T;52635190]Well ye I get that, but each weapon uses it so..[/QUOTE] Then yes, you have to create it in each weapon. Ex. for weapon_rrp_test: [code]SWEP.Base = "weapon_rrp_base" SWEP.rrpWeapons = {test = 1337}[/code]
What's the preferred style to let people know they're meant to enter in a value? For example, Discord's API documentation does this curly bracket thing: [QUOTE] [url]https://discordapp.com/api/webhooks/[/url][B]{WEBHOOK_ID}[/B]/[B]{WEBHOOK_TOKEN}[/B] [/QUOTE] In this case the style looks fine, but for my readme it looks terrible: [CODE] local FirstPressed = false hook.Add( "Think", "CallBinding", function() local cache = input.IsButtonDown( {BUTTON} ) if cache and FirstPressed then {CODE} end FirstPressed = !cache end ) [/CODE] What should I do?!?!?!?!
[QUOTE=MPan1;52636130]What's the preferred style to let people know they're meant to enter in a value? For example, Discord's API documentation does this curly bracket thing: In this case the style looks fine, but for my readme it looks terrible: [CODE] local FirstPressed = false hook.Add( "Think", "CallBinding", function() local cache = input.IsButtonDown( {BUTTON} ) if cache and FirstPressed then {CODE} end FirstPressed = !cache end ) [/CODE] What should I do?!?!?!?![/QUOTE] IMO, don't use curly braces cus they're plain ugly. Besides that, just use something that's obviously not part of the language syntax or regular command input (like parentheses in URLs, which is valid input and also common on Wikipedia). You can never go wrong with angle and square brackets for most purposes, though, since they're pretty universal especially for text command syntax: [quote]gm_givetooltrust <name> <0/1>[/quote] [quote]gm_kick <name> [reason][/quote] [quote][url]https://discordapp.com/api/webhooks/[/url][b]<hook-id>[/b]/[b]<hook-token>[/b][/quote] [lua] local FirstPressed = false hook.Add( "Think", "CallBinding", function() local cache = input.IsButtonDown(<KEY enum>) if cache and FirstPressed then <code> end FirstPressed = !cache end ) [/lua] Alternatively, if you're stuck with syntax highlighting and don't want it to look stupid, you can use obvious dummy vars and comments: [lua] local FirstPressed = false hook.Add( "Think", "CallBinding", function() local cache = input.IsButtonDown(KEY_FOO) if cache and FirstPressed then -- your code here end FirstPressed = !cache end ) [/lua]
Getting this error [CODE]Error in hook HUDPaint: addons/darkrpmodification-master/lua/darkrp_modules/zhud/cl_hud.lua:212: attempt to concatenate local 'playerSalary' (a nil value) stack traceback: addons/darkrpmodification-master/lua/darkrp_modules/zhud/cl_hud.lua:212: in function 'fn' addons/darkrpmodification-master/lua/ulib/shared/hook.lua:110: in function <addons/darkrpmodification-master/lua/ulib/shared/hook.lua:93> [C]: in function '•&#8298;&#8206;&#8301;&#8203;&#8236;&#8303;&#8234;•' [/CODE] This is the code: [CODE]local playerSalary = LocalPlayer():getDarkRPVar("salary") draw.SimpleText(playerTeam.."($"..playerSalary..")","Trebuchet",ScrW() * 0.68,ScrH() * 0.977,Color(255,255,255,255),TEXT_ALIGN_RIGHT,TEXT_ALIGN_CENTER) [/CODE] Everything works fine, but it's still annoying.
Change the first line to: [code]local playerSalary = LocalPlayer():getDarkRPVar("salary") or 0[/code] The salary is set after HUDPaint has first been called, so you should give it a default value.
[QUOTE=code_gs;52636983]-snip-[/QUOTE] Thanks, it's good now
Hello ! I've a little question, I want to make a docked panel which must be here : [url]http://prntscr.com/gfwyjv[/url] how can I do that? I wanna get the wide of the parent / 2 but with dock
[QUOTE=Swarzox;52637852]Hello ! I've a little question, I want to make a docked panel which must be here : [url]http://prntscr.com/gfwyjv[/url] how can I do that? I wanna get the wide of the parent / 2 but with dock[/QUOTE] Use the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/Dock]Panel:Dock[/url] function with the parameter being LEFT?
[QUOTE=geferon;52637966]Use the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/Dock]Panel:Dock[/url] function with the parameter being LEFT?[/QUOTE] yes but I want the panel's wide to be the parent's panel wide / 2 and I can't use getwide on docked panel
[QUOTE=Swarzox;52637970]yes but I want the panel's wide to be the parent's panel wide / 2 and I can't use getwide on docked panel[/QUOTE] Then, right after docking set the panels width to the others panel half width.
And how can I get the half of the parent panel without getwide?
[QUOTE=Swarzox;52638008]And how can I get the half of the parent panel without getwide?[/QUOTE] Why wouldn't you use GetWide? I mean, why can't you as you say?
Because it doesn't work on docked panel
[QUOTE=Swarzox;52638151]Because it doesn't work on docked panel[/QUOTE] It does. But you need to use it on the PARENT.
Can outgoing clientside HTTP requests be [or be made to be] blocked or whitelisted to only specific websites? If not, why not?
If you override the function. Otherwise, there would be no way nor reason to limit it. It's not like the request is sent to the server.
I'm trying to put this model to an entity, but this one in particular doesn't want to work. All the others work fine tho. [CODE]function ENT:Initialize() util.PrecacheModel("models/props_combine/statisshield_sheet") self:SetModel("models/props_c17/door01_left.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self:SetMaterial("models/props_combine/statisshield_sheet") self:SetNWInt("health", 500) local position = self:GetPos() local phys = self:GetPhysicsObject() if phys:IsValid() then phys:EnableMotion(false) phys:Wake() end end[/CODE]
What do you mean "doesn't work?"
Oops my bad, I meant material not model. Yeah that specific material doesn't want to appear on the model. Any other material works tho but I need that one.
I am probably wrong, but isnt the material called stasisshield instead of statisshield?
[QUOTE=Gmod4phun;52640337]I am probably wrong, but isnt the material called stasisshield instead of statisshield?[/QUOTE] thanks lmao, can't believe I didn't spot that
I want to code an effect of moving material which will apply to prop/ragdoll and fit its model (imagine a texture which moves on its parent surface), but I'm not really sure how (stencils?). Please, point me in the right direction. (sorry for my english :s:)
Is there any way to un-do what [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/Droppable]Panel:Droppable[/url] does? It would be a pain to make a new panel, set it to the right position, ect.
So I have a VM Animation that gets faster as you attack by way of [code]vm:SendViewModelMatchingSequence( vm:LookupSequence( self.AttackAnim ) ) vm:SetPlaybackRate(self.Primary.InitialDelay / self.Primary.Delay)[/code] Is there a way to set the sequence time? AKA set where the animation starts at/where it's currently at?
[QUOTE=LoweChaser;52640532]I want to code an effect of moving material which will apply to prop/ragdoll and fit its model (imagine a texture which moves on its parent surface), but I'm not really sure how (stencils?). Please, point me in the right direction. (sorry for my english :s:)[/QUOTE] If you just want a scrolling texture, like flowing water, you don't need stencils. See here: [url]https://developer.valvesoftware.com/wiki/Flowing_Water[/url] [lua]local mat = CreateMaterial("MagicBox", "VertexLitGeneric", { ["$basetexture"] = "concrete/concretefloor005a", ["$model"] = 1, Proxies = { TextureScroll = { texturescrollvar = "$basetexturetransform", texturescrollrate = 0.25, texturescrollangle = 0, } } }) function CreateMagicBox(pos) local ent = ents.Create("prop_physics") ent:SetModel("models/props_junk/wood_crate001a.mdl") ent:SetMaterial("!MagicBox") ent:SetPos(pos) ent:Spawn() return ent end [/lua] [img]https://i.imgur.com/MQqJD4k.gif[/img] [QUOTE=Apickx;52640999]Is there any way to un-do what [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/Droppable]Panel:Droppable[/url] does? It would be a pain to make a new panel, set it to the right position, ect.[/QUOTE] From dragdrop.lua: [lua] function meta:Droppable( name ) self.m_DragSlot = self.m_DragSlot or {} self.m_DragSlot[ name ] = {} return self.m_DragSlot[ name ] end [/lua] It'd be nice to have an official method for it, but [lua]pnl.m_DragSlot = nil[/lua] should do the job.
So i am populating an Icon Layout with panels, filling from a table, however i want the second part, which is the button, to hover for each button, currently it just does IsHovered for the last button populated, however each panel has a button. [code] for k, v in pairs(SimpleHUD.THEME) do ColorCheck = HUDTABpanel:Add("DPanel") ColorCheck:SetSize(100,100) ColorCheck.Paint = function() --draw.RoundedBox(1,0,0,HUDDpanel:GetWide(),HUDDpanel:GetTall(), Color(150,150,150,240)) DrawBackground( 0, 0, ColorCheck:GetWide(), ColorCheck:GetTall(), v.background, 0,0) end ColorCheckButton = vgui.Create("DButton") ColorCheckButton:SetParent(ColorCheck) ColorCheckButton:SetPos(0,0 ) ColorCheckButton:SetText("") --ColorCheckButton:SizeToContents() --ColorCheckButton:Center() ColorCheckButton:SetSize(100,100) ColorCheckButton.Paint = function() if ColorCheckButton:IsHovered() == true then DrawBackground( 0, 0, ColorCheckButton:GetWide(), ColorCheckButton:GetTall(), Color(0,0,0,100), 0,0) end end end [/code] Edit: Disregrd, sorted it with v.ColorCheck. Not thinking -_-
[QUOTE=Luni;52641187]If you just want a scrolling texture, like flowing water, you don't need stencils.[/QUOTE]Thanks for the answer, didn't know it. But it's not what I'm trying to do. I'm trying to draw texture which moves on another texture, like this holo:[quote][IMG]https://i.imgur.com/2UeRE0h.gif[/IMG][/quote]
:snip:
Who knows how to create your weapon just a script? (My friend, the developer on lua, said that this is possible and in general if something needs to be tested, it's better to do it exactly)
On my server prop limits are not working for some reason [CODE] function GAMEMODE:PlayerSpawnProp( ply, model ) if stopprops == 1 then ply:ChatPrint("Global prop limit reached! Delete your props or wait."); return false; end if removed > 0 then return false; else return ply:CheckLimit( "props" ) end end [/CODE]
Sorry, you need to Log In to post a reply to this thread.