Jump to content

Binding a key 2 make the window appear


Xeno

Recommended Posts

Hey

Im makeing a login gui and im have trouble with it. i need 2 set F2 to makea window appear... i have tryed and it doesent work ... look

local localPlayer = getLocalPlayer()

local localPlayerName = getPlayerName(localPlayer)

local localRootElement = getRootElement()

local newUser

local passwordAttempts = 0

function CreateLoginWindow()

wdwLogin = guiCreateWindow(226,146,372,233,"[Admin Login System]",false)

guiWindowSetMovable(wdwLogin,false)

guiWindowSetSizable(wdwLogin,false)

tabpanel = guiCreateTabPanel(0.0242,0.0858,0.9489,0.8755,true,wdwLogin)

tab1 = guiCreateTab("Login",tabpanel)

login = guiCreateButton(0.1000,0.8611,0.2436,0.1167,"Login",true,tab1)

username = guiCreateLabel(0.0113,0.1167,0.3768,0.15,"UserName:",true,tab1)

guiLabelSetColor(username,255,255,255)

guiLabelSetVerticalAlign(username,"top")

guiLabelSetHorizontalAlign(username,"left",false)

guiSetFont(username,"default-bold-small")

password = guiCreateLabel(0.0113,0.2889,0.3768,0.15,"Password:",true,tab1)

guiLabelSetColor(password,255,255,255)

guiLabelSetVerticalAlign(password,"top")

guiLabelSetHorizontalAlign(password,"left",false)

guiSetFont(password,"default-bold-small")

username = guiCreateEdit(0.2266,0.1,0.3598,0.1389,localPlayerName,true,tab1)

password = guiCreateEdit(0.2266,0.2611,0.3598,0.1389,"",true,tab1)

Canel = guiCreateButton( 0.4, 0.85, 0.20, 0.15, "Cancel", true,tab1 )

guiEditSetMasked(password,true)

tab2 = guiCreateTab("Info",tabpanel)

guiSetVisible(wdwLogin,false)

addEventHandler("onClientGUIClick", Canel, closeWindow)

end

function Binds()

bindKey( "F2", "down", CreateLoginWindow )

addEventHandler("onResourceStart", getRootElement(), Binds)

end

Link to comment

Hey

Im makeing a login gui and im have trouble with it. i need 2 set F2 to makea window appear... i have tryed and it doesent work ... look

local localPlayer = getLocalPlayer()

local localPlayerName = getPlayerName(localPlayer)

local localRootElement = getRootElement()

local newUser

local passwordAttempts = 0

function CreateLoginWindow()

wdwLogin = guiCreateWindow(226,146,372,233,"[Admin Login System]",false)

guiWindowSetMovable(wdwLogin,false)

guiWindowSetSizable(wdwLogin,false)

tabpanel = guiCreateTabPanel(0.0242,0.0858,0.9489,0.8755,true,wdwLogin)

tab1 = guiCreateTab("Login",tabpanel)

login = guiCreateButton(0.1000,0.8611,0.2436,0.1167,"Login",true,tab1)

username = guiCreateLabel(0.0113,0.1167,0.3768,0.15,"UserName:",true,tab1)

guiLabelSetColor(username,255,255,255)

guiLabelSetVerticalAlign(username,"top")

guiLabelSetHorizontalAlign(username,"left",false)

guiSetFont(username,"default-bold-small")

password = guiCreateLabel(0.0113,0.2889,0.3768,0.15,"Password:",true,tab1)

guiLabelSetColor(password,255,255,255)

guiLabelSetVerticalAlign(password,"top")

guiLabelSetHorizontalAlign(password,"left",false)

guiSetFont(password,"default-bold-small")

username = guiCreateEdit(0.2266,0.1,0.3598,0.1389,localPlayerName,true,tab1)

password = guiCreateEdit(0.2266,0.2611,0.3598,0.1389,"",true,tab1)

Canel = guiCreateButton( 0.4, 0.85, 0.20, 0.15, "Cancel", true,tab1 )

guiEditSetMasked(password,true)

tab2 = guiCreateTab("Info",tabpanel)

guiSetVisible(wdwLogin,false)

addEventHandler("onClientGUIClick", Canel, closeWindow)

end

function Binds()

bindKey( "F2", "down", CreateLoginWindow )

addEventHandler("onResourceStart", getRootElement(), Binds)

end

Link to comment

I think this is wrong

function Binds()

bindKey( "F2", "down", CreateLoginWindow )

addEventHandler("onResourceStart", getRootElement(), Binds)

end

Try

function Binds()

bindKey( "F2", "down", CreateLoginWindow )

end

addEventHandler("onResourceStart", getRootElement(), Binds)

Link to comment

I think this is wrong

function Binds()

bindKey( "F2", "down", CreateLoginWindow )

addEventHandler("onResourceStart", getRootElement(), Binds)

end

Try

function Binds()

bindKey( "F2", "down", CreateLoginWindow )

end

addEventHandler("onResourceStart", getRootElement(), Binds)

Link to comment
function Binds()
bindKey( "F2", "down", CreateLoginWindow )
end
addEventHandler("onClientResourceStart", getRootElement(), Binds) -- onResourceStart doesn't exist client-side, it's on>>Client<<ResourceStart

And could you please wrap your code in [ lua] [ /lua] or [ code=lua] [ /code] tags next time? It's a bit annoying to read it this way.

Link to comment

function Binds()    bindKey( "F2", "down", CreateLoginWindow )endaddEventHandler("onClientResourceStart", getRootElement(), Binds) -- onResourceStart doesn't exist client-side, it's on>>Client<

And could you please wrap your code in [ lua] [ /lua] or [ code=lua] [ /code] tags next time? It's a bit annoying to read it this way.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...