[YARDIM] Login Panel Hud Radar Sorunu

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı Prose

  • Deneyimli Üye
  • *
    • İleti: 454
  • Gökhan Türkoglu
: 25 Mayıs 2017, 20:30:33
Selamun Aleyküm,
Bir Login Panel Buldum Fakat Login Panel Gelince Hud radar kayboluyor log olduktan snra gelmiyor bi yardımcı olurmusunuz

Client.lua:
Kod: lua
local screenW, screenH = guiGetScreenSize()

local X, Y = guiGetScreenSize()
local hX, hY = (X/2)-(1920/2), (Y/2)-(1080/2)

local font_0 = guiCreateFont("font.ttf")
local font_1 = guiCreateFont("font.ttf",11)

local isButtonOn4 = false;

guiSetInputMode("no_binds_when_editing")

addEventHandler("onClientResourceStart", resourceRoot,
function()
showCursor(true)
        loginwindow = guiCreateStaticImage((screenW - 489) / 2, (screenH - 253) / 2, 489, 253, "window2.png", false)
        guiSetAlpha(loginwindow, 0.99)
guiSetVisible(loginwindow, true)

        logintitle = guiCreateLabel(155, 0, 293, 15, "Hilal Askeri Roleplay", false, loginwindow)
        guiSetFont(logintitle, font_0)
        logininfo = guiCreateLabel(8, 25, 453, 98, "Merhaba "..removeColorCoding(getPlayerName(getLocalPlayer())).."\nÜye olmadıysanız bilgilerinizi girip kayıt ol tuşuna basınız\neğer üyeliğiniz var ise login butonuna basarak giriş yapabilirsiniz.", false, loginwindow)
        guiSetFont(logininfo, font_1)
        loginuserlbl = guiCreateLabel(10, 118, 160, 37, "Kullanıcı adı : ", false, loginwindow)
        guiSetFont(loginuserlbl, font_1)
        loginuserpass = guiCreateLabel(10, 165, 160, 37, "Şifre : ", false, loginwindow)
        guiSetFont(loginuserpass, font_1)
        useredit = guiCreateEdit(143, 108, 174, 32, "", false, loginwindow)
        passedit = guiCreateEdit(143, 160, 174, 32, "", false, loginwindow)
guiEditSetMaxLength ( useredit,25)
guiEditSetMaxLength ( passedit,25)
guiEditSetMasked ( passedit, true )
        loginbutton = guiCreateStaticImage(49, 208, 126, 35, "button.png", false, loginwindow)

        loginlbl = guiCreateLabel(0, 0, 126, 35, "Giriş yap", false, loginbutton)
        guiSetFont(loginlbl, font_1)
        guiLabelSetHorizontalAlign(loginlbl, "center", false)
        guiLabelSetVerticalAlign(loginlbl, "center")

        registerbutton = guiCreateStaticImage(227, 208, 126, 35, "button.png", false, loginwindow)

        registerlbl = guiCreateLabel(0, 0, 126, 35, "Kayıt ol", false, registerbutton)
        guiSetFont(registerlbl, font_1)
        guiLabelSetHorizontalAlign(registerlbl, "center", false)
        guiLabelSetVerticalAlign(registerlbl, "center")

        rememberImage = guiCreateStaticImage(351, 160, 128, 32, "off.png", false, loginwindow)
        rememberlbl = guiCreateLabel(345, 140, 138, 32, "Üyeliğin hatırlansın mı?", false, loginwindow)
        guiSetFont(rememberlbl, font_0)

addEventHandler("onClientGUIClick",loginlbl,onClickBtnLogin)
addEventHandler("onClientGUIClick",registerlbl,onClickBtnRegister)



local username, password = loadLoginFromXML()

if not( username == "" or password == "") then
guiSetText ( useredit, tostring(username))
guiSetText ( passedit, tostring(password))
guiStaticImageLoadImage(rememberImage, "on.png")
isButtonOn4 = true
else
guiSetText ( useredit, tostring(username))
guiSetText ( passedit, tostring(password))
guiStaticImageLoadImage(rememberImage, "off.png")
isButtonOn4 = false
end
end
)

function click4()
    if (source == rememberImage and isButtonOn4 == false) then
        guiStaticImageLoadImage(rememberImage, "on.png")
isButtonOn4 = true
    elseif (source == rememberImage and isButtonOn4 == true) then
        guiStaticImageLoadImage(rememberImage, "off.png")
isButtonOn4 = false
    end   
