17 Temmuz 2018, 06:42:20

Gönderen Konu: [YARDIM] Login Panel Hud Radar Sorunu  (Okunma sayısı 366 defa)

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Prose

  • Deneyimli Üye
  • *
  • İleti: 473
  • Gökhan Türkoglu
[YARDIM] Login Panel Hud Radar Sorunu
« : 25 Mayıs 2017, 21:36:44 »
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
  1. local screenW, screenH = guiGetScreenSize()
  2.  
  3. local X, Y = guiGetScreenSize()
  4. local hX, hY = (X/2)-(1920/2), (Y/2)-(1080/2)
  5.  
  6. local font_0 = guiCreateFont("font.ttf")
  7. local font_1 = guiCreateFont("font.ttf",11)
  8.  
  9. local isButtonOn4 = false;
  10.  
  11. guiSetInputMode("no_binds_when_editing")
  12.  
  13. addEventHandler("onClientResourceStart", resourceRoot,
  14. function()
  15.         showCursor(true)
  16.         loginwindow = guiCreateStaticImage((screenW - 489) / 2, (screenH - 253) / 2, 489, 253, "window2.png", false)
  17.         guiSetAlpha(loginwindow, 0.99)
  18.         guiSetVisible(loginwindow, true)
  19.  
  20.         logintitle = guiCreateLabel(155, 0, 293, 15, "Hilal Askeri Roleplay", false, loginwindow)
  21.         guiSetFont(logintitle, font_0)
  22.         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)
  23.         guiSetFont(logininfo, font_1)
  24.         loginuserlbl = guiCreateLabel(10, 118, 160, 37, "Kullanıcı adı : ", false, loginwindow)
  25.         guiSetFont(loginuserlbl, font_1)
  26.         loginuserpass = guiCreateLabel(10, 165, 160, 37, "Şifre : ", false, loginwindow)
  27.         guiSetFont(loginuserpass, font_1)
  28.         useredit = guiCreateEdit(143, 108, 174, 32, "", false, loginwindow)
  29.         passedit = guiCreateEdit(143, 160, 174, 32, "", false, loginwindow)
  30.         guiEditSetMaxLength ( useredit,25)
  31.         guiEditSetMaxLength ( passedit,25)
  32.         guiEditSetMasked ( passedit, true )
  33.         loginbutton = guiCreateStaticImage(49, 208, 126, 35, "button.png", false, loginwindow)
  34.  
  35.         loginlbl = guiCreateLabel(0, 0, 126, 35, "Giriş yap", false, loginbutton)
  36.         guiSetFont(loginlbl, font_1)
  37.         guiLabelSetHorizontalAlign(loginlbl, "center", false)
  38.         guiLabelSetVerticalAlign(loginlbl, "center")
  39.  
  40.         registerbutton = guiCreateStaticImage(227, 208, 126, 35, "button.png", false, loginwindow)
  41.  
  42.         registerlbl = guiCreateLabel(0, 0, 126, 35, "Kayıt ol", false, registerbutton)
  43.         guiSetFont(registerlbl, font_1)
  44.         guiLabelSetHorizontalAlign(registerlbl, "center", false)
  45.         guiLabelSetVerticalAlign(registerlbl, "center")
  46.  
  47.         rememberImage = guiCreateStaticImage(351, 160, 128, 32, "off.png", false, loginwindow)
  48.         rememberlbl = guiCreateLabel(345, 140, 138, 32, "Üyeliğin hatırlansın mı?", false, loginwindow)
  49.         guiSetFont(rememberlbl, font_0)
  50.  
  51.         addEventHandler("onClientGUIClick",loginlbl,onClickBtnLogin)
  52.         addEventHandler("onClientGUIClick",registerlbl,onClickBtnRegister)
  53.  
  54.        
  55.  
  56.         local username, password = loadLoginFromXML()
  57.        
  58.         if not( username == "" or password == "") then
  59.                 guiSetText ( useredit, tostring(username))
  60.                 guiSetText ( passedit, tostring(password))
  61.                 guiStaticImageLoadImage(rememberImage, "on.png")
  62.                 isButtonOn4 = true
  63.         else
  64.                 guiSetText ( useredit, tostring(username))
  65.                 guiSetText ( passedit, tostring(password))
  66.                 guiStaticImageLoadImage(rememberImage, "off.png")
  67.                 isButtonOn4 = false
  68.         end
  69. end
  70. )
  71.  
  72. function click4()
  73.     if (source == rememberImage and isButtonOn4 == false) then
  74.         guiStaticImageLoadImage(rememberImage, "on.png")
  75.         isButtonOn4 = true
  76.     elseif (source == rememberImage and isButtonOn4 == true) then
  77.         guiStaticImageLoadImage(rememberImage, "off.png")
  78.         isButtonOn4 = false
  79.     end    
  80. end
  81. addEventHandler("onClientGUIClick",root,click4)
  82.  
  83.  
  84. function loadLoginFromXML()
  85.         local xml_save_log_File = xmlLoadFile ("userdata.xml")
  86.     if not xml_save_log_File then
  87.         xml_save_log_File = xmlCreateFile("userdata.xml", "login")
  88.     end
  89.     local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
  90.     local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
  91.     if usernameNode and passwordNode then
  92.         return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode)
  93.     else
  94.                 return "", ""
  95.     end
  96.     xmlUnloadFile ( xml_save_log_File )
  97. end
  98.  
  99.  
  100. function saveLoginToXML(username, password)
  101.     local xml_save_log_File = xmlLoadFile ("userdata.xml")
  102.     if not xml_save_log_File then
  103.         xml_save_log_File = xmlCreateFile("userdata.xml", "login")
  104.     end
  105.         if (username ~= "") then
  106.                 local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
  107.                 if not usernameNode then
  108.                         usernameNode = xmlCreateChild(xml_save_log_File, "username")
  109.                 end
  110.                 xmlNodeSetValue (usernameNode, tostring(username))
  111.         end
  112.         if (password ~= "") then
  113.                 local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
  114.                 if not passwordNode then
  115.                         passwordNode = xmlCreateChild(xml_save_log_File, "password")
  116.                 end            
  117.                 xmlNodeSetValue (passwordNode, tostring(password))
  118.         end
  119.     xmlSaveFile(xml_save_log_File)
  120.     xmlUnloadFile (xml_save_log_File)
  121. end
  122. addEvent("saveLoginToXML", true)
  123. addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML)
  124.  
  125. function resetSaveXML()
  126.                 local xml_save_log_File = xmlLoadFile ("userdata.xml")
  127.                 if not xml_save_log_File then
  128.                         xml_save_log_File = xmlCreateFile("userdata.xml", "login")
  129.                 end
  130.                 if (username ~= "") then
  131.                         local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
  132.                         if not usernameNode then
  133.                                 usernameNode = xmlCreateChild(xml_save_log_File, "username")
  134.                         end
  135.                 end
  136.                 if (password ~= "") then
  137.                         local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
  138.                         if not passwordNode then
  139.                                 passwordNode = xmlCreateChild(xml_save_log_File, "password")
  140.                         end            
  141.                         xmlNodeSetValue (passwordNode, "")
  142.                 end
  143.                 xmlSaveFile(xml_save_log_File)
  144.                 xmlUnloadFile (xml_save_log_File)
  145. end
  146. addEvent("resetSaveXML", true)
  147. addEventHandler("resetSaveXML", getRootElement(), resetSaveXML)
  148.  
  149. function onClickBtnLogin(button,state)
  150.         if(button == "left" and state == "up") then
  151.                 if (source == loginlbl) then
  152.                         username = guiGetText(useredit)
  153.                         password = guiGetText(passedit)
  154.                         if isButtonOn4 == true then
  155.                                 isButtonOn4 = true
  156.                         else
  157.                                 isButtonOn4 = false
  158.                         end
  159.                         triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,isButtonOn4)
  160.                 end
  161.         end
  162. end
  163.  
  164. function onClickBtnRegister(button,state)
  165.         showCursor(true)
  166.         username = guiGetText(useredit)
  167.         password = guiGetText(passedit)
  168.         triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password)             
  169. end
  170.  
  171. function hideLoginWindow()
  172.         showCursor(false)
  173.         showChat(true)
  174.         guiSetVisible(loginwindow,false)
  175.         removeEventHandler("onClientGUIClick",loginlbl,onClickBtnLogin)
  176. end
  177. addEvent("hideLoginWindow", true)
  178. addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)
  179.  
  180. function hover()
  181.         if source == loginlbl then
  182.                 guiStaticImageLoadImage(loginbutton, "buttonhover.png")
  183.         elseif source == registerlbl then
  184.                 guiStaticImageLoadImage(registerbutton, "buttonhover.png")
  185.         end
  186. end
  187. addEventHandler("onClientMouseEnter", getRootElement(), hover)
  188.  
  189.  
  190. function leave()
  191.         if source == loginlbl then
  192.                 guiStaticImageLoadImage(loginbutton, "button.png")
  193.         elseif source == registerlbl then
  194.                 guiStaticImageLoadImage(registerbutton, "button.png")
  195.         end
  196. end
  197. addEventHandler("onClientMouseLeave", getRootElement(), leave)
  198.  
  199.  
  200. function click()
  201.         if source == loginlbl then
  202.                 guiStaticImageLoadImage(loginbutton, "buttonclicked.png")
  203.                 setTimer(function()
  204.                         guiStaticImageLoadImage(loginbutton, "button.png")
  205.                 end, 50, 1)
  206.         elseif source == registerlbl then
  207.                 guiStaticImageLoadImage(registerbutton, "buttonclicked.png")
  208.                 setTimer(function()
  209.                         guiStaticImageLoadImage(registerbutton, "button.png")
  210.                 end, 50, 1)
  211.         end
  212. end
  213. addEventHandler("onClientGUIClick", getRootElement(), click)
  214.  
  215. function removeColorCoding (name)
  216.     return type(name)=="string" and string.gsub(name, "#%x%x%x%x%x%x", "") or name
  217. end
  218.  
  219. local sX, sY = guiGetScreenSize()
  220.  
  221. local lobbyUI = {
  222.   bg = {},
  223.   arenas = {
  224.     width = 300,
  225.     count = 0,
  226.     margin = 25,
  227.     rows = 2,
  228.     infoLabel = 0.14,
  229.     defaultOpacity = 200
  230.   },
  231.   state = true
  232. }
  233.  
  234. setSkyGradient(60, 100, 196, 136, 170, 212)
  235. showPlayerHudComponent("all", false)
  236. showPlayerHudComponent("crosshair", true)
  237. setCloudsEnabled(false)
  238. setBlurLevel(0)
  239. setTime(12, 0)
  240. setMinuteDuration(3600000)
  241. setPedCanBeKnockedOffBike(localPlayer, false)
  242.  
  243.  
  244. lobbyUI.bg.horizontalOffset = 0
  245. lobbyUI.bg.verticalOffset = 0
  246.  
  247.  
  248. lobbyUI.bg.alpha = 0
  249. lobbyUI.bg.multiplier = 1
  250.  
  251. function drawLobbyBackground()
  252.   if lobbyUI.bg.alpha < 175 then
  253.     lobbyUI.bg.multiplier = 1.1
  254.     lobbyUI.bg.alpha = math.min(lobbyUI.bg.alpha + 2 * lobbyUI.bg.multiplier, 175)
  255.     if lobbyUI.bg.alpha == 175 then
  256.     end
  257.   end
  258.   dxDrawRectangle(0, 0, sX, sY,tocolor(0, 0, 0, lobbyUI.bg.alpha),false)
  259. end
  260. addEventHandler("onClientRender",root, drawLobbyBackground)
  261.  
  262. addEvent("dxDrawClose", true)
  263. addEventHandler("dxDrawClose", getRootElement(),
  264. function()
  265.     removeEventHandler("onClientRender",root, drawLobbyBackground)
  266. end)

