Hello. At the beginning I would like to inform you that I do not know English and use the translate.google, i am a Poland. I wanted to make registrations in the Gui but I have a problem. My code:
Client
function Gui ()
Image = guiCreateStaticImage(0,0,0.9987,0.9983,"image/serwer.png",true)
BTNz = guiCreateButton(0.7138,0.7367,0.1775,0.07,"Zarejestruj",true,Image)
guiSetAlpha(BTNz,0.75)
addEventHandler( "onClientGUIClick", BTNz, Zarejestruj)
BTNp = guiCreateButton(0.5462,0.3933,0.0538,0.2583,">",true,Image)
guiSetAlpha(BTNp,0.75)
addEventHandler( "onClientGUIClick", BTNp, SkinPrawo)
BTNl = guiCreateButton(0.0262,0.3933,0.0538,0.2583,"<",true,Image)
guiSetAlpha(BTNl,0.75)
addEventHandler( "onClientGUIClick", BTNl, SkinLewo)
NapisNick = guiCreateLabel(0.6825,0.375,0.1225,0.0517,"Nick:",true,Image)
EditNick = guiCreateEdit(0.81,0.36,0.1488,0.055,"",true,Image)
guiLabelSetColor(NapisNick,255,255,255)
guiLabelSetVerticalAlign(NapisNick,"top")
guiLabelSetHorizontalAlign(NapisNick,"left",false,Image)
NapisHaslo = guiCreateLabel(0.6825,0.470,0.1225,0.0517,"Haslo:",true,Image)
EditHaslo = guiCreateEdit(0.81,0.455,0.1488,0.055,"",true,Image)
guiLabelSetColor(NapisHaslo,255,255,255)
guiLabelSetVerticalAlign(NapisHaslo,"top")
guiLabelSetHorizontalAlign(NapisHaslo,"left",false,Image)
guiEditSetMasked(EditHaslo,true)
NapisEmail = guiCreateLabel(0.6825,0.569,0.1225,0.0517,"Adres email:",true,Image)
EditEmail = guiCreateEdit(0.81,0.550,0.1488,0.055,"",true,Image)
guiLabelSetColor(NapisEmail,255,255,255)
guiLabelSetVerticalAlign(NapisEmail,"top")
guiLabelSetHorizontalAlign(NapisEmail,"left",false,Image)
end
local localPlayer = getLocalPlayer ( )
local player = getPlayerName(localPlayer)
--[[guiSetVisible ( Image, false )--gui widoczne bo false
local localPlayer = getLocalPlayer ( )
function RejestracjaOkno ()
local playername = getPlayerName(localPlayer)
guiSetText(EditNick, "" )
guiSetText(EditHaslo, "" )
guiSetText(EditEmail, "" )
guiSetInputEnabled(true)--unbind podczas pisania
showCursor ( true )--kursor włączony
end]]--
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
function ()
Gui()
if (Image ~= nil) then
guiSetVisible(Image, true)
end
showCursor(true)
guiSetInputEnabled(true)
end
)
function Zarejestruj (button,state)
if button == "left" and state == "up" then
local username = guiGetText(EditNick)
local password = guiGetText(EditHaslo)
local email = guiGetText(EditEmail)
if (source == BTNz) then
if username and password and email then
triggerServerEvent("rejestracja", getRootElement(), username, password, email)
end
end
end
end
function Zamykanie()
guiSetInputEnabled(false)
guiSetVisible ( Image, false )
showCursor ( false )
end
--[[function Zarejestruj ()
triggerServerEvent( "Zarejestruj", getRootElement() )
showCursor( true )
end]]
--[[function SkinPrawo ()
triggerServerEvent( "SkinPrawo", getRootElement() )
showCursor( true )
end
function SkinLewo ()
triggerServerEvent( "SkinLewo", getRootElement() )
showCursor( true )
end]]
and server:
function rejestracja ( username, password, email)
local account = getAccount ( username, password )
if ( account ~= false ) then
if (logIn ( player, account, password ) == true) then
triggerClientEvent ( "Zamykanie", getRootElement())
end
else
account = addAccount ( username, password )
setAccountData ( account, "email", email)
if (logIn (player, account, password ) == true) then
triggerClientEvent ( "Zamykanie", getRootElement())
end
end
end
addEvent( "rejestracja", true )
addEventHandler( "rejestracja", getRootElement(), rejestracja )
Where is the error? The script does not work and I have 3 console warningi:
[20:53:37] WARNING: serwer.lua: Access denied @ 'addAccount' - Line: 8
[20:53:37] WARNING: serwer.lua: Bad argument @ 'setAccountData' - Line: 9
[20:53:37] WARNING: serwer.lua: Bad argument @ 'logIn' - Line: 10
account = addAccount ( username, password )
setAccountData ( account, "email", email)
if (logIn (player, account, password ) == true) then
Please help.