end
addEventHandler("onClientGUIClick",root,click4)


function loadLoginFromXML()
local xml_save_log_File = xmlLoadFile ("userdata.xml")
    if not xml_save_log_File then
        xml_save_log_File = xmlCreateFile("userdata.xml", "login")
    end
    local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
    local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
    if usernameNode and passwordNode then
        return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode)
    else
return "", ""
    end
    xmlUnloadFile ( xml_save_log_File )
end
 
 
function saveLoginToXML(username, password)
    local xml_save_log_File = xmlLoadFile ("userdata.xml")
    if not xml_save_log_File then
        xml_save_log_File = xmlCreateFile("userdata.xml", "login")
    end
if (username ~= "") then
local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
if not usernameNode then
usernameNode = xmlCreateChild(xml_save_log_File, "username")
end
xmlNodeSetValue (usernameNode, tostring(username))
end
if (password ~= "") then
local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
if not passwordNode then
passwordNode = xmlCreateChild(xml_save_log_File, "password")
end
xmlNodeSetValue (passwordNode, tostring(password))
end
    xmlSaveFile(xml_save_log_File)
    xmlUnloadFile (xml_save_log_File)
end
addEvent("saveLoginToXML", true)
addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML)

function resetSaveXML()
local xml_save_log_File = xmlLoadFile ("userdata.xml")
if not xml_save_log_File then
xml_save_log_File = xmlCreateFile("userdata.xml", "login")
end
if (username ~= "") then
local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
if not usernameNode then
usernameNode = xmlCreateChild(xml_save_log_File, "username")
end
end
if (password ~= "") then
local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
if not passwordNode then
passwordNode = xmlCreateChild(xml_save_log_File, "password")
end
xmlNodeSetValue (passwordNode, "")
end
xmlSaveFile(xml_save_log_File)
xmlUnloadFile (xml_save_log_File)
end
addEvent("resetSaveXML", true)
addEventHandler("resetSaveXML", getRootElement(), resetSaveXML)

function onClickBtnLogin(button,state)
if(button == "left" and state == "up") then
if (source == loginlbl) then
username = guiGetText(useredit)
password = guiGetText(passedit)
if isButtonOn4 == true then
isButtonOn4 = true
else
isButtonOn4 = false
end
triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,isButtonOn4)
end
end
end

function onClickBtnRegister(button,state)
showCursor(true)
username = guiGetText(useredit)
password = guiGetText(passedit)
triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password)
end

function hideLoginWindow()
showCursor(false)
showChat(true)
guiSetVisible(loginwindow,false)
removeEventHandler("onClientGUIClick",loginlbl,onClickBtnLogin)
end
addEvent("hideLoginWindow", true)
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)

function hover()
        if source == loginlbl then
                guiStaticImageLoadImage(loginbutton, "buttonhover.png")
elseif source == registerlbl then
guiStaticImageLoadImage(registerbutton, "buttonhover.png")
end
end
addEventHandler("onClientMouseEnter", getRootElement(), hover)


function leave()
        if source == loginlbl then
                guiStaticImageLoadImage(loginbutton, "button.png")
elseif source == registerlbl then
guiStaticImageLoadImage(registerbutton, "button.png")
end
end
addEventHandler("onClientMouseLeave", getRootElement(), leave)


function click()
        if source == loginlbl then
                guiStaticImageLoadImage(loginbutton, "buttonclicked.png")
setTimer(function()
                        guiStaticImageLoadImage(loginbutton, "button.png")
                end, 50, 1)
elseif source == registerlbl then
guiStaticImageLoadImage(registerbutton, "buttonclicked.png")
setTimer(function()
                        guiStaticImageLoadImage(registerbutton, "button.png")
                end, 50, 1)
end
end
addEventHandler("onClientGUIClick", getRootElement(), click)

function removeColorCoding (name)
    return type(name)=="string" and string.gsub(name, "#%x%x%x%x%x%x", "") or name
end

local sX, sY = guiGetScreenSize()

local lobbyUI = {
  bg = {},
  arenas = {
    width = 300,
    count = 0,
    margin = 25,
    rows = 2,
    infoLabel = 0.14,
    defaultOpacity = 200
  },
  state = true
}

setSkyGradient(60, 100, 196, 136, 170, 212)
showPlayerHudComponent("all", false)
showPlayerHudComponent("crosshair", true)
setCloudsEnabled(false)
setBlurLevel(0)
setTime(12, 0)
setMinuteDuration(3600000)
setPedCanBeKnockedOffBike(localPlayer, false)


