Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --SERVER
- function showLogin()
- bindKey (source,"F2","down",
- function(player,key,state)
- triggerClientEvent ( player, "displayLoginWindow", getRootElement())
- end
- )
- end
- addEventHandler ("onPlayerConnect",getRootElement(),showLogin)
- addEvent("submitLogin", true)
- addEventHandler("submitLogin", getRootElement(),
- function(player, username, password, thePlayer)
- local account = getAccount(username, password)
- if (account ~= false) then
- if (logIn(player, account, password) == true) then
- triggerClientEvent(player, "hideLoginWindow1", getRootElement())
- local playerMoney = getAccountData (account, "account.money")
- local playerSkin = getAccountData (account, "account.skin")
- local playerX = getAccountData (account, "account.position.x")
- local playerY = getAccountData (account, "account.position.y")
- local playerZ = getAccountData (account, "account.position.z")
- local playerInt = getAccountData (account, "account.int")
- local playerDim = getAccountData (account, "account.dim")
- local playerWanted = getAccountData (account, "account.wantedlevel")
- local playerWeaponID = getAccountData (account, "account.weaponID")
- local playerWeaponAmmo = getAccountData (account, "account.weaponAmmo")
- local playerEXP = getAccountData (account, "levels.exp")
- local playerLEVEL = getAccountData (account, "levels.level")
- spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim, spawnTeam)
- setPlayerMoney (source, playerMoney)
- setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted)
- setTimer (giveWeapon, 500, 1, source, playerWeaponID, playerWeaponAmmo, true)
- if ( hasObjectPermissionTo ( playerSource, "function.kickPlayer", false ) ) then
- local theStaffTeam = getTeamFromName ( "Staff" )
- setPlayerTeam ( source, theStaffTeam )
- end
- else
- outputChatBox ( "Error: Username/Password incorrect or already logged in.", player, 255, 0, 0, true )
- end
- else
- outputChatBox ( "Error: Account does not exist!", player, 255, 0, 0, true )
- end
- end
- )
- addEvent("submitRegister", true)
- addEventHandler("submitRegister", getRootElement(),
- function(player, username, password)
- local account = getAccount(username, password)
- if (account ~= false) then
- outputChatBox ( "Error: Account Taken!", player, 255, 0, 0, true )
- else
- account1 = addAccount(username, password)
- if (logIn(player, account1, password) == true) then
- triggerClientEvent(player, "hideLoginWindow", getRootElement())
- else
- outputChatBox ( "Error: Please enter a username and password or press the SKIP button!", player, 255, 0, 0, true )
- end
- end
- end
- )
- addEvent("playerSpawn", true)
- addEventHandler("playerSpawn", getRootElement(),
- function()
- spawnPlayer ( client, 215, 1868, 14, 0, 287, 0, 0)
- end
- )
- --CLIENT
- addEvent("displayLoginWindow", true)
- addEventHandler("displayLoginWindow", getRootElement(),
- function()
- guiSetInputEnabled(true)
- showCursor(true)
- guiSetVisible(login_window,true)
- login_window = guiCreateWindow(508,224,357,342,"Login Panel",false)
- username_edit = guiCreateEdit(92,52,245,25,"",false,login_window)
- username_label = guiCreateLabel(18,52,64,17,"Username:",false,login_window)
- password_label = guiCreateLabel(18,111,64,17,"Password:",false,login_window)
- password_edit = guiCreateEdit(92,103,245,25,"",false,login_window)
- guiEditSetMasked ( password_edit, true )
- login_button = guiCreateButton(32,144,139,48,"Login!",false,login_window)
- addEventHandler("onClientGUIClick", login_button, submitLogin, false)
- register_button = guiCreateButton(189,144,139,48,"Register!",false,login_window)
- addEventHandler("onClientGUIClick", register_button, submitRegister, false)
- info_label = guiCreateLabel(18,196,319,73,"Registration and login is highly recommended as it saves\nall progress you make such as your money, experiance \nlevels, weapons and more! If you do not wish to register \nor login now press the 'SKIP' button below, You can \nalways login/register again by pressing the F2 button.",false,login_window)
- skip_button = guiCreateButton(126,274,106,41,"SKIP",false,login_window)
- addEventHandler("onClientGUIClick", skip_button, hideLoginWindow1, false)
- guiSetFont(skip_button,"default-bold-small")
- warning_label = guiCreateLabel(92,315,209,17,"WARNING CASE SENSITIVE!",false,login_window)
- guiLabelSetColor(warning_label,255,0,0)
- guiSetFont(warning_label,"clear-normal")
- end
- )
Add Comment
Please, Sign In to add comment