Resim:
Spoiler for Hiden:
Linkleri Görebilmek İçin Kayıt Olun veya Giriş Yapın
« Son Düzenleme: 25 Mayıs 2017, 21:45:43 Gönderen: Narkoz »
 

MTASA-TURK | Türkiye'nin En Güncel MTA Platformu

[YARDIM] Login Panel Hud Radar Sorunu
« : 25 Mayıs 2017, 21:36:44 »

ertrldtcu

  • VIP
  • *
  • İleti: 430
Ynt: [Yardım]Login Panel Hud Radar
« Yanıtla #1 : 25 Mayıs 2017, 21:40:22 »
Server-side, radar için..
Kod: Lua
  1. addEventHandler("onPlayerLogin",root,function()
  2.     setPlayerHudComponentVisible(source,"radar",true)
  3. end)
« Son Düzenleme: 25 Mayıs 2017, 21:42:53 Gönderen: ertrldtcu »
Script yazmak için sadece kod bilmek yetmez.
 

Prose

  • Deneyimli Üye
  • *
  • İleti: 473
  • Gökhan Türkoglu
Ynt: [Yardım]Login Panel Hud Radar Sorunu
« Yanıtla #2 : 25 Mayıs 2017, 21:42:30 »
Linkleri Görebilmek İçin Kayıt Olun veya Giriş Yapın
Kod: Lua
  1. addEventHandler("onPlayerLogin",root,function()
  2.     setPlayerHudComponentVisible(source,"radar",true)
  3. end)