lobbyUI.bg.horizontalOffset = 0
lobbyUI.bg.verticalOffset = 0


lobbyUI.bg.alpha = 0
lobbyUI.bg.multiplier = 1

function drawLobbyBackground()
  if lobbyUI.bg.alpha < 175 then
    lobbyUI.bg.multiplier = 1.1
    lobbyUI.bg.alpha = math.min(lobbyUI.bg.alpha + 2 * lobbyUI.bg.multiplier, 175)
    if lobbyUI.bg.alpha == 175 then
    end
  end
  dxDrawRectangle(0, 0, sX, sY,tocolor(0, 0, 0, lobbyUI.bg.alpha),false)
end
addEventHandler("onClientRender",root, drawLobbyBackground)

addEvent("dxDrawClose", true)
addEventHandler("dxDrawClose", getRootElement(),
function()
    removeEventHandler("onClientRender",root, drawLobbyBackground)
end)

Resim:
Spoiler for Hiden:
Linki görebilmek için Kayıt olun yada Giriş yapın.
« Son Düzenleme: 25 Mayıs 2017, 20:39:32 Gönderen: Narkoz »
 


MTASATURK

[YARDIM] Login Panel Hud Radar Sorunu
« : 25 Mayıs 2017, 20:30:33 »

Çevrimdışı ertrldtcu

  • Uzman Üye
  • *
    • İleti: 589
Yanıtla #1 : 25 Mayıs 2017, 20:34:11
Server-side, radar için..
Kod: lua
addEventHandler("onPlayerLogin",root,function()
    setPlayerHudComponentVisible(source,"radar",true)
end)
« Son Düzenleme: 25 Mayıs 2017, 20:36:42 Gönderen: ertrldtcu »
system
 


Çevrimdışı Prose

  • Deneyimli Üye
  • *
    • İleti: 454
  • Gökhan Türkoglu
Yanıtla #2 : 25 Mayıs 2017, 20:36:19
Linki görebilmek için Kayıt olun yada Giriş yapın.
Kod: lua
addEventHandler("onPlayerLogin",root,function()
    setPlayerHudComponentVisible(source,"radar",true)
end)

Client.luamı Eklenecek

Calısmıyor
« Son Düzenleme: 25 Mayıs 2017, 20:39:10 Gönderen: Prose »
 


Çevrimdışı ertrldtcu

  • Uzman Üye
  • *
    • İleti: 589
Yanıtla #3 : 25 Mayıs 2017, 20:42:52
Linki görebilmek için Kayıt olun yada Giriş yapın.
Calısmıyor
Kodda bir sıkıntı göremedim. Server-side kodları buraya at yardım çıkar.
« Son Düzenleme: 25 Mayıs 2017, 20:45:40 Gönderen: ertrldtcu »
system
 


Çevrimdışı Prose

  • Deneyimli Üye
  • *
    • İleti: 454
  • Gökhan Türkoglu
Yanıtla #4 : 25 Mayıs 2017, 20:43:51
Kod: lua
-- Do not remove the green text!
-- ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

-- Script by: John_Scott
-- Skype: gernas12
 
-- ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
-- Do not remove the green text!


function PlayerLogin(username,password,isButtonOn4)
if not (username == "") then
if not (password == "") then
local account = getAccount ( username, password )
if ( account ~= false ) then
logIn(source, account, password)
triggerClientEvent (source,"hideLoginWindow",getRootElement())
triggerClientEvent (source,"dxDrawClose",source)
triggerClientEvent(source,"addNotification",getRootElement(),"Başarıyla giriş yaptın!", 1)
if isButtonOn4 == true then
triggerClientEvent(source,"saveLoginToXML",getRootElement(),username,password)
else
triggerClientEvent(source,"resetSaveXML",getRootElement(),username,password)
end

else
triggerClientEvent(source,"addNotification",getRootElement(),"Hata! Kullanıcı adı veya şifre yanlış!", 3)
end
else
triggerClientEvent(source,"addNotification",getRootElement(),"Lütfen şifrenizi giriniz!", 3)
end
else
triggerClientEvent(source,"addNotification",getRootElement(),"Lütfen Kullanıcı adınızı giriniz!", 3)
end
end
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)



