• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[QUOTE=343N;48884222]applying to other things? i am confused as all hell [editline]12th October 2015[/editline] [code]function SWEP:PreDrawViewModel() render.MaterialOverride("effects/prisonmap_disp") end function SWEP:PostDrawViewModel() render.MaterialOverride(nil) end[/code] does nothing [editline]dicks and ass[/editline] this works, nvm [code]function SWEP:PreDrawViewModel() render.MaterialOverride(Material("effects/prisonmap_disp")) end function SWEP:PostDrawViewModel() render.MaterialOverride(nil) end [/code][/QUOTE] Store that material in a variable. No need to precache/create a material nearly every frame. [code]local mat = Material("effects/prisonmap_disp")[/code]
thank you heaps [editline]12th October 2015[/editline] also quick question is there anyway to change the hands material/model? (using a c model)
[QUOTE=MPan1;48883888]Sorry for the late reply, didn't notice your post. Going to that page just shows the easing in CSS, SCSS and JavaScript (but it doesn't show it in a way that Lua could understand)... where can I find some code that ACTUALLY WORKS in Lua? I tried looking at all kinds of lua easing scripts, but all of them have a D variable for duration (which the example on the wiki didn't), and even typing in the duration (as in 1 second) doesn't work whatsoever for me.[/QUOTE] oh rip [url]https://github.com/EmmanuelOga/easing/blob/master/lib/easing.lua[/url]
What is the 'self' value within panel functions? I'm trying to close a panel from a standalone function and I'm not sure how to do it because using PanelVariable:Remove() doesn't work.
[QUOTE=roastchicken;48886661]What is the 'self' value within panel functions? I'm trying to close a panel from a standalone function and I'm not sure how to do it because using PanelVariable:Remove() doesn't work.[/QUOTE] 'self' is a local reference to the panel. There are two ways a method can be called: [LUA]tablename.funcname()[/LUA] and [LUA]tablename:funcname()[/LUA] where [LUA]tablename:funcname()[/LUA] is the equivelent of [LUA]tablename.funcname(table)[/LUA] where the method is defined as: [LUA]function tablename.funcname(self) end[/LUA] You should use 'self' whenever possible instead of using a global variable. As for your problem please post the code because based on your description it should work.
[QUOTE=Dinnanid;48886983]-explaining 'self'- As for your problem please post the code because based on your description it should work.[/QUOTE] [CODE]local F4Bind local f4Menu function DarkRP.openF4Menu() f4Menu = vgui.Create( "DPanel" ) f4Menu:SetSize( width, height ) f4Menu:SetPos( xPos, yPos ) f4Menu:SetVisible( true ) f4Menu:MakePopup() f4Menu.F4Down = true local closeButton = vgui.Create( "DButton", f4Menu ) closeButton:SetPos( 0, 0 ) closeButton:SetSize( buttonWidth, buttonHeight ) closeButton:SetFont( "DermaLarge" ) closeButton:SetColor( red ) closeButton:SetText( "Close" ) closeButton.DoClick = function() f4Menu:Remove() end function f4Menu:Think() F4Bind = F4Bind or input.KeyNameToNumber(input.LookupBinding("gm_showspare2")) if not F4Bind then return end if self.F4Down and not input.IsKeyDown(F4Bind) then self.F4Down = false return elseif not self.F4Down and input.IsKeyDown(F4Bind) then self.F4Down = true self:Remove() end end end function DarkRP.closeF4Menu() f4Menu:Remove() end hook.Add("PlayerBindPress", "DarkRPF4Bind", function(ply, bind, pressed) if string.find(bind, "gm_showspare2", 1, true) then MsgN( "F4 menu bind pressed! (start)" ) F4Bind = input.KeyNameToNumber(input.LookupBinding(bind)) DarkRP.openF4Menu() MsgN( "F4 menu bind pressed! (end)" ) end end)[/CODE] I'm trying to make a custom F4 menu. Pressing the F4 button closes the menu, but running the DarkRP.closeF4Menu() and pressing the close button both just glitch out.
-- Fixed it --
[QUOTE=UnknownFusion;48888064]How would I go about scaling something like this to fit all resolutions? [CODE]draw.RoundedBox(6, HUD.PosX+10, HUD.PosY-10, HUD.Width, HUD.Height, Color(30,30,30,160))[/CODE][/QUOTE] See the ScrW() and ScrH() functions
-gonna make a thread-
[QUOTE=zerf;48886637]oh rip [url]https://github.com/EmmanuelOga/easing/blob/master/lib/easing.lua[/url][/QUOTE] [QUOTE=MPan1;48883888]All of them have a D variable for duration (which the example on the wiki didn't), and even typing in the duration (as in 1 second) doesn't work whatsoever for me.[/QUOTE] :snip: It works now, I must've stuffed it up before. SORRY ZERF! [editline]13th October 2015[/editline] Is there any proper way to get someone's system name (like Windows, Linux, etc)? In the system library there's a couple of bool-returning functions for stuff like 'system.IsWindows' and 'system.IsOSX' (and currently I'm just cycling through them to return a system name string) but is there a single-function way? TL:DR; Is it possible to get a client's system name as a string? Another question, if you're making an addon, do you need to do anything special to send font or sound files to the client (other than put them in sound and resource folders in the addon), or do they just automatically get added when the client joins and the addon is enabled serverside? Or, do you have to always do resource.AddFile?
[code] local trivia_table = { "key" = "value", "key" = "value" } [/code] This returns an error to do with the brackets - should I just use key = "value" if I want to do two strings? If that's the case, how would I access the key as print(trivia_table[1]) gives me nil, along with print(trivia_table[key]) Wait, I don't think that would work since both the key and value are going to be more than one word - basically, help, I can see in my mind exactly what I wanna do but can't put it into the correct format
[QUOTE=NiandraLades;48892145][code] local trivia_table = { "key" = "value", "key" = "value" } [/code] This returns an error to do with the brackets - should I just use key = "value" if I want to do two strings? If that's the case, how would I access the key as print(trivia_table[1]) gives me nil, along with print(trivia_table[key])[/QUOTE] [code] local trivia_table = { ["key"] = "value", ["key"] = "value" } print(trivia_table["key"]) [/code]
!! Got it, tyvm
-snip, late me-
Got an interesting question regarding networking previously registered weapons to clients to when they first join a server; how would I go about doing this? I already have a table of the weapons on the server that need to be registered but is it enough to register the list of these weapons on the client upon some hook, so they don't run into issues if they find one and then furthermore fix issues with other players who already have these weapons upon connect? These aren't AddCSLua weapons since they're created runtime.
Sorry to repost, but just to clarify- if you're trying to add fonts to GMod, do you ALWAYS have to use resource.AddSingleFile( 'resources/fonts/fontname.ttf' ) or do they get mounted automatically when running the addon?
[QUOTE=MPan1;48898600]Sorry to repost, but just to clarify- if you're trying to add fonts to GMod, do you ALWAYS have to use resource.AddSingleFile( 'resources/fonts/fontname.ttf' ) or do they get mounted automatically when running the addon?[/QUOTE] Mounted automatically. Need to addfile if you want clients to download it, though.
I'm having trouble setting spawnflags for a zombie, when I spawn him I do this [code] local spawnflags = bit.bor( SF_NPC_FADE_CORPSE, SF_NPC_ALWAYSTHINK, SF_NPC_NO_WEAPON_DROP ) pZombie:SetKeyValue( "spawnflags", spawnflags ) [/code] but it appears that spawnflags always gets reset to 0 even doing a while loop to keep setting them until they aren't 0 doesn't work as it will just loop infinity. I'm at a lose why this happens
[QUOTE=Z0mb1n3;48898699]Need to addfile if you want clients to download it, though.[/QUOTE] I'm confused- do clients need to download fonts that are in a serverside-mounted addon (containing said fonts) or not? The gPhone (for example)[URL="https://github.com/Exho1/gPhone/blob/master/lua/gphone/sv_phone.lua#L6-L24"] runs resource.AddFile on all fonts contained within the addon[/URL], so why would it do that?
[QUOTE=MPan1;48899144]I'm confused- do clients need to download fonts that are in a serverside-mounted addon (containing said fonts) or not? The gPhone (for example)[URL="https://github.com/Exho1/gPhone/blob/master/lua/gphone/sv_phone.lua#L6-L24"] runs resource.AddFile on all fonts contained within the addon[/URL], so why would it do that?[/QUOTE] If the file is on the server and legacy, then yes you need to AddFile it. If you have a workshop collection that your clients download, where one addon contains the fonts, no AddFile is needed. In any case, it would be good practice to AddFile it regardless of what your setup is—FastDL or WorkshopDL—so that your clients receive the font no matter what they do.
I need help! :( Its been a while but im pretty sure im doing everthing right. It wont let me set the GAMEMODE variables. Can you help me? :( ty in advance! :) [CODE] --Includes AddCSLuaFile("../client/cl_armorsystem.lua") AddCSLuaFile("../share/sh_armorsystem.lua") --Configuration-- GAMEMODE.armorSets={ --Format : [NAME]={NAME,resoucecost,armour percent} ["Leather"]={"Leather",1,10}, ["Mail"]={"Leather",1,10}, ["Plate"]={"Leather",1,10} } --Pickup Type ( 0 = Overide previous armor, 1 = Add new armor total to old armor total.) GAMEMODE.pickupTypes=1; --Class restricted (set as false if you dont want it to be, but if true set it to the team of the class) GAMEMODE.classRestricted=false; --Class Starter Armors ( ) GAMEMODE.classStarterArmor={ -- Format is { Class Team, Armor Name} {"Gun Dealer","Leather"} } --End Of Configuration hook.Add( "PlayerSpawn", "giveStarterArmor", function(ply) for i,v in ipairs(GAMEMODE.classStarterArmor)do if(team.GetName(ply:Team())==v[1])then ply:giveArmor(v[2]) print("Gave "..ply:Nick().." Armor ( TYPE : "..v[2]..")!") end end end) local plymeta = FindMetaTable("Player") function plymeta:giveArmor( armorType) if(GAMEMODE.pickupTypes==0)then local newarmor = GAMEMODE.armorSets[armorType][3] self:SetArmor(newarmor) elseif(GAMEMODE.pickupTypes==1)then local oldarmor = self:Armor() local newarmor = oldarmor+GAMEMODE.armorSets[armorType][3] self:SetArmor(newarmor) end end [/CODE] Its all in the auto runs if you couldnt tell! :P
Sorry for not answering the post above, but I have a simple issue that will probably take 10 seconds to solve. For some reason, I can't figure out how to hide a DScrollPanel (or make it smaller) once it's children get removed. Here's some code to show you what I mean if you want to test it: [CODE] concommand.Add( 'ShowAnnoyance', function() local base = vgui.Create( 'DFrame' ) base:SetSize( 200, 200 ) base:SetTitle( 'DSCROLLPANEL IS BEING A PAIN' ) base:Center() base:MakePopup() local scroll = vgui.Create( 'DScrollPanel', base ) scroll:Dock( FILL ) for i = 1, 3 do timer.Simple( i, function() local item = vgui.Create( 'DPanel', scroll ) item:Dock( TOP ) item:SetSize( 0, 70 ) timer.Simple( 3, function() item:Remove() end ) end ) end end ) [/CODE]
[QUOTE=DamienTehDemo;48899242]snip[/QUOTE] You already made a thread.. [url]https://facepunch.com/showthread.php?t=1489628[/url]
Is there a way to check if someone is noclipping?
Thanks, didnt know about it
Totally searched for this but came up with nothing beyond 8 year old google searches... When creating a gamemode, how do you write a script that mutes all toolgun sounds completely, so everyone on a server hears NOTHING in relation to a toolgun. (any way to hide spawn effects or graphical changes associated with using a toolgun?) Imagine if I was trying to be a puppet master...I'm trying to hide the strings (and, uh, the noise they make?)
Hey guys, it's not a problem but I was not sure where to post this question: Is there any addon/script to create an adjustable (focus/distance) Realtime DOF or maybe SDOF on gmod ? (Not the Bokeh one)
[QUOTE=Blakestr;48903261]Totally searched for this but came up with nothing beyond 8 year old google searches... When creating a gamemode, how do you write a script that mutes all toolgun sounds completely, so everyone on a server hears NOTHING in relation to a toolgun. (any way to hide spawn effects or graphical changes associated with using a toolgun?) Imagine if I was trying to be a puppet master...I'm trying to hide the strings (and, uh, the noise they make?)[/QUOTE] You could probably use the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/EntityEmitSound]GM:EntityEmitSound[/url] hook to return false by comparing the data.Entity's class with your toolguns you want to block.
[QUOTE=DeathWard;48903701]You could probably use the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/EntityEmitSound]GM:EntityEmitSound[/url] hook to return false by comparing the data.Entity's class with your toolguns you want to block.[/QUOTE] I don't even care how sloppy it is...I want all toolguns silenced.
Any particular reason why player:ViewPunch( ang ) does nothing clientside? I've tried this lua_run_cl Entity(1):ViewPunch(Angle(-10,0,0)) with sv_allowcslua 1 and nothing happens.
Sorry, you need to Log In to post a reply to this thread.