Client.luamı Eklenecek

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

ertrldtcu

  • VIP
  • *
  • İleti: 430
Ynt: [Yardım]Login Panel Hud Radar Sorunu
« Yanıtla #3 : 25 Mayıs 2017, 21:49:03 »
Linkleri Görebilmek İçin Kayıt Olun veya 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, 21:51:51 Gönderen: ertrldtcu »
Script yazmak için sadece kod bilmek yetmez.
 

Prose

  • Deneyimli Üye
  • *
  • İleti: 473
  • Gökhan Türkoglu
Ynt: [YARDIM] Login Panel Hud Radar Sorunu
« Yanıtla #4 : 25 Mayıs 2017, 21:50:02 »
Kod: Lua
  1. -- Do not remove the green text!
  2. -- ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
  3.  
  4. -- Script by: John_Scott
  5. -- Skype: gernas12
  6.  
  7. -- ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
  8. -- Do not remove the green text!
  9.  
  10.  
  11. function PlayerLogin(username,password,isButtonOn4)
  12.         if not (username == "") then
  13.                 if not (password == "") then
  14.                         local account = getAccount ( username, password )
  15.                         if ( account ~= false ) then
  16.                                 logIn(source, account, password)
  17.                                         triggerClientEvent (source,"hideLoginWindow",getRootElement())
  18.                                         triggerClientEvent (source,"dxDrawClose",source)
  19.                                         triggerClientEvent(source,"addNotification",getRootElement(),"Başarıyla giriş yaptın!", 1)
  20.                                         if isButtonOn4 == true then
  21.                                                 triggerClientEvent(source,"saveLoginToXML",getRootElement(),username,password)
  22.                                         else
  23.                                                 triggerClientEvent(source,"resetSaveXML",getRootElement(),username,password)
  24.                                         end
  25.                                
  26.                         else
  27.                                 triggerClientEvent(source,"addNotification",getRootElement(),"Hata! Kullanıcı adı veya şifre yanlış!", 3)
  28.                         end
  29.                 else
  30.                         triggerClientEvent(source,"addNotification",getRootElement(),"Lütfen şifrenizi giriniz!", 3)
  31.                 end
  32.         else
  33.                 triggerClientEvent(source,"addNotification",getRootElement(),"Lütfen Kullanıcı adınızı giriniz!", 3)
  34.         end
  35. end
  36. addEvent("onRequestLogin",true)
  37. addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)
  38.  
  39.  
  40.  
  41. function registerPlayer(username,password)
  42.     if not (username == "") then
  43.         if not (password == "") then
  44.                     local account = getAccount (username,password)
  45.                     if (account == false) then
  46.                         local accountAdded = addAccount(tostring(username),tostring(password))
  47.                         if (accountAdded) then
  48.                             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 )
  49.                             triggerClientEvent(source,"addNotification",getRootElement(),"Başarıyla kayıt oldun!", 1)
  50.                         else
  51.                             triggerClientEvent(source,"addNotification",getRootElement(),"Hata! Lütfen başka bir kullanıcı adı veya şifre giriniz!", 3)
  52.                         end
  53.                     else
  54.                         triggerClientEvent(source,"addNotification",getRootElement(),"Hata! Bu kullanıcı adı zaten mevcut!", 3)
  55.                     end
  56.         else
  57.             triggerClientEvent(source,"addNotification",getRootElement(),"Hata! Lütfen şifrenizi giriniz!", 2)
  58.         end
  59.     else
  60.         triggerClientEvent(source,"addNotification",getRootElement(),"Hata! Lütfen kullanıcı adınızı giriniz!", 2)
  61.     end
  62. end
  63. addEvent("onRequestRegister", true)
  64. addEventHandler("onRequestRegister", getRootElement(), registerPlayer)
 