function registerPlayer(username,password)
    if not (username == "") then
        if not (password == "") then
                    local account = getAccount (username,password)
                    if (account == false) then
                        local accountAdded = addAccount(tostring(username),tostring(password))
                        if (accountAdded) then
                            outputChatBox("#ffffffKayıtınız başarılı oldu! bilgileriniz [Kullanıcı adı: #ABCDEF" .. username .. " #FF0000| #FFFFFFŞifre: #ABCDEF" .. password .. "#FFFFFF]",source,255,255,255,true )
    triggerClientEvent(source,"addNotification",getRootElement(),"Başarıyla kayıt oldun!", 1)
                        else
    triggerClientEvent(source,"addNotification",getRootElement(),"Hata! Lütfen başka bir kullanıcı adı veya şifre giriniz!", 3)
                        end
                    else
triggerClientEvent(source,"addNotification",getRootElement(),"Hata! Bu kullanıcı adı zaten mevcut!", 3)
                    end
        else
    triggerClientEvent(source,"addNotification",getRootElement(),"Hata! Lütfen şifrenizi giriniz!", 2)
        end
    else
triggerClientEvent(source,"addNotification",getRootElement(),"Hata! Lütfen kullanıcı adınızı giriniz!", 2)
    end
end
addEvent("onRequestRegister", true)
addEventHandler("onRequestRegister", getRootElement(), registerPlayer)
 


Çevrimdışı Paradox

  • Kurucu
  • *
    • İleti: 684
  • SH Gaming
Yanıtla #5 : 25 Mayıs 2017, 20:51:35
Client
Kod: lua
local screenW, screenH = guiGetScreenSize()
 
local X, Y = guiGetScreenSize()
local hX, hY = (X/2)-(1920/2), (Y/2)-(1080/2)
 
local font_0 = guiCreateFont("font.ttf")
local font_1 = guiCreateFont("font.ttf",11)
 
local isButtonOn4 = false;
 
guiSetInputMode("no_binds_when_editing")
 
addEventHandler("onClientResourceStart", resourceRoot,
function()
        showCursor(true)
        loginwindow = guiCreateStaticImage((screenW - 489) / 2, (screenH - 253) / 2, 489, 253, "window2.png", false)
        guiSetAlpha(loginwindow, 0.99)
        guiSetVisible(loginwindow, true)
 
        logintitle = guiCreateLabel(155, 0, 293, 15, "Hilal Askeri Roleplay", false, loginwindow)
        guiSetFont(logintitle, font_0)
        logininfo = guiCreateLabel(8, 25, 453, 98, "Merhaba "..removeColorCoding(getPlayerName(getLocalPlayer())).."\nÜye olmadıysanız bilgilerinizi girip kayıt ol tuşuna basınız\neğer üyeliğiniz var ise login butonuna basarak giriş yapabilirsiniz.", false, loginwindow)
        guiSetFont(logininfo, font_1)
        loginuserlbl = guiCreateLabel(10, 118, 160, 37, "Kullanıcı adı : ", false, loginwindow)
        guiSetFont(loginuserlbl, font_1)
        loginuserpass = guiCreateLabel(10, 165, 160, 37, "Şifre : ", false, loginwindow)
        guiSetFont(loginuserpass, font_1)
        useredit = guiCreateEdit(143, 108, 174, 32, "", false, loginwindow)
        passedit = guiCreateEdit(143, 160, 174, 32, "", false, loginwindow)
        guiEditSetMaxLength ( useredit,25)
        guiEditSetMaxLength ( passedit,25)
        guiEditSetMasked ( passedit, true )
        loginbutton = guiCreateStaticImage(49, 208, 126, 35, "button.png", false, loginwindow)
 
        loginlbl = guiCreateLabel(0, 0, 126, 35, "Giriş yap", false, loginbutton)
        guiSetFont(loginlbl, font_1)
        guiLabelSetHorizontalAlign(loginlbl, "center", false)
        guiLabelSetVerticalAlign(loginlbl, "center")
 
        registerbutton = guiCreateStaticImage(227, 208, 126, 35, "button.png", false, loginwindow)
 
        registerlbl = guiCreateLabel(0, 0, 126, 35, "Kayıt ol", false, registerbutton)
        guiSetFont(registerlbl, font_1)
        guiLabelSetHorizontalAlign(registerlbl, "center", false)
        guiLabelSetVerticalAlign(registerlbl, "center")
 
        rememberImage = guiCreateStaticImage(351, 160, 128, 32, "off.png", false, loginwindow)
        rememberlbl = guiCreateLabel(345, 140, 138, 32, "Üyeliğin hatırlansın mı?", false, loginwindow)
        guiSetFont(rememberlbl, font_0)
 
        addEventHandler("onClientGUIClick",loginlbl,onClickBtnLogin)
        addEventHandler("onClientGUIClick",registerlbl,onClickBtnRegister)
 
       
 
        local username, password = loadLoginFromXML()
       
        if not( username == "" or password == "") then
                guiSetText ( useredit, tostring(username))
                guiSetText ( passedit, tostring(password))
                guiStaticImageLoadImage(rememberImage, "on.png")
                isButtonOn4 = true
        else
                guiSetText ( useredit, tostring(username))
                guiSetText ( passedit, tostring(password))
                guiStaticImageLoadImage(rememberImage, "off.png")
                isButtonOn4 = false
        end
end
)
 
function click4()
    if (source == rememberImage and isButtonOn4 == false) then
        guiStaticImageLoadImage(rememberImage, "on.png")
        isButtonOn4 = true
    elseif (source == rememberImage and isButtonOn4 == true) then
        guiStaticImageLoadImage(rememberImage, "off.png")
        isButtonOn4 = false
    end   
end
addEventHandler("onClientGUIClick",root,click4)
 
 
function loadLoginFromXML()
        local xml_save_log_File = xmlLoadFile ("userdata.xml")
    if not xml_save_log_File then
        xml_save_log_File = xmlCreateFile("userdata.xml", "login")
    end
    local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
    local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
    if usernameNode and passwordNode then
        return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode)
    else
                return "", ""
    end
    xmlUnloadFile ( xml_save_log_File )
end
 
 
function saveLoginToXML(username, password)
    local xml_save_log_File = xmlLoadFile ("userdata.xml")
    if not xml_save_log_File then
        xml_save_log_File = xmlCreateFile("userdata.xml", "login")
    end
        if (username ~= "") then
                local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
                if not usernameNode then
                        usernameNode = xmlCreateChild(xml_save_log_File, "username")
                end
                xmlNodeSetValue (usernameNode, tostring(username))
        end
        if (password ~= "") then
                local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
                if not passwordNode then
                        passwordNode = xmlCreateChild(xml_save_log_File, "password")
                end             
                xmlNodeSetValue (passwordNode, tostring(password))
        end
    xmlSaveFile(xml_save_log_File)
    xmlUnloadFile (xml_save_log_File)
end
addEvent("saveLoginToXML", true)
addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML)
 
function resetSaveXML()
                local xml_save_log_File = xmlLoadFile ("userdata.xml")
                if not xml_save_log_File then
                        xml_save_log_File = xmlCreateFile("userdata.xml", "login")
                end
                if (username ~= "") then
                        local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
                        if not usernameNode then
                                usernameNode = xmlCreateChild(xml_save_log_File, "username")
                        end
                end
                if (password ~= "") then
                        local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
                        if not passwordNode then
                                passwordNode = xmlCreateChild(xml_save_log_File, "password")
                        end             
                        xmlNodeSetValue (passwordNode, "")
                end
                xmlSaveFile(xml_save_log_File)
                xmlUnloadFile (xml_save_log_File)
end
addEvent("resetSaveXML", true)
addEventHandler("resetSaveXML", getRootElement(), resetSaveXML)
 
function onClickBtnLogin(button,state)
        if(button == "left" and state == "up") then
                if (source == loginlbl) then
                        username = guiGetText(useredit)
                        password = guiGetText(passedit)
                        if isButtonOn4 == true then
                                isButtonOn4 = true
                        else
                                isButtonOn4 = false
                        end
                        triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,isButtonOn4)
                end
        end
end
 
function onClickBtnRegister(button,state)
        showCursor(true)
        username = guiGetText(useredit)
        password = guiGetText(passedit)
        triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password)             
end
 
function hideLoginWindow()
        showCursor(false)
        showChat(true)
        guiSetVisible(loginwindow,false)
        removeEventHandler("onClientGUIClick",loginlbl,onClickBtnLogin)
showPlayerHudComponent("all", true)
end
addEvent("hideLoginWindow", true)
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)
 
function hover()
        if source == loginlbl then
                guiStaticImageLoadImage(loginbutton, "buttonhover.png")
        elseif source == registerlbl then
                guiStaticImageLoadImage(registerbutton, "buttonhover.png")
        end
