• How to toggle custom hud? Please help
    13 replies, posted
I am developing a custom hud, but I need to make a command that will toggle the client side hud? Is it possible I can make the toggle in the client side? I would prefer it to be a command, however I don't mind if it is a button, I just want to keep it all in the same file. Here is my code, what do I add to make a toggle? [CODE] hook.Add( "HUDPaint", "HUDPaint_DrawABox", function() local Player = LocalPlayer() local Spec = Player:GetObserverTarget() if IsValid( Spec ) and Spec:IsPlayer() then Player = Spec end draw.RoundedBox( 0, ScrW()/2-35, ScrH()/2+200, 60, 60, Color( 240, 240, 240, Player:GetNWBool( 'IN_FORWARD', false ) and 100 or 25 ) ) draw.RoundedBox( 0, ScrW()/2-30, ScrH()/2+270, 60, 60, Color( 240, 240, 240, Player:GetNWBool( 'IN_BACK', false ) and 100 or 25 ) ) draw.RoundedBox( 0, ScrW()/2-100, ScrH()/2+270, 60, 60, Color( 240, 240, 240, Player:GetNWBool( 'IN_MOVELEFT', false ) and 100 or 25 ) ) draw.RoundedBox( 0, ScrW()/2+40, ScrH()/2+270, 60, 60, Color( 240, 240, 240, Player:GetNWBool( 'IN_MOVERIGHT', false ) and 100 or 25 ) ) draw.RoundedBox( 0, ScrW()/2-110, ScrH()/2+340, 240, 60, Color( 240, 240, 240, Player:GetNWBool( 'IN_JUMP', false ) and 100 or 25 ) ) draw.SimpleTextOutlined( 'JUMP', "DermaLarge", ScrW()/2-6.5, ScrH() - 170, Color( 5, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'W', "DermaLarge", ScrW()/2-6.5, ScrH() - 310, Color( 5, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'S', "DermaLarge", ScrW()/2-4.5, ScrH() - 240, Color( 5, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'A', "DermaLarge", ScrW()/2-65, ScrH() - 240, Color( 5 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'D', "DermaLarge", ScrW()/2+65, ScrH() - 240, Color( 5 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) end) function KeyPressed( Player, Key ) if not IsValid( Player ) then return end if Key == IN_FORWARD then Player:SetNWBool( 'IN_FORWARD', true ) end if Key == IN_BACK then Player:SetNWBool( 'IN_BACK', true ) end if Key == IN_MOVELEFT then Player:SetNWBool( 'IN_MOVELEFT', true ) end if Key == IN_MOVERIGHT then Player:SetNWBool( 'IN_MOVERIGHT', true ) end if Key == IN_JUMP then Player:SetNWBool( 'IN_JUMP', true ) end end function KeyReleased( Player, Key ) if not IsValid( Player ) then return end if Key == IN_FORWARD then Player:SetNWBool( 'IN_FORWARD', false ) end if Key == IN_BACK then Player:SetNWBool( 'IN_BACK', false ) end if Key == IN_MOVELEFT then Player:SetNWBool( 'IN_MOVELEFT', false ) end if Key == IN_MOVERIGHT then Player:SetNWBool( 'IN_MOVERIGHT', false ) end if Key == IN_JUMP then Player:SetNWBool( 'IN_JUMP', false ) end end hook.Add( "KeyPress", "KeyPressedHook", KeyPressed ) hook.Add( "KeyRelease", "KeyReleasedHook", KeyReleased ) end [/CODE]
[url]http://wiki.garrysmod.com/page/Global/CreateClientConVar[/url] if GetConVar("Name"):GetBool() then...
[QUOTE=NiandraLades;48684723][url]http://wiki.garrysmod.com/page/Global/CreateClientConVar[/url] if GetConVar("Name"):GetBool() then...[/QUOTE] How would I make it hide again?
You place your code inside the boolean check, if the con command is locally set to 0, it will not show
Delete this reply because it is so stupid and dumb and I just want the problem solved and i want it fixed fast.
[QUOTE=NiandraLades;48685536]You place your code inside the boolean check, if the con command is locally set to 0, it will not show[/QUOTE] Ok I've been bug fixing and fixing and fixing etc, and now I have gotten this code and it still doesnt work! [CODE] CreateClientConVar("pk_keytog", 1) function HUDPaint() local Ply = LocalPlayer() local Spec = Ply:GetObserverTarget() if IsValid( Spec ) and Spec:IsPly() then Ply = Spec end if GetConVar("pk_keytog"):GetInt() then draw.RoundedBox( 0, ScrW()/2-455, ScrH()/2+200, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_FORWARD', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-450, ScrH()/2+270, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_BACK', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-520, ScrH()/2+270, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_MOVELEFT', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-380, ScrH()/2+270, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_MOVERIGHT', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-534, ScrH()/2+340, 240, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_JUMP', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-700, ScrH()/2+306, 160, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_SPEED', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-670, ScrH()/2+380, 90, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_DUCK', false ) and 100 or 10 ) ) draw.SimpleTextOutlined( 'JUMP', "DermaLarge", ScrW()/2-420, ScrH() - 170, Color( 255, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'W', "DermaLarge", ScrW()/2-427, ScrH() - 310, Color( 255, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'S', "DermaLarge", ScrW()/2-423, ScrH() - 240, Color( 255, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'A', "DermaLarge", ScrW()/2-490, ScrH() - 240, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'D', "DermaLarge", ScrW()/2-360, ScrH() - 240, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'SHIFT', "DermaLarge", ScrW()/2-620, ScrH()/2+335, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'CTRL', "DermaLarge", ScrW()/2-627, ScrH()/2+410, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) end end hook.Add( "KeyPress", "HUDPaintKeysShow", HUDPaint ) function KeyPressed( Ply, Key ) if not IsValid( Ply ) then return end if Key == IN_FORWARD then Ply:SetNWBool( 'IN_FORWARD', true ) end if Key == IN_BACK then Ply:SetNWBool( 'IN_BACK', true ) end if Key == IN_MOVELEFT then Ply:SetNWBool( 'IN_MOVELEFT', true ) end if Key == IN_MOVERIGHT then Ply:SetNWBool( 'IN_MOVERIGHT', true ) end if Key == IN_JUMP then Ply:SetNWBool( 'IN_JUMP', true ) end if Key == IN_SPEED then Ply:SetNWBool( 'IN_SPEED', true ) end if Key == IN_DUCK then Ply:SetNWBool( 'IN_DUCK', true ) end end hook.Add( "KeyPress", "KeyPresKeysShow", KeyPressed ) function KeyReleased( Ply, Key ) if not IsValid( Ply ) then return end if Key == IN_FORWARD then Ply:SetNWBool( 'IN_FORWARD', false ) end if Key == IN_BACK then Ply:SetNWBool( 'IN_BACK', false ) end if Key == IN_MOVELEFT then Ply:SetNWBool( 'IN_MOVELEFT', false ) end if Key == IN_MOVERIGHT then Ply:SetNWBool( 'IN_MOVERIGHT', false ) end if Key == IN_JUMP then Ply:SetNWBool( 'IN_JUMP', false ) end if Key == IN_SPEED then Ply:SetNWBool( 'IN_SPEED', false ) end if Key == IN_DUCK then Ply:SetNWBool( 'IN_DUCK', false ) end end hook.Add( "KeyRelease", "KeyReleaseKeysShow", KeyReleased ) [/CODE] I need this done fast!
bump because I need this solved fast
[QUOTE=Axarator;48686464]bump because I need this solved fast[/QUOTE] Shouldn't IsPly be IsPlayer? And the hook is wrong, you have KeyPressed and not HUDPaint [editline]15th September 2015[/editline] And please, post errors if you have them, you could try putting print in every function to check that they work, but try my 1st suggestion first?
[QUOTE=SteppuFIN;48686489]Shouldn't IsPly be IsPlayer? And the hook is wrong, you have KeyPressed and not HUDPaint [editline]15th September 2015[/editline] And please, post errors if you have them, you could try putting print in every function to check that they work, but try my 1st suggestion first?[/QUOTE] It's nothing to do with the hud as it works otherwise, I'll show you my updated code though, no errors but hud doesn't load. [CODE]CreateClientConVar("pk_keytog", "0", false, false) print( GetConVar("pk_keytog"):GetBool() ) thebool = GetConVar("pk_keytog"):GetBool() if ( thebool == true) then function HUDPaint() local Ply = LocalPlayer() local Spec = Ply:GetObserverTarget() if IsValid( Spec ) and Spec:IsPly() then Ply = Spec end draw.RoundedBox( 0, ScrW()/2-455, ScrH()/2+200, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_FORWARD', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-450, ScrH()/2+270, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_BACK', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-520, ScrH()/2+270, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_MOVELEFT', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-380, ScrH()/2+270, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_MOVERIGHT', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-534, ScrH()/2+340, 240, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_JUMP', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-700, ScrH()/2+306, 160, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_SPEED', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-670, ScrH()/2+380, 90, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_DUCK', false ) and 100 or 10 ) ) draw.SimpleTextOutlined( 'JUMP', "DermaLarge", ScrW()/2-420, ScrH() - 170, Color( 255, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'W', "DermaLarge", ScrW()/2-427, ScrH()/2+230, Color( 255, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'S', "DermaLarge", ScrW()/2-423, ScrH()/2+300, Color( 255, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'A', "DermaLarge", ScrW()/2-490, ScrH()/2+300, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'D', "DermaLarge", ScrW()/2-360, ScrH()/2+300, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'SHIFT', "DermaLarge", ScrW()/2-620, ScrH()/2+335, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'CTRL', "DermaLarge", ScrW()/2-627, ScrH()/2+410, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) end hook.Add( "KeyPress", "HUDPaintKeysShow", HUDPaint ) function KeyPressed( Ply, Key ) if not IsValid( Ply ) then return end if Key == IN_FORWARD then Ply:SetNWBool( 'IN_FORWARD', true ) end if Key == IN_BACK then Ply:SetNWBool( 'IN_BACK', true ) end if Key == IN_MOVELEFT then Ply:SetNWBool( 'IN_MOVELEFT', true ) end if Key == IN_MOVERIGHT then Ply:SetNWBool( 'IN_MOVERIGHT', true ) end if Key == IN_JUMP then Ply:SetNWBool( 'IN_JUMP', true ) end if Key == IN_SPEED then Ply:SetNWBool( 'IN_SPEED', true ) end if Key == IN_DUCK then Ply:SetNWBool( 'IN_DUCK', true ) end end hook.Add( "KeyPress", "KeyPresKeysShow", KeyPressed ) function KeyReleased( Ply, Key ) if not IsValid( Ply ) then return end if Key == IN_FORWARD then Ply:SetNWBool( 'IN_FORWARD', false ) end if Key == IN_BACK then Ply:SetNWBool( 'IN_BACK', false ) end if Key == IN_MOVELEFT then Ply:SetNWBool( 'IN_MOVELEFT', false ) end if Key == IN_MOVERIGHT then Ply:SetNWBool( 'IN_MOVERIGHT', false ) end if Key == IN_JUMP then Ply:SetNWBool( 'IN_JUMP', false ) end if Key == IN_SPEED then Ply:SetNWBool( 'IN_SPEED', false ) end if Key == IN_DUCK then Ply:SetNWBool( 'IN_DUCK', false ) end end hook.Add( "KeyRelease", "KeyReleaseKeysShow", KeyReleased ) end[/CODE]
[QUOTE=Axarator;48686513]It's nothing to do with the hud as it works otherwise, I'll show you my updated code though, no errors but hud doesn't load. [/QUOTE] I told you, look at line with: [CODE] hook.Add( "KeyPress", "HUDPaintKeysShow", HUDPaint ) [/CODE] You see that in function that you should use HUDPaint hook, you use KeyPress. Replace the KeyPress with HUDPaint...
[QUOTE=SteppuFIN;48686520]I told you, look at line with: [CODE] hook.Add( "KeyPress", "HUDPaintKeysShow", HUDPaint ) [/CODE] You see that in function that you should use HUDPaint hook, you use KeyPress. Replace the KeyPress with HUDPaint...[/QUOTE] Still nothing. The boolean returns true when I print it but nothing ever loads, do I have to like update the data or something?
[QUOTE=Axarator;48686532]Still nothing. The boolean returns true when I print it but nothing ever loads, do I have to like update the data or something?[/QUOTE] [CODE] CreateClientConVar("pk_keytog", "0", false, false) function HUDPaint() thebool = GetConVar("pk_keytog"):GetBool() if not thebool then return end local Ply = LocalPlayer() local Spec = Ply:GetObserverTarget() if IsValid( Spec ) and Spec:IsPly() then Ply = Spec end draw.RoundedBox( 0, ScrW()/2-455, ScrH()/2+200, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_FORWARD', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-450, ScrH()/2+270, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_BACK', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-520, ScrH()/2+270, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_MOVELEFT', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-380, ScrH()/2+270, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_MOVERIGHT', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-534, ScrH()/2+340, 240, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_JUMP', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-700, ScrH()/2+306, 160, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_SPEED', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-670, ScrH()/2+380, 90, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_DUCK', false ) and 100 or 10 ) ) draw.SimpleTextOutlined( 'JUMP', "DermaLarge", ScrW()/2-420, ScrH() - 170, Color( 255, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'W', "DermaLarge", ScrW()/2-427, ScrH()/2+230, Color( 255, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'S', "DermaLarge", ScrW()/2-423, ScrH()/2+300, Color( 255, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'A', "DermaLarge", ScrW()/2-490, ScrH()/2+300, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'D', "DermaLarge", ScrW()/2-360, ScrH()/2+300, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'SHIFT', "DermaLarge", ScrW()/2-620, ScrH()/2+335, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'CTRL', "DermaLarge", ScrW()/2-627, ScrH()/2+410, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) end hook.Add( "HUDPaint", "HUDPaintKeysShow", HUDPaint ) function KeyPressed( Ply, Key ) if not IsValid( Ply ) then return end if Key == IN_FORWARD then Ply:SetNWBool( 'IN_FORWARD', true ) end if Key == IN_BACK then Ply:SetNWBool( 'IN_BACK', true ) end if Key == IN_MOVELEFT then Ply:SetNWBool( 'IN_MOVELEFT', true ) end if Key == IN_MOVERIGHT then Ply:SetNWBool( 'IN_MOVERIGHT', true ) end if Key == IN_JUMP then Ply:SetNWBool( 'IN_JUMP', true ) end if Key == IN_SPEED then Ply:SetNWBool( 'IN_SPEED', true ) end if Key == IN_DUCK then Ply:SetNWBool( 'IN_DUCK', true ) end end hook.Add( "KeyPress", "KeyPressKeysShow", KeyPressed ) function KeyReleased( Ply, Key ) if not IsValid( Ply ) then return end if Key == IN_FORWARD then Ply:SetNWBool( 'IN_FORWARD', false ) end if Key == IN_BACK then Ply:SetNWBool( 'IN_BACK', false ) end if Key == IN_MOVELEFT then Ply:SetNWBool( 'IN_MOVELEFT', false ) end if Key == IN_MOVERIGHT then Ply:SetNWBool( 'IN_MOVERIGHT', false ) end if Key == IN_JUMP then Ply:SetNWBool( 'IN_JUMP', false ) end if Key == IN_SPEED then Ply:SetNWBool( 'IN_SPEED', false ) end if Key == IN_DUCK then Ply:SetNWBool( 'IN_DUCK', false ) end end hook.Add( "KeyRelease", "KeyReleaseKeysShow", KeyReleased ) [/CODE] Fixed. You were creating everything, if the value was true, but default was false...
[QUOTE=SteppuFIN;48686552][CODE] CreateClientConVar("pk_keytog", "0", false, false) function HUDPaint() thebool = GetConVar("pk_keytog"):GetBool() if not thebool then return end local Ply = LocalPlayer() local Spec = Ply:GetObserverTarget() if IsValid( Spec ) and Spec:IsPly() then Ply = Spec end draw.RoundedBox( 0, ScrW()/2-455, ScrH()/2+200, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_FORWARD', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-450, ScrH()/2+270, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_BACK', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-520, ScrH()/2+270, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_MOVELEFT', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-380, ScrH()/2+270, 60, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_MOVERIGHT', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-534, ScrH()/2+340, 240, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_JUMP', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-700, ScrH()/2+306, 160, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_SPEED', false ) and 100 or 10 ) ) draw.RoundedBox( 0, ScrW()/2-670, ScrH()/2+380, 90, 60, Color( 135, 135, 134, Ply:GetNWBool( 'IN_DUCK', false ) and 100 or 10 ) ) draw.SimpleTextOutlined( 'JUMP', "DermaLarge", ScrW()/2-420, ScrH() - 170, Color( 255, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'W', "DermaLarge", ScrW()/2-427, ScrH()/2+230, Color( 255, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'S', "DermaLarge", ScrW()/2-423, ScrH()/2+300, Color( 255, 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'A', "DermaLarge", ScrW()/2-490, ScrH()/2+300, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'D', "DermaLarge", ScrW()/2-360, ScrH()/2+300, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'SHIFT', "DermaLarge", ScrW()/2-620, ScrH()/2+335, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) draw.SimpleTextOutlined( 'CTRL', "DermaLarge", ScrW()/2-627, ScrH()/2+410, Color( 255 , 245, 245 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 44, 62, 80 ) ) end hook.Add( "HUDPaint", "HUDPaintKeysShow", HUDPaint ) function KeyPressed( Ply, Key ) if not IsValid( Ply ) then return end if Key == IN_FORWARD then Ply:SetNWBool( 'IN_FORWARD', true ) end if Key == IN_BACK then Ply:SetNWBool( 'IN_BACK', true ) end if Key == IN_MOVELEFT then Ply:SetNWBool( 'IN_MOVELEFT', true ) end if Key == IN_MOVERIGHT then Ply:SetNWBool( 'IN_MOVERIGHT', true ) end if Key == IN_JUMP then Ply:SetNWBool( 'IN_JUMP', true ) end if Key == IN_SPEED then Ply:SetNWBool( 'IN_SPEED', true ) end if Key == IN_DUCK then Ply:SetNWBool( 'IN_DUCK', true ) end end hook.Add( "KeyPress", "KeyPressKeysShow", KeyPressed ) function KeyReleased( Ply, Key ) if not IsValid( Ply ) then return end if Key == IN_FORWARD then Ply:SetNWBool( 'IN_FORWARD', false ) end if Key == IN_BACK then Ply:SetNWBool( 'IN_BACK', false ) end if Key == IN_MOVELEFT then Ply:SetNWBool( 'IN_MOVELEFT', false ) end if Key == IN_MOVERIGHT then Ply:SetNWBool( 'IN_MOVERIGHT', false ) end if Key == IN_JUMP then Ply:SetNWBool( 'IN_JUMP', false ) end if Key == IN_SPEED then Ply:SetNWBool( 'IN_SPEED', false ) end if Key == IN_DUCK then Ply:SetNWBool( 'IN_DUCK', false ) end end hook.Add( "KeyRelease", "KeyReleaseKeysShow", KeyReleased ) [/CODE] Fixed. You were creating everything, if the value was true, but default was false...[/QUOTE] Thanks m8, that really worked and was helpful!
[QUOTE=Axarator;48690623]Thanks m8, that really worked and was helpful![/QUOTE] Next time don't put a function inside an if, put the if inside the function. Also, use propper tabbing
Sorry, you need to Log In to post a reply to this thread.