Jump to content

Login button doesn't works.


brocky

Recommended Posts

Posted

My login button doesn't works.

 

 local window1 = guiCreateWindow(455, 178, 710, 532, "", false)
       guiWindowSetSizable(window1, false)
      local editUsername = guiCreateEdit(167, 108, 361, 40, "", false, window1)
      local  editPassword = guiCreateEdit(170, 197, 358, 36, "", false, window1)
        btnLogin = guiCreateButton(9, 434, 691, 43, "Login", false, window1)
        btnClose = guiCreateButton(14, 486, 686, 36, "Close", false, window1)    
        guiSetVisible(window1, true)
        showCursor(true)

function closeGui() 
if btnClose == source then
guiSetVisible(window1, false)
showCursor(false)
  end 
end 
addEventHandler("onClientGUIClick", btnClose, closeGui, false)

function logToServer()
account = guiGetText(editUsername)
password = guiGetText(editPassword)
local name = getPlayerName(getLocalPlayer())
triggerServerEvent("test", localPlayer, account, password, name)
end 
addEventHandler("onClientGUIClick", btnLogin, logToServer, false)

 

server side 

function myMoney(account, password, name)
logIn (source, account, password) 
end
addEvent("test", true)
addEventHandler("test", getRootElement(), myMoney)

 

Posted

Try this:

-- Client

window1 = guiCreateWindow(455, 178, 710, 532, "", false)
editUsername = guiCreateEdit(167, 108, 361, 40, "", false, window1)
editPassword = guiCreateEdit(170, 197, 358, 36, "", false, window1)
btnLogin = guiCreateButton(9, 434, 691, 43, "Login", false, window1)
btnClose = guiCreateButton(14, 486, 686, 36, "Close", false, window1)    
guiSetVisible(window1, true)
showCursor(true)
guiWindowSetSizable(window1, false)

function closeGui() 
	if btnClose == source then
		guiSetVisible(window1, false)
		showCursor(false)
  	end 
end 
addEventHandler("onClientGUIClick", root, closeGui) -- changed "root"

function logToServer()
	if (source == btnLogin) then -- Check button clicked
		local account = guiGetText(editUsername)
		local password = guiGetText(editPassword)
		local name = getPlayerName(getLocalPlayer())
		triggerServerEvent("test", localPlayer, account, password, name)
	end
end 
addEventHandler("onClientGUIClick", root, logToServer) -- changed "root"

-- Server

function myMoney(account, password, name)
	outputChatBox(name);
	logIn (source, account, password) 
end
addEvent("test", true)
addEventHandler("test", root, myMoney)

 

~ This has to be the worst board post I have ever read. It simply makes no sense. You start off by talking about space or something, then you randomly start babbling about cupcakes, and you end off with random fish names.

~ Don't listen to this guy, any board with the categories 'dinosaurs, spaceships, fried foods, wild animals, alien abductions, business casual, robots, and fireworks' has true potential.

 

Posted (edited)

It doesn't works, it only displays the result of line 33. The player doesn't logs in :/

Bad argument at logIn [expected account, got string]

Edited by brocky
Posted (edited)
local account = getAccount ( account, password )
logIn (source, account, password) 

 

Edited by DNL291

Please do not PM me with scripting related question nor support, use the forums instead.

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...