end
addEventHandler("onClientMouseEnter", getRootElement(), hover)
 
 
function leave()
        if source == loginlbl then
                guiStaticImageLoadImage(loginbutton, "button.png")
        elseif source == registerlbl then
                guiStaticImageLoadImage(registerbutton, "button.png")
        end
end
addEventHandler("onClientMouseLeave", getRootElement(), leave)
 
 
function click()
        if source == loginlbl then
                guiStaticImageLoadImage(loginbutton, "buttonclicked.png")
                setTimer(function()
                        guiStaticImageLoadImage(loginbutton, "button.png")
                end, 50, 1)
        elseif source == registerlbl then
                guiStaticImageLoadImage(registerbutton, "buttonclicked.png")
                setTimer(function()
                        guiStaticImageLoadImage(registerbutton, "button.png")
                end, 50, 1)
        end
end
addEventHandler("onClientGUIClick", getRootElement(), click)
 
function removeColorCoding (name)
    return type(name)=="string" and string.gsub(name, "#%x%x%x%x%x%x", "") or name
end
 
local sX, sY = guiGetScreenSize()
 
local lobbyUI = {
  bg = {},
  arenas = {
    width = 300,
    count = 0,
    margin = 25,
    rows = 2,
    infoLabel = 0.14,
    defaultOpacity = 200
  },
  state = true
}
 
setSkyGradient(60, 100, 196, 136, 170, 212)
showPlayerHudComponent("all", false)
setCloudsEnabled(false)
setBlurLevel(0)
setTime(12, 0)
setMinuteDuration(3600000)
setPedCanBeKnockedOffBike(localPlayer, false)
 
 
lobbyUI.bg.horizontalOffset = 0
lobbyUI.bg.verticalOffset = 0
 
 
lobbyUI.bg.alpha = 0
lobbyUI.bg.multiplier = 1
 
function drawLobbyBackground()
  if lobbyUI.bg.alpha < 175 then
    lobbyUI.bg.multiplier = 1.1
    lobbyUI.bg.alpha = math.min(lobbyUI.bg.alpha + 2 * lobbyUI.bg.multiplier, 175)
    if lobbyUI.bg.alpha == 175 then
    end
  end
  dxDrawRectangle(0, 0, sX, sY,tocolor(0, 0, 0, lobbyUI.bg.alpha),false)
end
addEventHandler("onClientRender",root, drawLobbyBackground)
 
addEvent("dxDrawClose", true)
addEventHandler("dxDrawClose", getRootElement(),
function()
    removeEventHandler("onClientRender",root, drawLobbyBackground)
end)
 


MTASATURK

Ynt: [YARDIM] Login Panel Hud Radar Sorunu
« Yanıtla #5 : 25 Mayıs 2017, 20:51:35 »

Çevrimdışı Prose

  • Deneyimli Üye
  • *
    • İleti: 454
  • Gökhan Türkoglu
Yanıtla #6 : 25 Mayıs 2017, 20:54:05
Linki görebilmek için Kayıt olun yada Giriş yapın.
Client
Kod: lua
local screenW, screenH = guiGetScreenSize()
 
local X, Y = guiGetScreenSize()
local hX, hY = (X/2)-(1920/2), (Y/2)-(1080/2)
 
local font_0 = guiCreateFont("font.ttf")
local font_1 = guiCreateFont("font.ttf",11)
 
local isButtonOn4 = false;
 
guiSetInputMode("no_binds_when_editing")
 
