Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------
- -----------| Settings |-----------
- ----------------------------------
- blackLoginScreen = false -- Set to 'true' to display a black screen to the player untill they log in or choose to play as a guest.
- enableKickPlayer = true -- Set whether to kick the player after they fail to login specified amount of times.
- disallowLogout = false -- Set whether to show the userpanel to the players if they log out of their accounts.
- removeBlackScreenTime = 4 -- The time it takes for the black screen to dissapear - If you choose to display the black screen. [IN SECONDS]
- maxLoginAttempts = 5 -- Set the maximum incorrect login attempts before the player gets kicked - If player kicking is enabled.
- ----------------------------------
- -- Set the text you want displayed in the "rules" window here - use '\n' to go into the next line
- infoText = "Siema!\nOtwieramy server MTA:SA na naszej ulubionej sieci HolySkill.pl\nZapraszam kazdego do gry!\nPozdro\nOski"
- guiSetInputEnabled(true)
- -- Screen and GUI window sizes
- screenWidth,screenHeight = guiGetScreenSize()
- mainWidth,mainHeight = 439,350
- regWidth,regHeight = 439,440
- statWidth,statHeight = 439,500
- -- Generate the XML file name
- function getServerName()
- triggerServerEvent("onClientLoginLoaded",getLocalPlayer())
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getServerName)
- function setXmlFileName(sName)
- xmlFileName = tostring("login_"..sName..".xml")
- loginPanel()
- end
- addEvent("onGetServerData",true)
- addEventHandler("onGetServerData",getRootElement(),setXmlFileName)
- ----------------------------------
- addEvent("onRequestIncreaseAttempts",true)
- addEvent("onRequestDisplayPanel",true)
- function loginPanel()
- -- Check if autologin is enabled - If yes, then log the player in, else create and show the userpanel
- local xmlFile = xmlLoadFile(xmlFileName)
- if xmlFile then
- status = xmlNodeGetAttribute(xmlFile,"autologin")
- if (status == "true") then
- local username = tostring(xmlNodeGetAttribute(xmlFile,"username"))
- local password = tostring(xmlNodeGetAttribute(xmlFile,"password"))
- if not (username == "") and not (password == "") then
- triggerServerEvent("onRequestAutologin",getLocalPlayer(),username,password)
- end
- else
- if blackLoginScreen == true then
- setCameraMatrix(-1798.4619140625,890.6220703125,78.623817443848,-1775.4619140625,918.6220703125,24.623817443848,0,70)
- end
- setCameraMatrix(-1798.4619140625,890.6220703125,78.623817443848,-1775.4619140625,918.6220703125,24.623817443848,0,70)
- mainWindow = guiCreateWindow(0.3492,0.3104,0.3383,0.3531,"Panel Logowania by Nero657 (c)",true)
- guiSetAlpha(mainWindow,1)
- guiWindowSetMovable(mainWindow,false)
- guiWindowSetSizable(mainWindow,false)
- imglogowanie = guiCreateStaticImage(0.0208,0.0383,0.9215,0.2773,"logowanie.png",true,mainWindow)
- lblLogin = guiCreateLabel(0.0462,0.4277,0.164,0.0619,"LOGIN:",true,mainWindow)
- guiLabelSetVerticalAlign(lblLogin,"center")
- guiSetFont(lblLogin,"default-bold-small")
- lblHaslo = guiCreateLabel(0.0462,0.5487,0.1755,0.0855,"HASŁO:",true,mainWindow)
- guiLabelSetVerticalAlign(lblHaslo,"center")
- guiSetFont(lblHaslo,"default-bold-small")
- editPassword = guiCreateEdit(0.2217,0.5575,0.6028,0.0737,"",true,mainWindow)
- guiEditSetMasked(editPassword,true)
- guiEditSetMaxLength(editPassword,20)
- editUsername = guiCreateEdit(0.2217,0.4277,0.6028,0.0737,"",true,mainWindow)
- guiEditSetMaxLength(editUsername,20)
- btnLogin = guiCreateButton(0.0462,0.7227,0.4365,0.1534,"LOGOWANIE",true,mainWindow)
- guiSetFont(btnLogin,"default-bold-small")
- btnToggleRegister = guiCreateButton(0.5058,0.7227,0.4365,0.1534,"REJSTRACJA",true,mainWindow)
- guiSetFont(btnToggleRegister,"default-bold-small")
- infolbl = guiCreateLabel(0.0208,0.9351,0.7945,0.0442,"Copyright by Nero657 2012",true,mainWindow)
- -----------------------------------------------------------------------------------------------------------------------------------------------------
- registerWindow = guiCreateWindow(0.2859,0.2927,0.4305,0.4969,"Panel Logowania by Nero657 (c)",true)
- guiSetAlpha(registerWindow,1)
- guiWindowSetSizable(registerWindow,false)
- guiWindowSetMovable(registerWindow,false)
- registerimg = guiCreateStaticImage(0.029,0.0587,0.9201,0.2851,"rejstracja.png",true,registerWindow)
- editRegistrationUsername = guiCreateEdit(0.2396,0.3983,0.5009,0.065,"",true,registerWindow)
- guiEditSetMaxLength(editRegistrationUsername,20)
- editRegistrationPassword = guiCreateEdit(0.2396,0.4843,0.5009,0.065,"",true,registerWindow)
- guiEditSetMasked(editRegistrationPassword,true)
- guiEditSetMaxLength(editRegistrationPassword,20)
- editRegistrationRepeatPassword = guiCreateEdit(0.2396,0.5702,0.5009,0.065,"",true,registerWindow)
- guiEditSetMasked(editRegistrationRepeatPassword,true)
- guiEditSetMaxLength(editRegistrationRepeatPassword,20)
- lblLogin = guiCreateLabel(0.0181,0.3983,0.2033,0.065,"Twój login:",true,registerWindow)
- guiLabelSetVerticalAlign(lblLogin,"center")
- guiSetFont(lblLogin,"default-bold-small")
- lblHaslo = guiCreateLabel(0.0181,0.4843,0.2033,0.065,"Twoje haslo:",true,registerWindow)
- guiLabelSetVerticalAlign(lblHaslo,"center")
- guiSetFont(lblHaslo,"default-bold-small")
- lblPowtorzHaslo = guiCreateLabel(0.0181,0.5702,0.2214,0.065,"Potwierdz twoje haslo:",true,registerWindow)
- guiLabelSetVerticalAlign(lblPowtorzHaslo,"center")
- guiSetFont(lblPowtorzHaslo,"default-bold-small")
- btnConfirmRegistration = guiCreateButton(0.0544,0.717,0.5281,0.109,"REJSTRACJA",true,registerWindow)
- guiSetFont(btnConfirmRegistration,"default-bold-small")
- btnCancel = guiCreateButton(0.6897,0.8826,0.274,0.086,"Powrot do\nlogowania",true,registerWindow)
- reg = guiCreateLabel(0.3811,0.6562,0.4356,0.0398,"Rejestrując się akcetpujesz REGULAMIN",true,registerWindow)
- guiSetFont(reg,"default-bold-small")
- regBtn = guiCreateButton(0.6007,0.717,0.3394,0.109,"REGULAMIN",true,registerWindow)
- maxlabel = guiCreateLabel(0.7586,0.4088,0.216,0.0545,"(max 20 znaków)",true,registerWindow)
- maxlabel3 = guiCreateLabel(0.7586,0.5807,0.216,0.0545,"(max 20 znaków)",true,registerWindow)
- maxlabel2 = guiCreateLabel(0.7586,0.4948,0.216,0.0545,"(max 20 znaków)",true,registerWindow)
- info = guiCreateLabel(0.0327,0.9413,0.3666,0.0524,"Copyright by Nero657 2012",true,registerWindow)
- -----------------------------------------------------///////STATY//////----------------------------------------------------------------------------
- statystyki = guiCreateWindow(0.3688,0.2406,0.3148,0.4667,"Statystyki by Nero657 (c)",true)
- guiSetAlpha(statystyki,1)
- statimg = guiCreateStaticImage(0.0372,0.067,0.8859,0.2879,"staty.png",true,statystyki)
- stat_label = guiCreateLabel(0.0794,0.3638,0.8238,0.4219,"",true,statystyki)
- guiLabelSetColor(stat_label,112,122,122)
- guiLabelSetVerticalAlign(stat_label,"center")
- guiSetFont(stat_label,"default-bold-small")
- buttonok = guiCreateButton(0.5285,0.8504,0.4069,0.1071,"Przejdź dalej",true,statystyki)
- guiSetFont(buttonok,"default-bold-small")
- infolbl2 = guiCreateLabel(0.0521,0.942,0.4169,0.0513,"Copyright by Nero657",true,statystyki)
- -----------------------------------------------------------------------------------------------------------------------------------------------------
- -----------------------------------------------------///////widescr//////----------------------------------------------------------------------------
- wideScreenGUI = guiCreateStaticImage(0,0,1,1,"widescreen.png",true,getRootElement())
- guiMoveToBack (wideScreenGUI)
- -----------------------------------------------------------------------------------------------------------------------------------------------------
- guiSetVisible(mainWindow, true)
- guiSetVisible(registerWindow, false)
- guiSetVisible(statystyki, false)
- guiSetInputEnabled(true)
- showCursor(true)
- addEventHandler("onClientGUIClick",btnLogin,onClickLogin)
- addEventHandler("onClientGUIClick",btnToggleRegister,onClickRegisterToggle)
- addEventHandler("onClientGUIClick",btnConfirmRegistration,onClickRegisterConfirm)
- addEventHandler("onClientGUIClick",btnCancel,onClickCancel)
- addEventHandler("onRequestIncreaseAttempts",getRootElement(),increaseAttempts)
- addEventHandler( "onClientGUIClick", buttonok, zamknijoknostaty )
- attemptedLogins = 0
- end
- xmlUnloadFile(xmlFile)
- else
- xmlFileHandler(true)
- end
- addEventHandler("onRequestDisplayPanel",getRootElement(),logoutHandler)
- end
- --addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loginPanel)
- function enableWideScreen (player)
- if (getLocalPlayer() == player) then
- guiSetVisible (wideScreenGUI,true)
- guiMoveToBack (wideScreenGUI)
- end
- end
- function disableWideScreen (player)
- guiSetVisible (wideScreenGUI,false)
- end
- addEventHandler ("onClientGUIClick",getRootElement(),
- function(button,state,absx,absy)
- if (source == wideScreenGUI) then
- guiMoveToBack (wideScreenGUI)
- end
- end)
- function ustaw(name,login,playerSkin,czasOnline,dataRejstracji,ostatniaWizyta)
- guiSetText(stat_label,"Nick: "..name.."\nLogin: "..login.."\nSkin: "..playerSkin.."\nCzas Online: "..czasOnline.."\nData rejstracji: "..dataRejstracji.."\nData ostatniej wizyty:"..ostatniaWizyta.."")
- end
- addEvent("ustaw",true)
- addEventHandler("ustaw",getRootElement(),ustaw)
- function pokazstaty()
- guiSetVisible(statystyki, true)
- guiSetEnabled ( buttonok, false )
- timer = setTimer ( guiSetEnabled, 10000, 1, buttonok, true )
- setTimer ( guiSetText,10000,1,buttonok,"OK")
- setTimer(
- function()
- if isTimer(timer) then
- remaining, a, b = getTimerDetails(timer)
- local czas = math.floor(tonumber(remaining/1000))
- guiSetText(buttonok, "Poczekaj ("..czas..")sek.")
- end
- end, 1000, 11,timer,buttonok )
- triggerServerEvent ("koncwe",getRootElement(),getLocalPlayer())
- end
- addEvent("ShowStaty", true)
- addEventHandler("ShowStaty",getRootElement(),pokazstaty)
- -- LOGIN PLAYER
- function onClickLogin(button,state)
- if(button == "left" and state == "up") then
- if (source == btnLogin) then
- username = guiGetText(editUsername)
- password = guiGetText(editPassword)
- triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,enableKickPlayer,attemptedLogins,maxLoginAttempts)
- xmlFileHandler()
- end
- end
- end
- function zamknijoknostaty()
- if source == buttonok then
- guiSetVisible(statystyki, false)
- showCursor(false)
- setCameraTarget ( getLocalPlayer() )
- disableWideScreen (player)
- end
- end
- -- REGISTER PLAYER
- function onClickRegisterConfirm(button,state)
- if(button == "left" and state == "up") then
- if (source == btnConfirmRegistration) then
- username = guiGetText(editRegistrationUsername)
- password = guiGetText(editRegistrationPassword)
- passwordConfirm = guiGetText(editRegistrationRepeatPassword)
- triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
- end
- end
- end
- -- Open registration window
- function onClickRegisterToggle(button,state)
- if(button == "left" and state == "up") then
- if (source == btnToggleRegister) then
- guiSetVisible(registerWindow, true)
- guiBringToFront(registerWindow)
- guiSetInputEnabled(true)
- showCursor(true)
- end
- end
- end
- -- Cancel registration
- function onClickCancel(button,state)
- if(button == "left" and state == "up") then
- if (source == btnCancel) then
- guiSetVisible(mainWindow, true)
- guiSetVisible(registerWindow, false)
- guiSetInputEnabled(true)
- showCursor(true)
- end
- end
- end
- -- Show login window
- function showLoginWindow()
- guiSetVisible(mainWindow, true)
- guiSetVisible(registerWindow, false)
- guiSetInputEnabled(true)
- enableWideScreen()
- showCursor(true)
- end
- addEvent("showLoginWindow", true)
- addEventHandler("showLoginWindow",getRootElement(),showLoginWindow)
- -- Hide login window
- function hideLoginWindow()
- guiSetInputEnabled(false)
- guiSetVisible(mainWindow, false)
- guiSetVisible(registerWindow, false)
- if blackLoginScreen == true then
- setCameraMatrix(-1798.4619140625,890.6220703125,78.623817443848,-1775.4619140625,918.6220703125,24.623817443848,0,70)
- end
- setCameraMatrix(-1798.4619140625,890.6220703125,78.623817443848,-1775.4619140625,918.6220703125,24.623817443848,0,70)
- end
- addEvent("hideLoginWindow", true)
- addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)
- -- Hide register window
- function hideRegisterWindow()
- guiSetInputEnabled(true)
- guiSetVisible(mainWindow, true)
- guiSetVisible(registerWindow, false)
- showCursor(true)
- end
- addEvent("hideRegisterWindow", true)
- addEventHandler("hideRegisterWindow", getRootElement(), hideRegisterWindow)
- -- Show login panel when a player logs out if 'dissalowLogout' is set to TRUE
- function logoutHandler()
- if (disallowLogout == true) then
- loginPanel()
- setTimer(outputChatBox,600,1,"#0000FF* #FFFFFFWarning! You have logged out. Please login again.",255,255,255,true)
- end
- end
- -----------------------------------------------------------------------------------------------|
- -- XML File Handler
- function xmlFileHandler(gReturn)
- local xmlFile = xmlLoadFile(xmlFileName)
- if not xmlFile then
- xmlFile = xmlCreateFile(xmlFileName,"settings")
- xmlNodeSetAttribute(xmlFile,"autologin","false")
- end
- xmlNodeSetAttribute(xmlFile,"username",tostring(guiGetText(editUsername)))
- xmlNodeSetAttribute(xmlFile,"password",tostring(guiGetText(editPassword)))
- xmlSaveFile(xmlFile)
- xmlUnloadFile(xmlFile)
- if (gReturn) then
- if (gReturn == true) then
- loginPanel()
- else
- return
- end
- end
- end
- -- Increase Login Attepts
- function increaseAttempts()
- attemptedLogins = attemptedLogins+1
- end
- ------------------------------------------------------------------------------------------------------------------------------
- infoWnd = guiCreateWindow(0.3773,0.4824,0.2727,0.2393,"Informacja",true)
- buttzamknijboxlogin = guiCreateButton(0.2865,0.7796,0.3782,0.1388,"OK",true,infoWnd)
- img = guiCreateStaticImage(0.0831,0.2857,0.3037,0.3429,"info.png",true,infoWnd)
- login = guiCreateMemo(0.4212,0.1143,0.4814,0.6204,"",true,infoWnd)
- guiMemoSetReadOnly(login,true)
- guiSetVisible(infoWnd, false)
- showCursor(false)
- function logininfo(co)
- guiSetVisible(infoWnd, true)
- guiSetText(login, tostring(co))
- showCursor(true)
- guiBringToFront ( infoWnd )
- end
- function zamknijlogin_panel(player)
- if source == buttzamknijboxlogin then
- guiSetVisible(infoWnd, false)
- end
- end
- addEventHandler( "onClientGUIClick", buttzamknijboxlogin, zamknijlogin_panel )
- addEvent("msgBoxLogin", true)
- addEventHandler("msgBoxLogin", getRootElement(), logininfo)
- ----------------------------------------------------------------------------
- local gR = getRootElement()
- local gRR = getResourceRootElement( getThisResource() )
- local gMe = getLocalPlayer()
- local plane = createObject(1681,3660,-850,350,0,0,0)
- setElementDimension( plane, 1 )
- function showintro()
- showPlayerHudComponent( "radar", false )
- fadeCamera( false, 0.5, 0, 0, 0 )
- setElementDimension( gMe,1 )
- setTimer(
- function ()
- fadeCamera( true, 1.2, 0, 0, 0 )
- moveObject( plane, 9000,-1701,-255,14.2)
- setTimer(
- function ()
- fadeCamera( false, 1.0, 0, 0, 0 )
- end
- , 7500, 1 )
- addEventHandler( 'onClientPreRender', gR, updateCam1 )
- setTimer(
- function ()
- fadeCamera( true, 0.5, 0, 0, 0 )
- addEventHandler( 'onClientPreRender', gR, updateCam2 )
- setTimer(
- function ()
- --addEventHandler( 'onClientPreRender', gR, updateCam2 )
- setTimer(
- function ()
- addEventHandler( 'onClientPreRender', gR, updateCam3 )
- setTimer(
- function()
- removeEventHandler( 'onClientPreRender', gR, updateCam1 )
- removeEventHandler( 'onClientPreRender', gR, updateCam2 )
- removeEventHandler( 'onClientPreRender', gR, updateCam3 )
- setElementDimension( gMe,0 )
- setCameraTarget( gMe, gMe )
- showPlayerHudComponent( "radar", true )
- fadeCamera( true, 1.5, 0, 0, 0 )
- setCameraTarget (gMe,gMe)
- end
- , 10500, 1 )
- end
- , 8500, 1 )
- end
- , 9000, 1 )
- end
- , 8000, 1 )
- end
- , 1000, 1 )
- end
- addCommandHandler("intro",
- function ()
- showintro()
- end
- )
- function updateCam1()
- local cx, cy, cz = getElementPosition( thing )
- local tx, ty, tz = getElementPosition( plane )
- setCameraMatrix ( cx, cy, cz, tx, ty, tz )
- end
- function updateCam2()
- local cx, cy, cz = getElementPosition( thing2 )
- local tx, ty, tz = getElementPosition( thing )
- setCameraMatrix ( cx, cy, cz, tx, ty, tz )
- end
- function updateCam3()
- local cx, cy, cz = getElementPosition( thing2 )
- local tx, ty, tz = getElementPosition( thing )
- setCameraMatrix ( cx, cy, cz, tx, ty, tz )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement