ill test it, Thank You! im not sure if this is in that code already but can you make it disreguard the first key press after 5 seconds?
well i tryed it and got this error -- autorun/client/kill.lua:6: '=' expected near '=='
I'll look through it after I get my homework done tomorrow.
That's not really hard to make at all lol
Jova, a lot of people beat you to it, whats the point?
Ok, so I did it before my homework, whatever:
[code]function testpanel() -- Create the function
local width = ScrW() * 0.5 //Half screen size
local height = ScrH() * 0.5 //Half screen size
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos(width,height)
DermaPanel:SetSize( 250, 100 )
DermaPanel:SetTitle( "-----------------KILLMENU---------------" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton(false)
DermaPanel:SetMouseInputEnabled(false)
DermaPanel:MakePopup()
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel"
DermaButton:SetText( "Press K Again To Kill" )
DermaButton:SetPos( 25, 30 )
DermaButton:SetSize( 100, 50 )
DermaButton.DoClick = function ()
DermaPanel:Close()
end
end
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel"
DermaButton:SetText( "AutoClose In 5s" )
DermaButton:SetPos( 25, 90 )
DermaButton:SetSize( 100, 50 )
DermaButton.DoClick = function ()
DermaPanel:Close()
end
timer.Create( "my_timer", 5, 0, function ()
DermaPanel:Close()
function KeyPressed (K, key)
RunConsoleCommand("kill")
end
end)
hook.Add( "KeyPress", "KeyPressedHook", KeyPressed )
concommand.Add("kmenu", testpanel)[/code]
I'm pretty sure (didn't test) all you did was forget to put a ")" after the end for your timer function and add an additional end for your KeyPressed function. (also, indenting is a great idea, preferably with 4 regular spaces)
I don't understand the whole discussion about not criticizing the OP, I didn't see anyone being an outright ass, except maybe T3h raps13r, but he was talking about something else.
[QUOTE=Jova;20776520]That's not really hard to make at all lol[/QUOTE]
read the title buddy. its my [B]FIRST[/B] lua
well my brother and i fixed it up and now it works kinda but when i press k again it doesnt kill.
i think instead of "game.consolecommand" i should have put "RunConsoleCommand("kill")" except i couldnt find that at the time..
[code]
function testpanel() -- Create the function
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos(ScrW() * 0.5-75,ScrH() * 0.5-75)
DermaPanel:SetSize( 150, 150 )
DermaPanel:SetTitle( "KILL V2" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton(false)
DermaPanel:SetMouseInputEnabled(false)
DermaPanel:SetKeyboardInputEnabled(true)
DermaPanel:MakePopup()
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel"
DermaButton:SetText( "Press K Again To Kill" )
DermaButton:SetPos( 5, 30 )
DermaButton:SetSize( 140, 50 )
DermaButton.DoClick = function ()
DermaPanel:Close()
end
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel"
DermaButton:SetText( "AutoClose In 5s" )
DermaButton:SetPos( 5, 90 )
DermaButton:SetSize( 140, 50 )
DermaButton.DoClick = function ()
DermaPanel:Close()
end
timer.Create( "my_timer", 3, 1, function()
DermaPanel:Close()
end )
function KeyPressed (K, key)
game.ConsoleCommand("kill")
DermaPanel:Close()
end
hook.Add( "KeyPress", "KeyPressedHook", KeyPressed )
end
hook.Add( "KeyPress", "KeyPressedHook", KeyPressed )
concommand.Add("kmenu", testpanel)[/code]
We tried fixing it together, for some reason he called me an asshole, so I give up for now. This is what we got out of it:
[code]function testpanel() -- Create the function
if (not DermaPanel:IsActive) then --DermaPanel doesn't exist yet, need to figure it out better
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos(ScrW() * 0.5-75,ScrH() * 0.5-55)
DermaPanel:SetSize( 150, 150 )
DermaPanel:SetTitle( "-------------------KILL-----------------" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton(false)
DermaPanel:SetMouseInputEnabled(false)
DermaPanel:MakePopup()
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel"
DermaButton:SetText( "Press K Again To Kill" )
DermaButton:SetPos( 25, 30 )
DermaButton:SetSize( 140, 50 )
DermaButton.DoClick = function ()
DermaPanel:Close()
end
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel"
DermaButton:SetText( "AutoClose In 5s" )
DermaButton:SetPos( 25, 90 )
DermaButton:SetSize( 140, 50 )
DermaButton.DoClick = function ()
RunConsoleCommand( "kill" )
DermaPanel:Close()
end
timer.Create( "my_timer", 5, 1, function()
DermaPanel:Close()
end )
else --Need to kill the timer too
RunConsoleCommand( "kill" )
DermaPanel:Close()
end
end
hook.Add( "KeyPress", "KeyPressedHook", KeyPressed )
concommand.Add("kmenu", testpanel)
[/code]
Edit: I started making this post before he added the code to his post, indentation is helpful so I'm keeping the code here
Edit2: The code in previous post (#36) was made after our working together. It looks he is just guessing what to type...
@edit2: Who's guessing what to type?
OP/LittleSeanX/Bro seems to be guessing what to type in order to make it work the way he wants. (He guesses a lot when doing math homework, or atleast he used to)
The main reason why I say that is because he put in "hook.Add( "KeyPress", "KeyPressedHook", KeyPressed )" twice, probably thinking the hook was removed somehow. (In fact, why is it there at all?)
[lua]
local __key = 0
local function KillKey( player, key )
if key == KEY_K then
__key = __key + 1
if __key == 2 then
__key = 0
RunConsoleCommand( "kill" )
end
end
end
hook.Add( "KeyPress", "LOLILIKEHCHEESE", KillKey )
[/lua]
I accidentally put an extra equal sign, try this.
If he's going to just keep guessing then uninstall his Notepad++, he's going to get no where by guessing...
[QUOTE=darksoul47;20799057]If he's going to just keep guessing then uninstall his Notepad++, he's going to get no where by guessing...[/QUOTE]
Although he has notepad++ installed, he only uses it when I nag him about how useful it is. How would it help to uninstall notepad++? (It's his computer, so I can't do anything anyway)
You taller then him?
[QUOTE=Jova;20776520]That's not really hard to make at all lol[/QUOTE]
Everybody has to start somewhere.
[QUOTE=Annoyed Tree;20825535]Everybody has to start somewhere.[/QUOTE]
They do, but basicly what this guy did was copy and paste the code then edited it and called it quits.
He shouldn't release something this basic, use it for personal use.
Sorry, you need to Log In to post a reply to this thread.