addEventHandler("onClientResourceStart", resourceRoot,
function()
        showCursor(true)
        loginwindow = guiCreateStaticImage((screenW - 489) / 2, (screenH - 253) / 2, 489, 253, "window2.png", false)
        guiSetAlpha(loginwindow, 0.99)
        guiSetVisible(loginwindow, true)
 
        logintitle = guiCreateLabel(155, 0, 293, 15, "Hilal Askeri Roleplay", false, loginwindow)
        guiSetFont(logintitle, font_0)
        logininfo = guiCreateLabel(8, 25, 453, 98, "Merhaba "..removeColorCoding(getPlayerName(getLocalPlayer())).."\nÜye olmadıysanız bilgilerinizi girip kayıt ol tuşuna basınız\neğer üyeliğiniz var ise login butonuna basarak giriş yapabilirsiniz.", false, loginwindow)
        guiSetFont(logininfo, font_1)
        loginuserlbl = guiCreateLabel(10, 118, 160, 37, "Kullanıcı adı : ", false, loginwindow)
        guiSetFont(loginuserlbl, font_1)
        loginuserpass = guiCreateLabel(10, 165, 160, 37, "Şifre : ", false, loginwindow)
        guiSetFont(loginuserpass, font_1)
        useredit = guiCreateEdit(143, 108, 174, 32, "", false, loginwindow)
        passedit = guiCreateEdit(143, 160, 174, 32, "", false, loginwindow)
        guiEditSetMaxLength ( useredit,25)
        guiEditSetMaxLength ( passedit,25)
        guiEditSetMasked ( passedit, true )
        loginbutton = guiCreateStaticImage(49, 208, 126, 35, "button.png", false, loginwindow)
 
        loginlbl = guiCreateLabel(0, 0, 126, 35, "Giriş yap", false, loginbutton)
        guiSetFont(loginlbl, font_1)
        guiLabelSetHorizontalAlign(loginlbl, "center", false)
        guiLabelSetVerticalAlign(loginlbl, "center")
 
        registerbutton = guiCreateStaticImage(227, 208, 126, 35, "button.png", false, loginwindow)
 
        registerlbl = guiCreateLabel(0, 0, 126, 35, "Kayıt ol", false, registerbutton)
        guiSetFont(registerlbl, font_1)
        guiLabelSetHorizontalAlign(registerlbl, "center", false)
        guiLabelSetVerticalAlign(registerlbl, "center")
 
        rememberImage = guiCreateStaticImage(351, 160, 128, 32, "off.png", false, loginwindow)
        rememberlbl = guiCreateLabel(345, 140, 138, 32, "Üyeliğin hatırlansın mı?", false, loginwindow)
        guiSetFont(rememberlbl, font_0)
 
        addEventHandler("onClientGUIClick",loginlbl,onClickBtnLogin)
        addEventHandler("onClientGUIClick",registerlbl,onClickBtnRegister)
 
       
 
        local username, password = loadLoginFromXML()
       
        if not( username == "" or password == "") then
                guiSetText ( useredit, tostring(username))
                guiSetText ( passedit, tostring(password))
                guiStaticImageLoadImage(rememberImage, "on.png")
                isButtonOn4 = true
        else
                guiSetText ( useredit, tostring(username))
                guiSetText ( passedit, tostring(password))
                guiStaticImageLoadImage(rememberImage, "off.png")
                isButtonOn4 = false
        end
end
)
 
function click4()
    if (source == rememberImage and isButtonOn4 == false) then
        guiStaticImageLoadImage(rememberImage, "on.png")
        isButtonOn4 = true
    elseif (source == rememberImage and isButtonOn4 == true) then
        guiStaticImageLoadImage(rememberImage, "off.png")
        isButtonOn4 = false
    end   
end
addEventHandler("onClientGUIClick",root,click4)
 
 
function loadLoginFromXML()
        local xml_save_log_File = xmlLoadFile ("userdata.xml")
    if not xml_save_log_File then
        xml_save_log_File = xmlCreateFile("userdata.xml", "login")
    end
    local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
    local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
    if usernameNode and passwordNode then
        return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode)
    else
                return "", ""
    end
    xmlUnloadFile ( xml_save_log_File )
end
 
 
function saveLoginToXML(username, password)
    local xml_save_log_File = xmlLoadFile ("userdata.xml")
    if not xml_save_log_File then
        xml_save_log_File = xmlCreateFile("userdata.xml", "login")
    end
        if (username ~= "") then
                local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
                if not usernameNode then
                        usernameNode = xmlCreateChild(xml_save_log_File, "username")
                end
                xmlNodeSetValue (usernameNode, tostring(username))
        end
        if (password ~= "") then
                local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
                if not passwordNode then
                        passwordNode = xmlCreateChild(xml_save_log_File, "password")
                end             
                xmlNodeSetValue (passwordNode, tostring(password))
        end
    xmlSaveFile(xml_save_log_File)
    xmlUnloadFile (xml_save_log_File)
end
addEvent("saveLoginToXML", true)
addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML)
 
function resetSaveXML()
                local xml_save_log_File = xmlLoadFile ("userdata.xml")
                if not xml_save_log_File then
                        xml_save_log_File = xmlCreateFile("userdata.xml", "login")
                end
                if (username ~= "") then
                        local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
                        if not usernameNode then
                                usernameNode = xmlCreateChild(xml_save_log_File, "username")
                        end
                end
                if (password ~= "") then
                        local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
                        if not passwordNode then
                                passwordNode = xmlCreateChild(xml_save_log_File, "password")
                        end             
                        xmlNodeSetValue (passwordNode, "")
                end
                xmlSaveFile(xml_save_log_File)
                xmlUnloadFile (xml_save_log_File)