Paradox

  • Kurucu
  • *
  • İleti: 646
  • SH Gaming
Ynt: [YARDIM] Login Panel Hud Radar Sorunu
« Yanıtla #5 : 25 Mayıs 2017, 21:57:46 »
Client
Kod: Lua
  1. local screenW, screenH = guiGetScreenSize()
  2.  
  3. local X, Y = guiGetScreenSize()
  4. local hX, hY = (X/2)-(1920/2), (Y/2)-(1080/2)
  5.  
  6. local font_0 = guiCreateFont("font.ttf")
  7. local font_1 = guiCreateFont("font.ttf",11)
  8.  
  9. local isButtonOn4 = false;
  10.  
  11. guiSetInputMode("no_binds_when_editing")
  12.  
  13. addEventHandler("onClientResourceStart", resourceRoot,
  14. function()
  15.         showCursor(true)
  16.         loginwindow = guiCreateStaticImage((screenW - 489) / 2, (screenH - 253) / 2, 489, 253, "window2.png", false)
  17.         guiSetAlpha(loginwindow, 0.99)
  18.         guiSetVisible(loginwindow, true)
  19.  
  20.         logintitle = guiCreateLabel(155, 0, 293, 15, "Hilal Askeri Roleplay", false, loginwindow)
  21.         guiSetFont(logintitle, font_0)
  22.         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)
  23.         guiSetFont(logininfo, font_1)
  24.         loginuserlbl = guiCreateLabel(10, 118, 160, 37, "Kullanıcı adı : ", false, loginwindow)
  25.         guiSetFont(loginuserlbl, font_1)
  26.         loginuserpass = guiCreateLabel(10, 165, 160, 37, "Şifre : ", false, loginwindow)
  27.         guiSetFont(loginuserpass, font_1)
  28.         useredit = guiCreateEdit(143, 108, 174, 32, "", false, loginwindow)
  29.         passedit = guiCreateEdit(143, 160, 174, 32, "", false, loginwindow)
  30.         guiEditSetMaxLength ( useredit,25)
  31.         guiEditSetMaxLength ( passedit,25)
  32.         guiEditSetMasked ( passedit, true )
  33.         loginbutton = guiCreateStaticImage(49, 208, 126, 35, "button.png", false, loginwindow)
  34.  
  35.         loginlbl = guiCreateLabel(0, 0, 126, 35, "Giriş yap", false, loginbutton)
  36.         guiSetFont(loginlbl, font_1)
  37.         guiLabelSetHorizontalAlign(loginlbl, "center", false)
  38.         guiLabelSetVerticalAlign(loginlbl, "center")
  39.  
  40.         registerbutton = guiCreateStaticImage(227, 208, 126, 35, "button.png", false, loginwindow)
  41.  
  42.         registerlbl = guiCreateLabel(0, 0, 126, 35, "Kayıt ol", false, registerbutton)
  43.         guiSetFont(registerlbl, font_1)
  44.         guiLabelSetHorizontalAlign(registerlbl, "center", false)
  45.         guiLabelSetVerticalAlign(registerlbl, "center")
  46.  
  47.         rememberImage = guiCreateStaticImage(351, 160, 128, 32, "off.png", false, loginwindow)
  48.         rememberlbl = guiCreateLabel(345, 140, 138, 32, "Üyeliğin hatırlansın mı?", false, loginwindow)
  49.         guiSetFont(rememberlbl, font_0)
  50.  
  51.         addEventHandler("onClientGUIClick",loginlbl,onClickBtnLogin)
  52.         addEventHandler("onClientGUIClick",registerlbl,onClickBtnRegister)
  53.  
  54.        
  55.  
  56.         local username, password = loadLoginFromXML()
  57.        
  58.         if not( username == "" or password == "") then
  59.                 guiSetText ( useredit, tostring(username))
  60.                 guiSetText ( passedit, tostring(password))
  61.                 guiStaticImageLoadImage(rememberImage, "on.png")
  62.                 isButtonOn4 = true
  63.         else
  64.                 guiSetText ( useredit, tostring(username))
  65.                 guiSetText ( passedit, tostring(password))
  66.                 guiStaticImageLoadImage(rememberImage, "off.png")
  67.                 isButtonOn4 = false
  68.         end
  69. end
  70. )
  71.  
  72. function click4()
  73.     if (source == rememberImage and isButtonOn4 == false) then
  74.         guiStaticImageLoadImage(rememberImage, "on.png")
  75.         isButtonOn4 = true
  76.     elseif (source == rememberImage and isButtonOn4 == true) then
  77.         guiStaticImageLoadImage(rememberImage, "off.png")
  78.         isButtonOn4 = false
  79.     end    
  80. end
  81. addEventHandler("onClientGUIClick",root,click4)
  82.  
  83.  
  84. function loadLoginFromXML()
  85.         local xml_save_log_File = xmlLoadFile ("userdata.xml")
  86.     if not xml_save_log_File then
  87.         xml_save_log_File = xmlCreateFile("userdata.xml", "login")
  88.     end
  89.     local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
  90.     local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
  91.     if usernameNode and passwordNode then
  92.         return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode)
  93.     else
  94.                 return "", ""
  95.     end
  96.     xmlUnloadFile ( xml_save_log_File )
  97. end
  98.  
  99.  
  100. function saveLoginToXML(username, password)
  101.     local xml_save_log_File = xmlLoadFile ("userdata.xml")
  102.     if not xml_save_log_File then
  103.         xml_save_log_File = xmlCreateFile("userdata.xml", "login")
  104.     end
  105.         if (username ~= "") then
  106.                 local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
  107.                 if not usernameNode then
  108.                         usernameNode = xmlCreateChild(xml_save_log_File, "username")
  109.                 end
  110.                 xmlNodeSetValue (usernameNode, tostring(username))
  111.         end
  112.         if (password ~= "") then
  113.                 local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
  114.                 if not passwordNode then
  115.                         passwordNode = xmlCreateChild(xml_save_log_File, "password")
  116.                 end            
  117.                 xmlNodeSetValue (passwordNode, tostring(password))
  118.         end
  119.     xmlSaveFile(xml_save_log_File)
  120.     xmlUnloadFile (xml_save_log_File)
  121. end
  122. addEvent("saveLoginToXML", true)
  123. addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML)
  124.  
  125. function resetSaveXML()
  126.                 local xml_save_log_File = xmlLoadFile ("userdata.xml")
  127.                 if not xml_save_log_File then
  128.                         xml_save_log_File = xmlCreateFile("userdata.xml", "login")
  129.                 end
  130.                 if (username ~= "") then
  131.                         local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
  132.                         if not usernameNode then
  133.                                 usernameNode = xmlCreateChild(xml_save_log_File, "username")
  134.                         end
  135.                 end
  136.                 if (password ~= "") then
  137.                         local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
  138.                         if not passwordNode then
  139.                                 passwordNode = xmlCreateChild(xml_save_log_File, "password")
  140.                         end            
  141.                         xmlNodeSetValue (passwordNode, "")
  142.                 end
  143.                 xmlSaveFile(xml_save_log_File)
  144.                 xmlUnloadFile (xml_save_log_File)
  145. end
  146. addEvent("resetSaveXML", true)
  147. addEventHandler("resetSaveXML", getRootElement(), resetSaveXML)
  148.  
  149. function onClickBtnLogin(button,state)
  150.         if(button == "left" and state == "up") then
  151.                 if (source == loginlbl) then
  152.                         username = guiGetText(useredit)
  153.                         password = guiGetText(passedit)
  154.                         if isButtonOn4 == true then
  155.                                 isButtonOn4 = true
  156.                         else
  157.                                 isButtonOn4 = false
  158.                         end
  159.                         triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,isButtonOn4)
  160.                 end
  161.         end
  162. end
  163.  
  164. function onClickBtnRegister(button,state)
  165.         showCursor(true)
  166.         username = guiGetText(useredit)
  167.         password = guiGetText(passedit)
  168.         triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password)              
  169. end
  170.  
  171. function hideLoginWindow()
  172.         showCursor(false)
  173.         showChat(true)
  174.         guiSetVisible(loginwindow,false)
  175.         removeEventHandler("onClientGUIClick",loginlbl,onClickBtnLogin)
  176.                 showPlayerHudComponent("all", true)
  177. end
  178. addEvent("hideLoginWindow", true)
  179. addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)
  180.  
  181. function hover()
  182.         if source == loginlbl then
  183.                 guiStaticImageLoadImage(loginbutton, "buttonhover.png")
  184.         elseif source == registerlbl then
  185.                 guiStaticImageLoadImage(registerbutton, "buttonhover.png")
  186.         end
  187. end
  188. addEventHandler("onClientMouseEnter", getRootElement(), hover)
  189.  
  190.  
  191. function leave()
  192.         if source == loginlbl then
  193.                 guiStaticImageLoadImage(loginbutton, "button.png")
  194.         elseif source == registerlbl then
  195.                 guiStaticImageLoadImage(registerbutton, "button.png")
  196.         end
  197. end
  198. addEventHandler("onClientMouseLeave", getRootElement(), leave)
  199.  
  200.  
  201. function click()
  202.         if source == loginlbl then
  203.                 guiStaticImageLoadImage(loginbutton, "buttonclicked.png")
  204.                 setTimer(function()
  205.                         guiStaticImageLoadImage(loginbutton, "button.png")
  206.                 end, 50, 1)
  207.         elseif source == registerlbl then
  208.                 guiStaticImageLoadImage(registerbutton, "buttonclicked.png")
  209.                 setTimer(function()
  210.                         guiStaticImageLoadImage(registerbutton, "button.png")
  211.                 end, 50, 1)
  212.         end
  213. end
  214. addEventHandler("onClientGUIClick", getRootElement(), click)
  215.  
  216. function removeColorCoding (name)
  217.     return type(name)=="string" and string.gsub(name, "#%x%x%x%x%x%x", "") or name
  218. end
  219.  
  220. local sX, sY = guiGetScreenSize()
  221.  
  222. local lobbyUI = {
  223.   bg = {},
  224.   arenas = {
  225.     width = 300,
  226.     count = 0,
  227.     margin = 25,
  228.     rows = 2,
  229.     infoLabel = 0.14,
  230.     defaultOpacity = 200
  231.   },
  232.   state = true
  233. }
  234.  
  235. setSkyGradient(60, 100, 196, 136, 170, 212)
  236. showPlayerHudComponent("all", false)
  237. setCloudsEnabled(false)
  238. setBlurLevel(0)
  239. setTime(12, 0)
  240. setMinuteDuration(3600000)
  241. setPedCanBeKnockedOffBike(localPlayer, false)
  242.  
  243.  
  244. lobbyUI.bg.horizontalOffset = 0
  245. lobbyUI.bg.verticalOffset = 0
  246.  
  247.  
  248. lobbyUI.bg.alpha = 0
  249. lobbyUI.bg.multiplier = 1
  250.  
  251. function drawLobbyBackground()
  252.   if lobbyUI.bg.alpha < 175 then
  253.     lobbyUI.bg.multiplier = 1.1
  254.     lobbyUI.bg.alpha = math.min(lobbyUI.bg.alpha + 2 * lobbyUI.bg.multiplier, 175)
  255.     if lobbyUI.bg.alpha == 175 then
  256.     end
  257.   end
  258.   dxDrawRectangle(0, 0, sX, sY,tocolor(0, 0, 0, lobbyUI.bg.alpha),false)
  259. end
  260. addEventHandler("onClientRender",root, drawLobbyBackground)
  261.  
  262. addEvent("dxDrawClose", true)
  263. addEventHandler("dxDrawClose", getRootElement(),
  264. function()
  265.     removeEventHandler("onClientRender",root, drawLobbyBackground)
  266. end)
 

