darbka2002 Posted March 22, 2016 Share Posted March 22, 2016 سلام عليكم عندى مشكلة فى سكربت login السكربت شغال تمام بس المشكلة لما اعمل تسجيل دخول ما يظهر radar و ما يظهر map و ما يرضا يفتح gui راح اضيف جزء حق login REGISTRATION_WAITTIME = 120 -- Time Limit Between Account Registrations (Minutes) REGISTRATION_CUTOFF = 5 -- Maximum number of registrations per minute local registrations = {} -- Record of registrations by serial local regTotal = 0 -- Count of Total Registrations -- Show Login Panel -------------------->> function initResource(plr) dbc = dbConnect("sqlite", "accounts.db") for index, players in pairs(getElementsByType("player")) do local acc = getPlayerAccount(players) if (not isGuestAccount(acc)) then redirectPlayer (players, "87.98.180.15", 22060) logOut(players) logOut(acc) exports.CSTtexts:output("Our account system has been restarted and you've been logged out as a security precaution,", players, 255, 0, 0) exports.CSTtexts:output("Please Login Again.", players, 255, 0, 0) end end end addEventHandler("onResourceStart", resourceRoot, initResource) function showLoginPanel() if (client) then source = client end local account = getPlayerAccount(source) if (not isGuestAccount(account)) then return end if (getServerPort() == 22060 and exports.CSTgovt:isPlayerBanned(source)) then return end fadeCamera(source, true) textDisplayRemoveObserver(display, source) triggerClientEvent(source, "CSTaccounts.showLoginPanel", resourceRoot) end addEvent("CSTaccounts.showLoginPanelServer", true) addEventHandler("CSTaccounts.showLoginPanelServer", root, showLoginPanel) -- Block Logouts addEventHandler("onPlayerLogout", root, function() cancelEvent() end) -- Login Player ---------------->> function loginPlayer(username, password, rememberMe, isEncrypted) local validUsername = getAccount(username) if (not validUsername) then triggerClientEvent(client, "CSTaccounts.outputLoginMessage", client, "Error: Username does not exist", 255, 25, 25) return end if (isEncrypted) then password = decryptPassword(password) end local account = getAccount(username, password) if (not account) then triggerClientEvent(client, "CSTaccounts.outputLoginMessage", client, "Error: Invalid Password Provided.", 255, 25, 25) return end if (getServerPort() == 22060 and exports.CSTgovt:isPlayerBanned(username)) then triggerClientEvent(client, "CSTaccounts.outputLoginMessage", client, "Error: This account is banned.", 255, 25, 25) return end local loginSuccess = logIn(client, account, password) if (not loginSuccess) then triggerClientEvent(client, "CSTaccounts.outputLoginMessage", client, "Error: This account is already in use.", 255, 125, 25) return end triggerClientEvent(client, "CSTaccounts.outputLoginMessage", client, "Login Successful", 25, 255, 25) spawn(client) local securePass if (rememberMe) then securePass = encryptPassword(password) end triggerClientEvent(client, "CSTaccounts.confirmLogin", client, username, securePass) end addEvent("CSTaccounts.loginPlayer", true) addEventHandler("CSTaccounts.loginPlayer", root, loginPlayer) -- Register Player ------------------->> function checkUsernameValidity(username) local account = getAccount(username) if (not account) then triggerClientEvent(client, "CSTaccounts.returnUsernameValidity", client, "This Username is Available!", 25, 255, 25) else triggerClientEvent(client, "CSTaccounts.returnUsernameValidity", client, "This Username is Not Available!", 255, 25, 25) end end addEvent("CSTaccounts.checkUsernameValidity", true) addEventHandler("CSTaccounts.checkUsernameValidity", root, checkUsernameValidity) function registerPlayer(username, email, password) local serial = getPlayerSerial(client) if (registrations[serial]) then local timeLeft = getTimerDetails(registrations[serial]) local H = math.floor(timeLeft/3600000) local M = math.floor( (timeLeft - H*3600000)/60000 ) exports.CSTtexts:output("Error: You have recently registered an account.\nYou must wait another "..H.." hour(s) "..M.." minute(s) before creating a new one.", client, 255, 25, 25) return end local account = getAccount(username) if (account) then exports.CSTtexts:output("Error: This account is not available.", client, 255, 25, 25) return end -- Security Settings regTotal = regTotal + 1 if (regTotal == REGISTRATION_CUTOFF) then exports.CSTtexts:output("There has been a high number of registrations in the past minute.\nFor security reasons, your account cannot be registered. Try again in a minute.", client, 255, 25, 25) return end local account = addAccount(username, password) if (not account) then exports.CSTtexts:output("Error: Your account could not be created.", client, 255, 25, 25) return end if (email ~= "") then SAD(account, "email", email) end local timestamp = getRealTime().timestamp SAD(account, "accountCreation", timestamp) registrations[serial] = setTimer( function() registrations[serial] = nil end, 60000*REGISTRATION_WAITTIME, 1 ) triggerClientEvent(client, "CSTaccounts.comfirmRegistration", resourceRoot) end addEvent("CSTaccounts.registerPlayer", true) addEventHandler("CSTaccounts.registerPlayer", root, registerPlayer) -- Security Features --------------------->> -- Reset Registration Cutoff Per Minute setTimer(function() regTotal = 0 end, 60000, 0) -- Cancel ---------->> --[[ function leaveServer() if (isPlayerLogged kickPlayer(client, "User Quit") end--]] addEvent("CSTaccounts.leaveServer", true) --addEventHandler("CSTaccounts.leaveServer", root, leaveServer) function gettheupdates() ag1 = exports.CSTupdatesinfo:getUpdates() triggerClientEvent(client, "CSTaccounts.addtheupdate", client, ag1) end addEvent("CSTaccounts.addtheshit", true) addEventHandler("CSTaccounts.addtheshit", root, gettheupdates) -- When the player joins spawn him ingame addEventHandler( "onPlayerJoin", root, function () setCameraTarget ( source ) fadeCamera( source, true, 1.0, 0, 0, 0 ) exports.CSTteams:setPlayerTeam(source, "Unemployed") setElementData(source, "Occupation", "Guest") end ) ياريت مساعدة Link to comment
#|_oskar_|# Posted March 22, 2016 Share Posted March 22, 2016 افتح ملف كلنت وابحث عن الكود ذا وامسحه showPlayerHudComponent Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now