end
addEvent("resetSaveXML", true)
addEventHandler("resetSaveXML", getRootElement(), resetSaveXML)
 
function onClickBtnLogin(button,state)
        if(button == "left" and state == "up") then
                if (source == loginlbl) then
                        username = guiGetText(useredit)
                        password = guiGetText(passedit)
                        if isButtonOn4 == true then
                                isButtonOn4 = true
                        else
                                isButtonOn4 = false
                        end
                        triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,isButtonOn4)
                end
        end
end
 
function onClickBtnRegister(button,state)
        showCursor(true)
        username = guiGetText(useredit)
        password = guiGetText(passedit)
        triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password)             
end
 
function hideLoginWindow()
        showCursor(false)
        showChat(true)
        guiSetVisible(loginwindow,false)
        removeEventHandler("onClientGUIClick",loginlbl,onClickBtnLogin)
showPlayerHudComponent("all", true)
end
addEvent("hideLoginWindow", true)
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)
 
function hover()
        if source == loginlbl then
                guiStaticImageLoadImage(loginbutton, "buttonhover.png")
        elseif source == registerlbl then
                guiStaticImageLoadImage(registerbutton, "buttonhover.png")
        end
end
addEventHandler("onClientMouseEnter", getRootElement(), hover)
 
 
function leave()
        if source == loginlbl then
                guiStaticImageLoadImage(loginbutton, "button.png")
        elseif source == registerlbl then
                guiStaticImageLoadImage(registerbutton, "button.png")
        end
end
addEventHandler("onClientMouseLeave", getRootElement(), leave)
 
 
function click()
        if source == loginlbl then
                guiStaticImageLoadImage(loginbutton, "buttonclicked.png")
                setTimer(function()
                        guiStaticImageLoadImage(loginbutton, "button.png")
                end, 50, 1)
        elseif source == registerlbl then
                guiStaticImageLoadImage(registerbutton, "buttonclicked.png")
                setTimer(function()
                        guiStaticImageLoadImage(registerbutton, "button.png")
                end, 50, 1)
        end
end
addEventHandler("onClientGUIClick", getRootElement(), click)
 
function removeColorCoding (name)
    return type(name)=="string" and string.gsub(name, "#%x%x%x%x%x%x", "") or name
end
 
local sX, sY = guiGetScreenSize()
 
local lobbyUI = {
  bg = {},
  arenas = {
    width = 300,
    count = 0,
    margin = 25,
    rows = 2,
    infoLabel = 0.14,
    defaultOpacity = 200
  },
  state = true
}
 
setSkyGradient(60, 100, 196, 136, 170, 212)
showPlayerHudComponent("all", false)
setCloudsEnabled(false)
setBlurLevel(0)
setTime(12, 0)
setMinuteDuration(3600000)
setPedCanBeKnockedOffBike(localPlayer, false)
 
 
lobbyUI.bg.horizontalOffset = 0
lobbyUI.bg.verticalOffset = 0
 
 
lobbyUI.bg.alpha = 0
lobbyUI.bg.multiplier = 1
 
function drawLobbyBackground()
  if lobbyUI.bg.alpha < 175 then
    lobbyUI.bg.multiplier = 1.1
    lobbyUI.bg.alpha = math.min(lobbyUI.bg.alpha + 2 * lobbyUI.bg.multiplier, 175)
    if lobbyUI.bg.alpha == 175 then
    end
  end
  dxDrawRectangle(0, 0, sX, sY,tocolor(0, 0, 0, lobbyUI.bg.alpha),false)
end
addEventHandler("onClientRender",root, drawLobbyBackground)
 
addEvent("dxDrawClose", true)
addEventHandler("dxDrawClose", getRootElement(),
function()
    removeEventHandler("onClientRender",root, drawLobbyBackground)
end)

Eyw Kilit
 


Çevrimdışı Paradox

  • Kurucu
  • *
    • İleti: 684
  • SH Gaming
Yanıtla #7 : 25 Mayıs 2017, 20:55:02
Linki görebilmek için Kayıt olun yada Giriş yapın.
Eyw Kilit
Rica ederim, konu sahibinin isteği üzerine konu kilit.
« Son Düzenleme: 25 Mayıs 2017, 21:06:55 Gönderen: Narkoz »