MTASA-TURK | Türkiye'nin En Güncel MTA Platformu

Ynt: [YARDIM] Login Panel Hud Radar Sorunu
« Yanıtla #5 : 25 Mayıs 2017, 21:57:46 »

Prose

  • Deneyimli Üye
  • *
  • İleti: 473
  • Gökhan Türkoglu
Ynt: [YARDIM] Login Panel Hud Radar Sorunu
« Yanıtla #6 : 25 Mayıs 2017, 22:00:16 »
Linkleri Görebilmek İçin Kayıt Olun veya Giriş Yapın
Client
Kod: Lua
  1. local screenW, screenH = guiGetScreenSize()
  2.  
  3. local X, Y = guiGetScreenSize()
  4. local hX, hY = (X/2)-(1920/2), (Y/2)-(1080/2)
  5.  
  6. local font_0 = guiCreateFont("font.ttf")
  7. local font_1 = guiCreateFont("font.ttf",11)
  8.  
  9. local isButtonOn4 = false;
  10.  
  11. guiSetInputMode("no_binds_when_editing")
  12.  
  13. addEventHandler("onClientResourceStart", resourceRoot,
  14. function()
  15.         showCursor(true)
  16.         loginwindow = guiCreateStaticImage((screenW - 489) / 2, (screenH - 253) / 2, 489, 253, "window2.png", false)
  17.         guiSetAlpha(loginwindow, 0.99)
  18.         guiSetVisible(loginwindow, true)
  19.  
  20.         logintitle = guiCreateLabel(155, 0, 293, 15, "Hilal Askeri Roleplay", false, loginwindow)
  21.         guiSetFont(logintitle, font_0)
  22.         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)
  23.         guiSetFont(logininfo, font_1)
  24.         loginuserlbl = guiCreateLabel(10, 118, 160, 37, "Kullanıcı adı : ", false, loginwindow)
  25.         guiSetFont(loginuserlbl, font_1)
  26.         loginuserpass = guiCreateLabel(10, 165, 160, 37, "Şifre : ", false, loginwindow)
  27.         guiSetFont(loginuserpass, font_1)
  28.         useredit = guiCreateEdit(143, 108, 174, 32, "", false, loginwindow)
  29.         passedit = guiCreateEdit(143, 160, 174, 32, "", false, loginwindow)
  30.         guiEditSetMaxLength ( useredit,25)
  31.         guiEditSetMaxLength ( passedit,25)
  32.         guiEditSetMasked ( passedit, true )
  33.         loginbutton = guiCreateStaticImage(49, 208, 126, 35, "button.png", false, loginwindow)
  34.  
  35.         loginlbl = guiCreateLabel(0, 0, 126, 35, "Giriş yap", false, loginbutton)
  36.         guiSetFont(loginlbl, font_1)
  37.         guiLabelSetHorizontalAlign(loginlbl, "center", false)
  38.         guiLabelSetVerticalAlign(loginlbl, "center")
  39.  
  40.         registerbutton = guiCreateStaticImage(227, 208, 126, 35, "button.png", false, loginwindow)
  41.  
  42.         registerlbl = guiCreateLabel(0, 0, 126, 35, "Kayıt ol", false, registerbutton)
  43.         guiSetFont(registerlbl, font_1)
  44.         guiLabelSetHorizontalAlign(registerlbl, "center", false)
  45.         guiLabelSetVerticalAlign(registerlbl, "center")
  46.  
  47.         rememberImage = guiCreateStaticImage(351, 160, 128, 32, "off.png", false, loginwindow)
  48.         rememberlbl = guiCreateLabel(345, 140, 138, 32, "Üyeliğin hatırlansın mı?", false, loginwindow)
  49.         guiSetFont(rememberlbl, font_0)
  50.  
  51.         addEventHandler("onClientGUIClick",loginlbl,onClickBtnLogin)
  52.         addEventHandler("onClientGUIClick",registerlbl,onClickBtnRegister)
  53.  
  54.        
  55.  
  56.         local username, password = loadLoginFromXML()
  57.        
  58.         if not( username == "" or password == "") then
  59.                 guiSetText ( useredit, tostring(username))
  60.                 guiSetText ( passedit, tostring(password))
  61.                 guiStaticImageLoadImage(rememberImage, "on.png")
  62.                 isButtonOn4 = true
  63.         else
  64.                 guiSetText ( useredit, tostring(username))
  65.                 guiSetText ( passedit, tostring(password))
  66.                 guiStaticImageLoadImage(rememberImage, "off.png")
  67.                 isButtonOn4 = false
  68.         end
  69. end
  70. )
  71.  
  72. function click4()
  73.     if (source == rememberImage and isButtonOn4 == false) then
  74.         guiStaticImageLoadImage(rememberImage, "on.png")
  75.         isButtonOn4 = true
  76.     elseif (source == rememberImage and isButtonOn4 == true) then
  77.         guiStaticImageLoadImage(rememberImage, "off.png")
  78.         isButtonOn4 = false
  79.     end    
  80. end
  81. addEventHandler("onClientGUIClick",root,click4)
  82.  
  83.  
  84. function loadLoginFromXML()
  85.         local xml_save_log_File = xmlLoadFile ("userdata.xml")
  86.     if not xml_save_log_File then
  87.         xml_save_log_File = xmlCreateFile("userdata.xml", "login")
  88.     end
  89.     local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
  90.     local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
  91.     if usernameNode and passwordNode then
  92.         return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode)
  93.     else
  94.                 return "", ""
  95.     end
  96.     xmlUnloadFile ( xml_save_log_File )
  97. end
  98.  
  99.  
  100. function saveLoginToXML(username, password)
  101.     local xml_save_log_File = xmlLoadFile ("userdata.xml")
  102.     if not xml_save_log_File then
  103.         xml_save_log_File = xmlCreateFile("userdata.xml", "login")
  104.     end
  105.         if (username ~= "") then
  106.                 local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
  107.                 if not usernameNode then
  108.                         usernameNode = xmlCreateChild(xml_save_log_File, "username")
  109.                 end
  110.                 xmlNodeSetValue (usernameNode, tostring(username))
  111.         end
  112.         if (password ~= "") then
  113.                 local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
  114.                 if not passwordNode then
  115.                         passwordNode = xmlCreateChild(xml_save_log_File, "password")
  116.                 end            
  117.                 xmlNodeSetValue (passwordNode, tostring(password))
  118.         end
  119.     xmlSaveFile(xml_save_log_File)
  120.     xmlUnloadFile (xml_save_log_File)
  121. end
  122. addEvent("saveLoginToXML", true)
  123. addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML)
  124.  
  125. function resetSaveXML()
  126.                 local xml_save_log_File = xmlLoadFile ("userdata.xml")
  127.                 if not xml_save_log_File then
  128.                         xml_save_log_File = xmlCreateFile("userdata.xml", "login")
  129.                 end
  130.                 if (username ~= "") then
  131.                         local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
  132.                         if not usernameNode then
  133.                                 usernameNode = xmlCreateChild(xml_save_log_File, "username")
  134.                         end
  135.                 end
  136.                 if (password ~= "") then
  137.                         local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
  138.                         if not passwordNode then
  139.                                 passwordNode = xmlCreateChild(xml_save_log_File, "password")
  140.                         end            
  141.                         xmlNodeSetValue (passwordNode, "")
  142.                 end
  143.                 xmlSaveFile(xml_save_log_File)
  144.                 xmlUnloadFile (xml_save_log_File)
  145. end
  146. addEvent("resetSaveXML", true)
  147. addEventHandler("resetSaveXML", getRootElement(), resetSaveXML)
  148.  
  149. function onClickBtnLogin(button,state)
  150.         if(button == "left" and state == "up") then
  151.                 if (source == loginlbl) then
  152.                         username = guiGetText(useredit)
  153.                         password = guiGetText(passedit)
  154.                         if isButtonOn4 == true then
  155.                                 isButtonOn4 = true
  156.                         else
  157.                                 isButtonOn4 = false
  158.                         end
  159.                         triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,isButtonOn4)
  160.                 end
  161.         end
  162. end
  163.  
  164. function onClickBtnRegister(button,state)
  165.         showCursor(true)
  166.         username = guiGetText(useredit)
  167.         password = guiGetText(passedit)
  168.         triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password)              
  169. end
  170.  
  171. function hideLoginWindow()
  172.         showCursor(false)
  173.         showChat(true)
  174.         guiSetVisible(loginwindow,false)
  175.         removeEventHandler("onClientGUIClick",loginlbl,onClickBtnLogin)
  176.                 showPlayerHudComponent("all", true)
  177. end
  178. addEvent("hideLoginWindow", true)
  179. addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)
  180.  
  181. function hover()
  182.         if source == loginlbl then
  183.                 guiStaticImageLoadImage(loginbutton, "buttonhover.png")
  184.         elseif source == registerlbl then
  185.                 guiStaticImageLoadImage(registerbutton, "buttonhover.png")
  186.         end
  187. end
  188. addEventHandler("onClientMouseEnter", getRootElement(), hover)
  189.  
  190.  
  191. function leave()
  192.         if source == loginlbl then
  193.                 guiStaticImageLoadImage(loginbutton, "button.png")
  194.         elseif source == registerlbl then
  195.                 guiStaticImageLoadImage(registerbutton, "button.png")
  196.         end
  197. end
  198. addEventHandler("onClientMouseLeave", getRootElement(), leave)
  199.  
  200.  
  201. function click()
  202.         if source == loginlbl then
  203.                 guiStaticImageLoadImage(loginbutton, "buttonclicked.png")
  204.                 setTimer(function()
  205.                         guiStaticImageLoadImage(loginbutton, "button.png")
  206.                 end, 50, 1)
  207.         elseif source == registerlbl then
  208.                 guiStaticImageLoadImage(registerbutton, "buttonclicked.png")
  209.                 setTimer(function()
  210.                         guiStaticImageLoadImage(registerbutton, "button.png")
  211.                 end, 50, 1)
  212.         end
  213. end
  214. addEventHandler("onClientGUIClick", getRootElement(), click)
  215.  
  216. function removeColorCoding (name)
  217.     return type(name)=="string" and string.gsub(name, "#%x%x%x%x%x%x", "") or name
  218. end
  219.  
  220. local sX, sY = guiGetScreenSize()
  221.  
  222. local lobbyUI = {
  223.   bg = {},
  224.   arenas = {
  225.     width = 300,
  226.     count = 0,
  227.     margin = 25,
  228.     rows = 2,
  229.     infoLabel = 0.14,
  230.     defaultOpacity = 200
  231.   },
  232.   state = true
  233. }
  234.  
  235. setSkyGradient(60, 100, 196, 136, 170, 212)
  236. showPlayerHudComponent("all", false)
  237. setCloudsEnabled(false)
  238. setBlurLevel(0)
  239. setTime(12, 0)
  240. setMinuteDuration(3600000)
  241. setPedCanBeKnockedOffBike(localPlayer, false)
  242.  
  243.  
  244. lobbyUI.bg.horizontalOffset = 0
  245. lobbyUI.bg.verticalOffset = 0
  246.  
  247.  
  248. lobbyUI.bg.alpha = 0
  249. lobbyUI.bg.multiplier = 1
  250.  
  251. function drawLobbyBackground()
  252.   if lobbyUI.bg.alpha < 175 then
  253.     lobbyUI.bg.multiplier = 1.1
  254.     lobbyUI.bg.alpha = math.min(lobbyUI.bg.alpha + 2 * lobbyUI.bg.multiplier, 175)
  255.     if lobbyUI.bg.alpha == 175 then
  256.     end
  257.   end
  258.   dxDrawRectangle(0, 0, sX, sY,tocolor(0, 0, 0, lobbyUI.bg.alpha),false)
  259. end
  260. addEventHandler("onClientRender",root, drawLobbyBackground)
  261.  
  262. addEvent("dxDrawClose", true)
  263. addEventHandler("dxDrawClose", getRootElement(),
  264. function()
  265.     removeEventHandler("onClientRender",root, drawLobbyBackground)
  266. end)

Eyw Kilit
 

Paradox

  • Kurucu
  • *
  • İleti: 646
  • SH Gaming
Ynt: [YARDIM] Login Panel Hud Radar Sorunu
« Yanıtla #7 : 25 Mayıs 2017, 22:01:13 »
Linkleri Görebilmek İçin Kayıt Olun veya Giriş Yapın
Eyw Kilit
Rica ederim, konu sahibinin isteği üzerine konu kilit.
« Son Düzenleme: 25 Mayıs 2017, 22:13:06 Gönderen: Narkoz »
 
Mesajı Beğenenler: Prose