0 Üye ve 1 Ziyaretçi konuyu incelemekte.
local resoureName = getResourceName(getThisResource())local sx, sy = guiGetScreenSize()local notification = falselocal link = "http://mta/"..resoureName.."/html/login.html"local initBrowser = guiCreateBrowser(0, 0, sx, sy, true, false, false)local browser = guiGetBrowser(initBrowser)guiSetInputMode("no_binds_when_editing")addEventHandler("onClientBrowserCreated", browser, function() fadeCamera(false,0) loadBrowserURL(source, link) end)function tusEngelleme(tus,state) if not state then return end if tuslar[tus] then cancelEvent() endendaddEventHandler("onClientBrowserDocumentReady", browser, function () fadeCamera(true) showCursor(true) local username, password = loginFile("get") if not (username == "" or password == "") then executeBrowserJavascript(source, "document.getElementById('loginUser').value = '" .. username .. "'"); executeBrowserJavascript(source, "document.getElementById('loginPass').value = '" .. password .. "'"); executeBrowserJavascript(source, "document.getElementById('loginSave').checked = true"); else executeBrowserJavascript(source, "document.getElementById('loginSave').checked = false"); end end)addEvent("onClientPlayerLogin", true)addEventHandler("onClientPlayerLogin", resourceRoot, function() if isTimer ( notification ) then killTimer ( notification ) end destroyElement(initBrowser) showCursor(false) end)addEvent("submitLogin", true)addEventHandler("submitLogin", resourceRoot, function(username, password, checksave) triggerServerEvent("onRequestLogin", resourceRoot, username, password, checksave) end)addEvent("submitRegister", true)addEventHandler("submitRegister", resourceRoot, function(username, password, repassword) triggerServerEvent("onRequestRegister", resourceRoot, username, password, repassword) end)function loginFile(action, username, password) local xml = xmlLoadFile ("@login.xml") if not xml then xml = xmlCreateFile("@login.xml", "login") end local usernameNode = xmlFindChild (xml, "username", 0) local passwordNode = xmlFindChild (xml, "password", 0) if not usernameNode then usernameNode = xmlCreateChild(xml, "username") end if not passwordNode then passwordNode = xmlCreateChild(xml, "password") end if (action == "get") then if usernameNode and passwordNode then return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) else return "", "" end elseif (action == "set") then xmlNodeSetValue (usernameNode, tostring(username)) xmlNodeSetValue (passwordNode, tostring(password)) xmlSaveFile(xml) elseif (action == "remove") then xmlNodeSetValue (usernameNode, "") xmlNodeSetValue (passwordNode, "") xmlSaveFile(xml) end xmlUnloadFile (xml)endaddEvent("useLoginFile", true)addEventHandler("useLoginFile", resourceRoot, loginFile)addEvent("setNotification",true)addEventHandler("setNotification",resourceRoot, function(text) local js = "<div class='error-box alert'> <div class='msg'>"..tostring(text).."</div> <p><a class='toggle-alert' href='#' onclick='closeAlert()'></a></p> </div>" executeBrowserJavascript(browser, 'document.getElementById("alert").innerHTML = "' .. js ..'"') if isTimer ( notification ) then killTimer ( notification ) end notification = setTimer( executeBrowserJavascript, 5000, 1, browser, 'document.getElementById("alert").innerHTML = ""' ) end)local musicas = {"sfx/musica.mp3","sfx/doka.mp3","sfx/alaska.mp3","sfx/poc.mp3"} --Adicione suas musicas aquifunction loadData() som = playSound(musicas[math.random(1,#musicas)],true) setSoundVolume(som, 1)endloadData()function pMusica() stopSound(som)endaddEvent("useLoginFile",true)addEventHandler("useLoginFile",root,pMusica)
addEvent("onRequestLogin",true)addEventHandler("onRequestLogin",resourceRoot, function(username,password,checksave) if not (username == "") then if not (password == "") then local account = getAccount ( username, password ) if ( account ~= false ) then logIn(client,account,password) triggerClientEvent (client,"onClientPlayerLogin",resourceRoot) if checksave and checksave == "1" then triggerClientEvent(client,"useLoginFile",resourceRoot,"set",username,password) else triggerClientEvent(client,"useLoginFile",resourceRoot,"remove",username,password) end else triggerClientEvent(client,"setNotification",resourceRoot,"Kullanıcı adınız veya parolanız yanlış lütfen kontrol ediniz.") end else triggerClientEvent(client,"setNotification",resourceRoot,"Lütfen şifrenizi giriniz.") end else triggerClientEvent(client,"setNotification",resourceRoot,"Lütfen kullanıcı adınızı giriniz.") end end)addEvent("onRequestRegister",true)addEventHandler("onRequestRegister",resourceRoot, function(username,password,repassword) if not (username == "") then if not (password == "") then if not (repassword == "") then if password == repassword then local account = getAccount (username) if (account == false) then local accountAdded = addAccount(tostring(username),tostring(password)) if (accountAdded) then logIn(client,accountAdded,password) triggerClientEvent(client,"onClientPlayerLogin",resourceRoot) triggerClientEvent(client,"useLoginFile",resourceRoot,"set",username,password) outputChatBox("#00FF00[!] #FFFFFFBaşarıyla kayıt oldunuz. ( Kullanıcı Adınız: #206694" .. username .. " #FFFFFF| Şifreniz: #206694" .. password .. " #FFFFFF)",client,255,255,255,true) else triggerClientEvent(client,"setNotification",resourceRoot,"Kullanıcı adı sunucuda kullanıyor.") end else triggerClientEvent(client,"setNotification",resourceRoot,"Bu hesap sunucuda kullanılıyor lütfen başka bir hesap oluşturmaya çalışınız.") end else triggerClientEvent(client,"setNotification",resourceRoot,"Parolalar uyuşmuyor...!") end else triggerClientEvent(client,"setNotification",resourceRoot,"Hesap oluşturmak için şifrenizi doğrulamanız gerekir.") end else triggerClientEvent(client,"setNotification",resourceRoot,"Hesap oluşturmak için şifre girmeniz gerekir.") end else triggerClientEvent(client,"setNotification",resourceRoot,"Hesap oluşturmak için kullanıcı adı girmeniz gerekir.") end end)
local resoureName = getResourceName(getThisResource())local sx, sy = guiGetScreenSize()local notification = falselocal link = "http://mta/"..resoureName.."/html/login.html"local initBrowser = guiCreateBrowser(0, 0, sx, sy, true, false, false)local browser = guiGetBrowser(initBrowser)guiSetInputMode("no_binds_when_editing")addEventHandler("onClientBrowserCreated", browser, function() fadeCamera(false,0) logindurum = true loadBrowserURL(source, link) end)butons = { ["F1"] = true, -- iptal edilcek tuş ["F2"] = true, -- iptal edilcek tuş ["F3"] = true, -- iptal edilcek tuş ["F4"] = true, -- iptal edilcek tuş ["F5"] = true, -- iptal edilcek tuş ["F6"] = true, -- iptal edilcek tuş ["F7"] = true, -- iptal edilcek tuş ["F8"] = true, ["F9"] = true, ["F10"] = true, ["F11"] = true, ["F12"] = true, ["b"] = true, ["tab"] = true, ["Tab"] = true, ["o"] = true, } addEventHandler("onClientKey", root, function(button, press) -- oyuncu herhangi bir tuşa bastığında if logindurum == true and butons[button] then -- eğer basılan uton tusların içinde varsa ve oyuncunun datası bellirtilen data ise cancelEvent() end end)addEventHandler("onClientBrowserDocumentReady", browser, function () fadeCamera(true) showCursor(true) local username, password = loginFile("get") if not (username == "" or password == "") then executeBrowserJavascript(source, "document.getElementById('loginUser').value = '" .. username .. "'"); executeBrowserJavascript(source, "document.getElementById('loginPass').value = '" .. password .. "'"); executeBrowserJavascript(source, "document.getElementById('loginSave').checked = true"); else executeBrowserJavascript(source, "document.getElementById('loginSave').checked = false"); end end)addEvent("onClientPlayerLogin", true)addEventHandler("onClientPlayerLogin", resourceRoot, function() if isTimer ( notification ) then killTimer ( notification ) end destroyElement(initBrowser) showCursor(false) logindurum = false end)addEvent("submitLogin", true)addEventHandler("submitLogin", resourceRoot, function(username, password, checksave) triggerServerEvent("onRequestLogin", resourceRoot, username, password, checksave) end)addEvent("submitRegister", true)addEventHandler("submitRegister", resourceRoot, function(username, password, repassword) triggerServerEvent("onRequestRegister", resourceRoot, username, password, repassword) end)function loginFile(action, username, password) local xml = xmlLoadFile ("@login.xml") if not xml then xml = xmlCreateFile("@login.xml", "login") end local usernameNode = xmlFindChild (xml, "username", 0) local passwordNode = xmlFindChild (xml, "password", 0) if not usernameNode then usernameNode = xmlCreateChild(xml, "username") end if not passwordNode then passwordNode = xmlCreateChild(xml, "password") end if (action == "get") then if usernameNode and passwordNode then return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) else return "", "" end elseif (action == "set") then xmlNodeSetValue (usernameNode, tostring(username)) xmlNodeSetValue (passwordNode, tostring(password)) xmlSaveFile(xml) elseif (action == "remove") then xmlNodeSetValue (usernameNode, "") xmlNodeSetValue (passwordNode, "") xmlSaveFile(xml) end xmlUnloadFile (xml)endaddEvent("useLoginFile", true)addEventHandler("useLoginFile", resourceRoot, loginFile)addEvent("setNotification",true)addEventHandler("setNotification",resourceRoot, function(text) local js = "<div class='error-box alert'> <div class='msg'>"..tostring(text).."</div> <p><a class='toggle-alert' href='#' onclick='closeAlert()'></a></p> </div>" executeBrowserJavascript(browser, 'document.getElementById("alert").innerHTML = "' .. js ..'"') if isTimer ( notification ) then killTimer ( notification ) end notification = setTimer( executeBrowserJavascript, 5000, 1, browser, 'document.getElementById("alert").innerHTML = ""' ) end)local musicas = {"sfx/musica.mp3","sfx/doka.mp3","sfx/alaska.mp3","sfx/poc.mp3"} --Adicione suas musicas aquifunction loadData() som = playSound(musicas[math.random(1,#musicas)],true) setSoundVolume(som, 1)endloadData()function pMusica() stopSound(som)endaddEvent("useLoginFile",true)addEventHandler("useLoginFile",root,pMusica)