17 Ekim 2018, 09:39:37

Gönderen Konu: [YARDIM] Login Panele Müzik Eklemek  (Okunma sayısı 123 defa)

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

emreozkantr

  • Yeni Üye
  • *
  • Default Avatar
  • İleti: 7
[YARDIM] Login Panele Müzik Eklemek
« : 29 Eylül 2018, 13:28:02 »
Selam login panelime müzik ekledim fakat giriş yap dediğim vakit müzik durmuyor bana yardımcı olabilirmisiniz.

Client.lua dosyası
Kod: Lua
  1. -- GET SCREEN SIZE --
  2. local sX,sY = guiGetScreenSize()
  3. -- ABBREVIATIONS --
  4. lW, lH = 300,300
  5. -- LOGIN PANEL --
  6. function loginPanel()
  7.     showChat (false)
  8.         showPlayerHudComponent ("all", false)
  9.         showCursor (true)
  10.     -- BACKGROUND --
  11.         background = guiCreateStaticImage (0,0,sX,sY,"img/background.png",false)
  12.         -- LOGIN PANEL --
  13.         loginWindow = guiCreateWindow (sX/2-lW/2,sY/2-lH/2,lW,lH,"Kahraman Freeroam | Giriş Yap",false,background)
  14.             guiSetVisible (loginWindow,true)
  15.         loginHeaderText = guiCreateLabel (0.1,0.1,300,30,"",false,loginWindow)
  16.             guiLabelSetVerticalAlign (loginHeaderText,"center")
  17.             guiLabelSetHorizontalAlign (loginHeaderText,"center")
  18.                 guiSetFont (loginHeaderText,"default-bold-small")
  19.         usernameEdit = guiCreateEdit (20,52,260,35,"Kullanıcı Adı",false,loginWindow)
  20.             guiEditSetMaxLength (usernameEdit,21)
  21.         passwordEdit = guiCreateEdit (20,102,260,35,"Şifre",false,loginWindow)
  22.             guiEditSetMaxLength (passwordEdit,21)
  23.                 guiEditSetMasked (passwordEdit,true)
  24.         rememberCheckbox =  guiCreateCheckBox (lW-130,152,110,20,"Beni Hatırla",false,false,loginWindow)
  25.             guiSetFont (rememberCheckbox,"default-bold-small")
  26.         loginButton = guiCreateButton (20,187,260,40,"",false,loginWindow)
  27.             guiSetAlpha (loginButton,1)
  28.         loginLabel = guiCreateLabel (0,0,260,40,"Giriş Yap",false,loginButton)
  29.             guiLabelSetVerticalAlign (loginLabel,"center")
  30.             guiLabelSetHorizontalAlign (loginLabel,"center")
  31.                 guiSetFont (loginLabel,"default-bold-small")
  32.         registerButton = guiCreateButton (20,242,260,40,"",false,loginWindow)
  33.         registerLabel = guiCreateLabel (0,0,260,40,"Kayıt Ol",false,registerButton)
  34.             guiLabelSetVerticalAlign (registerLabel,"center")
  35.             guiLabelSetHorizontalAlign (registerLabel,"center")
  36.                 guiSetFont (registerLabel,"default-bold-small")
  37.         -- REGISTER PANEL --
  38.         registerWindow = guiCreateWindow (sX/2-lW/2,sY/2-lH/2,lW,lH,"Kahraman Freeroam | Kayıt Ol",false,background)
  39.             guiSetVisible (registerWindow,false)
  40.         registerHeaderText = guiCreateLabel (0.1,0.1,300,30,"",false,registerWindow)
  41.             guiLabelSetVerticalAlign (registerHeaderText,"center")
  42.             guiLabelSetHorizontalAlign (registerHeaderText,"center")
  43.                 guiSetFont (registerHeaderText,"default-bold-small")
  44.         usernameText = guiCreateLabel (20,42,80,35,"Kullanıcı Adı",false,registerWindow)
  45.             guiEditSetReadOnly (usernameText,true)
  46.                 guiSetFont (usernameText,"default-bold-small")
  47.         usernameREdit = guiCreateEdit (105,42,175,35,"",false,registerWindow)
  48.             guiEditSetMaxLength (usernameREdit,21)
  49.         passwordText = guiCreateLabel (20,92,80,35,"Şifre",false,registerWindow)
  50.             guiEditSetReadOnly (passwordText,true)
  51.                 guiSetFont (passwordText,"default-bold-small")
  52.         passwordREdit = guiCreateEdit (105,92,175,35,"",false,registerWindow)
  53.             guiEditSetMaxLength (passwordREdit,21)
  54.                 guiEditSetMasked (passwordREdit,true)
  55.         passwordCText = guiCreateLabel (20,142,80,35,"Tekrar Şifre",false,registerWindow)
  56.             guiEditSetReadOnly (passwordCText,true)
  57.                 guiSetFont (passwordCText,"default-bold-small")
  58.         passwordCREdit = guiCreateEdit (105,142,175,35,"",false,registerWindow)
  59.             guiEditSetMaxLength (passwordCREdit,21)
  60.                 guiEditSetMasked (passwordCREdit,true)
  61.         registerRButton = guiCreateButton (20,192,260,40,"",false,registerWindow)
  62.         registerRLabel = guiCreateLabel (0,0,260,40,"Kayıt Ol",false,registerRButton)
  63.             guiLabelSetVerticalAlign (registerRLabel,"center")
  64.             guiLabelSetHorizontalAlign (registerRLabel,"center")
  65.                 guiSetFont (registerRLabel,"default-bold-small")
  66.         loginRButton = guiCreateButton (20,247,260,40,"",false,registerWindow)
  67.         loginRLabel = guiCreateLabel (0,0,260,40,"Giriş Yap",false,loginRButton)
  68.             guiLabelSetVerticalAlign (loginRLabel,"center")
  69.             guiLabelSetHorizontalAlign (loginRLabel,"center")
  70.                 guiSetFont (loginRLabel,"default-bold-small")
  71.         -- REMEMBER PLAYER ACCOUNT --
  72.         xml = xmlLoadFile("userdata.xml")
  73.     loadXML()
  74. end
  75.  addEventHandler ("onClientResourceStart",resourceRoot,loginPanel)
  76. -- HOVER BUTTON --
  77. addEventHandler ("onClientMouseEnter",root,
  78. function()
  79.     if source == loginLabel then
  80.             guiStaticImageLoadImage ( loginButton, "img/hoverButton.png" )
  81.         elseif source == registerLabel then
  82.                 guiStaticImageLoadImage ( registerButton, "img/hoverButton.png" )
  83.         elseif source == loginRLabel then
  84.                 guiStaticImageLoadImage ( loginRButton, "img/hoverButton.png" )
  85.         elseif source == registerRLabel then
  86.                 guiStaticImageLoadImage ( registerRButton, "img/hoverButton.png" )
  87.         end
  88. end
  89. )
  90. -- BUTTON --
  91. addEventHandler ("onClientMouseLeave",root,
  92. function()
  93.     if source == loginLabel then
  94.             guiStaticImageLoadImage ( loginButton, "img/button.png" )
  95.         elseif source == registerLabel then
  96.                 guiStaticImageLoadImage ( registerButton, "img/button.png" )
  97.         elseif source == loginRLabel then
  98.                 guiStaticImageLoadImage ( loginRButton, "img/button.png" )
  99.         elseif source == registerRLabel then
  100.                 guiStaticImageLoadImage ( registerRButton, "img/button.png" )
  101.         end
  102. end
  103. )
  104. -- REMEMBER PLAYER ACCOUNT --
  105. function loadXML()
  106.   if not xml then
  107.     xml = xmlCreateFile("userdata.xml","userdata")
  108.     usernameChild = xmlCreateChild(xml,"username")
  109.     passwordChild = xmlCreateChild(xml,"password")
  110.     checkboxChild = xmlCreateChild(xml,"state")
  111.     xmlSaveFile(xml)
  112.   else
  113.     usernameChild = xmlFindChild(xml,"username",0)
  114.     passwordChild = xmlFindChild(xml,"password",0)
  115.     checkboxChild = xmlFindChild(xml,"state",0)
  116.   end
  117.     usernameLoad = xmlNodeGetValue(usernameChild)
  118.     passwordLoad = xmlNodeGetValue(passwordChild)
  119.     guiSetText (usernameEdit,usernameLoad)
  120.     guiSetText (passwordEdit,passwordLoad)
  121.         if xmlNodeGetValue(checkboxChild) then
  122.             guiCheckBoxSetSelected (rememberCheckbox,true)
  123.         end
  124. end
  125. function saveXML(username,password,checkboxState)
  126.   if guiCheckBoxGetSelected (rememberCheckbox) == true then
  127.     xmlNodeSetValue(usernameChild,username)
  128.     xmlNodeSetValue(passwordChild,password)
  129.     xmlNodeSetValue(checkboxChild,tostring(checkboxState))
  130.     xmlSaveFile(xml)
  131.   else
  132.     xmlNodeSetValue(usernameChild,"")
  133.     xmlNodeSetValue(passwordChild,"")
  134.     xmlNodeSetValue(checkboxChild,"")
  135.     xmlSaveFile(xml)
  136.   end
  137. end
  138. addEvent("saveXML",true)
  139. addEventHandler("saveXML",getRootElement(),saveXML)
  140. -- LOGIN PANEL/REGISTER PANEL --
  141. function redirectPanel()
  142.     if (source == registerLabel) then
  143.             if (guiGetVisible (loginWindow) == true ) then
  144.                     guiSetVisible (loginWindow,false)
  145.                         guiSetVisible (registerWindow,true)
  146.                 end
  147.         end
  148.         if (source == loginRLabel) then
  149.             if (guiGetVisible (registerWindow) == true ) then
  150.                 guiSetVisible (registerWindow,false)
  151.                     guiSetVisible (loginWindow,true)
  152.                 end
  153.         end
  154. end
  155.  addEventHandler ("onClientGUIClick",getRootElement(),redirectPanel)
  156. -- REGISTER --
  157. function register()
  158.     if (source == registerRLabel) then
  159.             local username = guiGetText(usernameREdit)
  160.         local password = guiGetText (passwordREdit)
  161.                 if (guiGetText(usernameREdit) ~= "") and (guiGetText(passwordREdit) ~= "") and (guiGetText(passwordREdit) == guiGetText(passwordCREdit)) then
  162.                 triggerServerEvent("registerPlayer",getLocalPlayer(),getLocalPlayer(),username,password)
  163.                 elseif (guiGetText(usernameREdit) == "") then
  164.                     outputNotification ("Geçersiz kullanıcı adı.",3)
  165.                 elseif (guiGetText(passwordREdit) == "") or (guiGetText(passwordCREdit) == "") or (guiGetText(passwordREdit) ~= guiGetText(passwordCREdit)) then
  166.                     outputNotification ("Geçersiz şifre.",3)
  167.                 end
  168.         end
  169. end
  170.  addEventHandler ("onClientGUIClick",getRootElement(),register)
  171. -- WRONG USERNAME OR PASSWORD --
  172. function wrongAccount()
  173.     outputNotification ("Kullanıcı adı veya şifre yanlış..",3)
  174. end
  175.  addEvent ("wrongAccount",true)
  176.  addEventHandler ("wrongAccount",getRootElement(),wrongAccount)
  177. -- SUCCESFULLY LOGGED IN --
  178. function succesAccount()
  179.     outputNotification ("Başarıyla giriş yapıldı.",1)
  180. end
  181.  addEvent ("successfullyLogin",true)
  182.  addEventHandler ("successfullyLogin",getRootElement(),succesAccount)
  183. -- NOT REGISTER --
  184. function notRegister()
  185.     outputNotification ("Hesap bulunamadı, yeni bir hesap oluşturabilirsiniz!",3)
  186. end
  187.  addEvent ("notRegister",true)
  188.  addEventHandler ("notRegister",getRootElement(),notRegister)
  189. -- LOGIN --
  190. function login()
  191.     if (source == loginLabel) then
  192.             local username = guiGetText(usernameEdit)
  193.         local password = guiGetText(passwordEdit)
  194.                 if guiGetText(usernameEdit) ~= "" and guiGetText(passwordEdit) ~= "" then
  195.                     triggerServerEvent("loginPlayer",getLocalPlayer(),getLocalPlayer(),username,password)
  196.                 elseif guiGetText(usernameEdit) == "" and guiGetText(passwordEdit) == "" then
  197.                     outputNotification ("Geçersiz kullanıcı adı ve şifre",3)
  198.             elseif guiGetText(usernameEdit) == "" then
  199.                     outputNotification ("Geçersiz kullanıcı adı.",3)
  200.                 elseif guiGetText(passwordEdit) == "" then
  201.                     outputNotification ("Geçersiz şifre.",3)
  202.                 end
  203.         end
  204. end
  205.  addEventHandler ("onClientGUIClick",getRootElement(),login)
  206. -- CLOSE LOGIN PANEL --
  207. function cLoginPanel()
  208.     guiSetVisible (background,false)
  209.         showChat (true)
  210.         showPlayerHudComponent ("all", true)
  211.         showCursor (false)
  212. end
  213.  addEvent ("hideLoginPanel",true)
  214.  addEventHandler ("hideLoginPanel",getRootElement(),cLoginPanel)
  215.  -- CLOSE REGISTER PANEL --
  216. function cRegisterPanel()
  217.     guiSetVisible (background,false)
  218.         showChat (true)
  219.         showPlayerHudComponent ("all", true)
  220.         showCursor (false)
  221. end
  222.  addEvent ("hideRegisterPanel",true)
  223.  addEventHandler ("hideRegisterPanel",getRootElement(),cRegisterPanel)
  224.  
  225. local sound
  226. addEventHandler("onClientResourceStart", resourceRoot,    
  227. function()        
  228. sound = playSound("ses.mp3", false)        
  229. setSoundVolume(sound, 1.0)    
  230. end)
  231.  
  232. addEvent("muzikdurdur", true)
  233. addEventHandler("muzikdurdur", root,
  234. function()        
  235. if (sound) and (isElement(sound)) then
  236. destroyElement(sound)    
  237. end    
  238. end)
  239.  
Eklediğim Kod
Kod: Lua
  1. local sound
  2. addEventHandler("onClientResourceStart", resourceRoot,    
  3. function()        
  4. sound = playSound("ses.mp3", false)        
  5. setSoundVolume(sound, 1.0)    
  6. end)
  7.  
  8. addEvent("muzikdurdur", true)
  9. addEventHandler("muzikdurdur", root,
  10. function()        
  11. if (sound) and (isElement(sound)) then
  12. destroyElement(sound)    
  13. end    
  14. end)
« Son Düzenleme: 30 Eylül 2018, 18:05:54 Gönderen: Narkoz »
 

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

[YARDIM] Login Panele Müzik Eklemek
« : 29 Eylül 2018, 13:28:02 »

Paradox

  • Kurucu
  • *
  • İleti: 677
  • SH Gaming
Ynt: [YARDIM]Login Panele Müzik Eklemek
« Yanıtla #1 : 29 Eylül 2018, 13:43:32 »
Server kısmına giriş yaptığı bölüme muzikdurdur eventini eklemelisin.
 

emreozkantr

  • Yeni Üye
  • *
  • Default Avatar
  • İleti: 7
Ynt: [YARDIM]Login Panele Müzik Eklemek
« Yanıtla #2 : 29 Eylül 2018, 13:53:31 »
fazla kod bilgim yok yardımcı olamazmısın ?
 

Paradox

  • Kurucu
  • *
  • İleti: 677
  • SH Gaming
Ynt: [YARDIM]Login Panele Müzik Eklemek
« Yanıtla #3 : 29 Eylül 2018, 14:38:28 »
Client.lua' yı bu şekilde yap olacaktır.

Kod: Lua
  1. -- GET SCREEN SIZE --
  2. local sX,sY = guiGetScreenSize()
  3. -- ABBREVIATIONS --
  4. lW, lH = 300,300
  5. -- LOGIN PANEL --
  6. function loginPanel()
  7.     showChat (false)
  8.         showPlayerHudComponent ("all", false)
  9.         showCursor (true)
  10.     -- BACKGROUND --
  11.         background = guiCreateStaticImage (0,0,sX,sY,"img/background.png",false)
  12.         -- LOGIN PANEL --
  13.         loginWindow = guiCreateWindow (sX/2-lW/2,sY/2-lH/2,lW,lH,"Kahraman Freeroam | Giriş Yap",false,background)
  14.             guiSetVisible (loginWindow,true)
  15.         loginHeaderText = guiCreateLabel (0.1,0.1,300,30,"",false,loginWindow)
  16.             guiLabelSetVerticalAlign (loginHeaderText,"center")
  17.             guiLabelSetHorizontalAlign (loginHeaderText,"center")
  18.                 guiSetFont (loginHeaderText,"default-bold-small")
  19.         usernameEdit = guiCreateEdit (20,52,260,35,"Kullanıcı Adı",false,loginWindow)
  20.             guiEditSetMaxLength (usernameEdit,21)
  21.         passwordEdit = guiCreateEdit (20,102,260,35,"Şifre",false,loginWindow)
  22.             guiEditSetMaxLength (passwordEdit,21)
  23.                 guiEditSetMasked (passwordEdit,true)
  24.         rememberCheckbox =  guiCreateCheckBox (lW-130,152,110,20,"Beni Hatırla",false,false,loginWindow)
  25.             guiSetFont (rememberCheckbox,"default-bold-small")
  26.         loginButton = guiCreateButton (20,187,260,40,"",false,loginWindow)
  27.             guiSetAlpha (loginButton,1)
  28.         loginLabel = guiCreateLabel (0,0,260,40,"Giriş Yap",false,loginButton)
  29.             guiLabelSetVerticalAlign (loginLabel,"center")
  30.             guiLabelSetHorizontalAlign (loginLabel,"center")
  31.                 guiSetFont (loginLabel,"default-bold-small")
  32.         registerButton = guiCreateButton (20,242,260,40,"",false,loginWindow)
  33.         registerLabel = guiCreateLabel (0,0,260,40,"Kayıt Ol",false,registerButton)
  34.             guiLabelSetVerticalAlign (registerLabel,"center")
  35.             guiLabelSetHorizontalAlign (registerLabel,"center")
  36.                 guiSetFont (registerLabel,"default-bold-small")
  37.         -- REGISTER PANEL --
  38.         registerWindow = guiCreateWindow (sX/2-lW/2,sY/2-lH/2,lW,lH,"Kahraman Freeroam | Kayıt Ol",false,background)
  39.             guiSetVisible (registerWindow,false)
  40.         registerHeaderText = guiCreateLabel (0.1,0.1,300,30,"",false,registerWindow)
  41.             guiLabelSetVerticalAlign (registerHeaderText,"center")
  42.             guiLabelSetHorizontalAlign (registerHeaderText,"center")
  43.                 guiSetFont (registerHeaderText,"default-bold-small")
  44.         usernameText = guiCreateLabel (20,42,80,35,"Kullanıcı Adı",false,registerWindow)
  45.             guiEditSetReadOnly (usernameText,true)
  46.                 guiSetFont (usernameText,"default-bold-small")
  47.         usernameREdit = guiCreateEdit (105,42,175,35,"",false,registerWindow)
  48.             guiEditSetMaxLength (usernameREdit,21)
  49.         passwordText = guiCreateLabel (20,92,80,35,"Şifre",false,registerWindow)
  50.             guiEditSetReadOnly (passwordText,true)
  51.                 guiSetFont (passwordText,"default-bold-small")
  52.         passwordREdit = guiCreateEdit (105,92,175,35,"",false,registerWindow)
  53.             guiEditSetMaxLength (passwordREdit,21)
  54.                 guiEditSetMasked (passwordREdit,true)
  55.         passwordCText = guiCreateLabel (20,142,80,35,"Tekrar Şifre",false,registerWindow)
  56.             guiEditSetReadOnly (passwordCText,true)
  57.                 guiSetFont (passwordCText,"default-bold-small")
  58.         passwordCREdit = guiCreateEdit (105,142,175,35,"",false,registerWindow)
  59.             guiEditSetMaxLength (passwordCREdit,21)
  60.                 guiEditSetMasked (passwordCREdit,true)
  61.         registerRButton = guiCreateButton (20,192,260,40,"",false,registerWindow)
  62.         registerRLabel = guiCreateLabel (0,0,260,40,"Kayıt Ol",false,registerRButton)
  63.             guiLabelSetVerticalAlign (registerRLabel,"center")
  64.             guiLabelSetHorizontalAlign (registerRLabel,"center")
  65.                 guiSetFont (registerRLabel,"default-bold-small")
  66.         loginRButton = guiCreateButton (20,247,260,40,"",false,registerWindow)
  67.         loginRLabel = guiCreateLabel (0,0,260,40,"Giriş Yap",false,loginRButton)
  68.             guiLabelSetVerticalAlign (loginRLabel,"center")
  69.             guiLabelSetHorizontalAlign (loginRLabel,"center")
  70.                 guiSetFont (loginRLabel,"default-bold-small")
  71.         -- REMEMBER PLAYER ACCOUNT --
  72.         xml = xmlLoadFile("userdata.xml")
  73.     loadXML()
  74. end
  75.  addEventHandler ("onClientResourceStart",resourceRoot,loginPanel)
  76. -- HOVER BUTTON --
  77. addEventHandler ("onClientMouseEnter",root,
  78. function()
  79.     if source == loginLabel then
  80.             guiStaticImageLoadImage ( loginButton, "img/hoverButton.png" )
  81.         elseif source == registerLabel then
  82.                 guiStaticImageLoadImage ( registerButton, "img/hoverButton.png" )
  83.         elseif source == loginRLabel then
  84.                 guiStaticImageLoadImage ( loginRButton, "img/hoverButton.png" )
  85.         elseif source == registerRLabel then
  86.                 guiStaticImageLoadImage ( registerRButton, "img/hoverButton.png" )
  87.         end
  88. end
  89. )
  90. -- BUTTON --
  91. addEventHandler ("onClientMouseLeave",root,
  92. function()
  93.     if source == loginLabel then
  94.             guiStaticImageLoadImage ( loginButton, "img/button.png" )
  95.         elseif source == registerLabel then
  96.                 guiStaticImageLoadImage ( registerButton, "img/button.png" )
  97.         elseif source == loginRLabel then
  98.                 guiStaticImageLoadImage ( loginRButton, "img/button.png" )
  99.         elseif source == registerRLabel then
  100.                 guiStaticImageLoadImage ( registerRButton, "img/button.png" )
  101.         end
  102. end
  103. )
  104. -- REMEMBER PLAYER ACCOUNT --
  105. function loadXML()
  106.   if not xml then
  107.     xml = xmlCreateFile("userdata.xml","userdata")
  108.     usernameChild = xmlCreateChild(xml,"username")
  109.     passwordChild = xmlCreateChild(xml,"password")
  110.     checkboxChild = xmlCreateChild(xml,"state")
  111.     xmlSaveFile(xml)
  112.   else
  113.     usernameChild = xmlFindChild(xml,"username",0)
  114.     passwordChild = xmlFindChild(xml,"password",0)
  115.     checkboxChild = xmlFindChild(xml,"state",0)
  116.   end
  117.     usernameLoad = xmlNodeGetValue(usernameChild)
  118.     passwordLoad = xmlNodeGetValue(passwordChild)
  119.     guiSetText (usernameEdit,usernameLoad)
  120.     guiSetText (passwordEdit,passwordLoad)
  121.         if xmlNodeGetValue(checkboxChild) then
  122.             guiCheckBoxSetSelected (rememberCheckbox,true)
  123.         end
  124. end
  125. function saveXML(username,password,checkboxState)
  126.   if guiCheckBoxGetSelected (rememberCheckbox) == true then
  127.     xmlNodeSetValue(usernameChild,username)
  128.     xmlNodeSetValue(passwordChild,password)
  129.     xmlNodeSetValue(checkboxChild,tostring(checkboxState))
  130.     xmlSaveFile(xml)
  131.   else
  132.     xmlNodeSetValue(usernameChild,"")
  133.     xmlNodeSetValue(passwordChild,"")
  134.     xmlNodeSetValue(checkboxChild,"")
  135.     xmlSaveFile(xml)
  136.   end
  137. end
  138. addEvent("saveXML",true)
  139. addEventHandler("saveXML",getRootElement(),saveXML)
  140. -- LOGIN PANEL/REGISTER PANEL --
  141. function redirectPanel()
  142.     if (source == registerLabel) then
  143.             if (guiGetVisible (loginWindow) == true ) then
  144.                     guiSetVisible (loginWindow,false)
  145.                         guiSetVisible (registerWindow,true)
  146.                 end
  147.         end
  148.         if (source == loginRLabel) then
  149.             if (guiGetVisible (registerWindow) == true ) then
  150.                 guiSetVisible (registerWindow,false)
  151.                     guiSetVisible (loginWindow,true)
  152.                 end
  153.         end
  154. end
  155.  addEventHandler ("onClientGUIClick",getRootElement(),redirectPanel)
  156. -- REGISTER --
  157. function register()
  158.     if (source == registerRLabel) then
  159.             local username = guiGetText(usernameREdit)
  160.         local password = guiGetText (passwordREdit)
  161.                 if (guiGetText(usernameREdit) ~= "") and (guiGetText(passwordREdit) ~= "") and (guiGetText(passwordREdit) == guiGetText(passwordCREdit)) then
  162.                 triggerServerEvent("registerPlayer",getLocalPlayer(),getLocalPlayer(),username,password)
  163.                 elseif (guiGetText(usernameREdit) == "") then
  164.                     outputNotification ("Geçersiz kullanıcı adı.",3)
  165.                 elseif (guiGetText(passwordREdit) == "") or (guiGetText(passwordCREdit) == "") or (guiGetText(passwordREdit) ~= guiGetText(passwordCREdit)) then
  166.                     outputNotification ("Geçersiz şifre.",3)
  167.                 end
  168.         end
  169. end
  170.  addEventHandler ("onClientGUIClick",getRootElement(),register)
  171. -- WRONG USERNAME OR PASSWORD --
  172. function wrongAccount()
  173.     outputNotification ("Kullanıcı adı veya şifre yanlış..",3)
  174. end
  175.  addEvent ("wrongAccount",true)
  176.  addEventHandler ("wrongAccount",getRootElement(),wrongAccount)
  177. -- SUCCESFULLY LOGGED IN --
  178. function succesAccount()
  179.     outputNotification ("Başarıyla giriş yapıldı.",1)
  180. end
  181.  addEvent ("successfullyLogin",true)
  182.  addEventHandler ("successfullyLogin",getRootElement(),succesAccount)
  183. -- NOT REGISTER --
  184. function notRegister()
  185.     outputNotification ("Hesap bulunamadı, yeni bir hesap oluşturabilirsiniz!",3)
  186. end
  187.  addEvent ("notRegister",true)
  188.  addEventHandler ("notRegister",getRootElement(),notRegister)
  189. -- LOGIN --
  190. function login()
  191.     if (source == loginLabel) then
  192.             local username = guiGetText(usernameEdit)
  193.         local password = guiGetText(passwordEdit)
  194.                 if guiGetText(usernameEdit) ~= "" and guiGetText(passwordEdit) ~= "" then
  195.                     triggerServerEvent("loginPlayer",getLocalPlayer(),getLocalPlayer(),username,password)
  196.                 elseif guiGetText(usernameEdit) == "" and guiGetText(passwordEdit) == "" then
  197.                     outputNotification ("Geçersiz kullanıcı adı ve şifre",3)
  198.             elseif guiGetText(usernameEdit) == "" then
  199.                     outputNotification ("Geçersiz kullanıcı adı.",3)
  200.                 elseif guiGetText(passwordEdit) == "" then
  201.                     outputNotification ("Geçersiz şifre.",3)
  202.                 end
  203.         end
  204. end
  205.  addEventHandler ("onClientGUIClick",getRootElement(),login)
  206. -- CLOSE LOGIN PANEL --
  207. function cLoginPanel()
  208.     guiSetVisible (background,false)
  209.         showChat (true)
  210.         showPlayerHudComponent ("all", true)
  211.         showCursor (false)
  212.         if (sound) and (isElement(sound)) then
  213.                 destroyElement(sound)    
  214.         end            
  215. end
  216.  addEvent ("hideLoginPanel",true)
  217.  addEventHandler ("hideLoginPanel",getRootElement(),cLoginPanel)
  218.  -- CLOSE REGISTER PANEL --
  219. function cRegisterPanel()
  220.     guiSetVisible (background,false)
  221.         showChat (true)
  222.         showPlayerHudComponent ("all", true)
  223.         showCursor (false)
  224. end
  225.  addEvent ("hideRegisterPanel",true)
  226.  addEventHandler ("hideRegisterPanel",getRootElement(),cRegisterPanel)
  227.  
  228. local sound
  229. addEventHandler("onClientResourceStart", resourceRoot,    
  230. function()        
  231. sound = playSound("ses.mp3", false)        
  232. setSoundVolume(sound, 1.0)    
  233. end)
 

emreozkantr

  • Yeni Üye
  • *
  • Default Avatar
  • İleti: 7
Ynt: [YARDIM]Login Panele Müzik Eklemek
« Yanıtla #4 : 29 Eylül 2018, 18:23:04 »
olmadı :/
 

Paradox

  • Kurucu
  • *
  • İleti: 677
  • SH Gaming
Ynt: [YARDIM]Login Panele Müzik Eklemek
« Yanıtla #5 : 29 Eylül 2018, 18:29:19 »
Bunu dene olmaz ise server.lua'sını da at.

Kod: Lua
  1. -- GET SCREEN SIZE --
  2. local sX,sY = guiGetScreenSize()
  3. -- ABBREVIATIONS --
  4. lW, lH = 300,300
  5. -- LOGIN PANEL --
  6. function loginPanel()
  7.     showChat (false)
  8.         showPlayerHudComponent ("all", false)
  9.         showCursor (true)
  10.     -- BACKGROUND --
  11.         background = guiCreateStaticImage (0,0,sX,sY,"img/background.png",false)
  12.         -- LOGIN PANEL --
  13.         loginWindow = guiCreateWindow (sX/2-lW/2,sY/2-lH/2,lW,lH,"Kahraman Freeroam | Giriş Yap",false,background)
  14.             guiSetVisible (loginWindow,true)
  15.         loginHeaderText = guiCreateLabel (0.1,0.1,300,30,"",false,loginWindow)
  16.             guiLabelSetVerticalAlign (loginHeaderText,"center")
  17.             guiLabelSetHorizontalAlign (loginHeaderText,"center")
  18.                 guiSetFont (loginHeaderText,"default-bold-small")
  19.         usernameEdit = guiCreateEdit (20,52,260,35,"Kullanıcı Adı",false,loginWindow)
  20.             guiEditSetMaxLength (usernameEdit,21)
  21.         passwordEdit = guiCreateEdit (20,102,260,35,"Şifre",false,loginWindow)
  22.             guiEditSetMaxLength (passwordEdit,21)
  23.                 guiEditSetMasked (passwordEdit,true)
  24.         rememberCheckbox =  guiCreateCheckBox (lW-130,152,110,20,"Beni Hatırla",false,false,loginWindow)
  25.             guiSetFont (rememberCheckbox,"default-bold-small")
  26.         loginButton = guiCreateButton (20,187,260,40,"",false,loginWindow)
  27.             guiSetAlpha (loginButton,1)
  28.         loginLabel = guiCreateLabel (0,0,260,40,"Giriş Yap",false,loginButton)
  29.             guiLabelSetVerticalAlign (loginLabel,"center")
  30.             guiLabelSetHorizontalAlign (loginLabel,"center")
  31.                 guiSetFont (loginLabel,"default-bold-small")
  32.         registerButton = guiCreateButton (20,242,260,40,"",false,loginWindow)
  33.         registerLabel = guiCreateLabel (0,0,260,40,"Kayıt Ol",false,registerButton)
  34.             guiLabelSetVerticalAlign (registerLabel,"center")
  35.             guiLabelSetHorizontalAlign (registerLabel,"center")
  36.                 guiSetFont (registerLabel,"default-bold-small")
  37.         -- REGISTER PANEL --
  38.         registerWindow = guiCreateWindow (sX/2-lW/2,sY/2-lH/2,lW,lH,"Kahraman Freeroam | Kayıt Ol",false,background)
  39.             guiSetVisible (registerWindow,false)
  40.         registerHeaderText = guiCreateLabel (0.1,0.1,300,30,"",false,registerWindow)
  41.             guiLabelSetVerticalAlign (registerHeaderText,"center")
  42.             guiLabelSetHorizontalAlign (registerHeaderText,"center")
  43.                 guiSetFont (registerHeaderText,"default-bold-small")
  44.         usernameText = guiCreateLabel (20,42,80,35,"Kullanıcı Adı",false,registerWindow)
  45.             guiEditSetReadOnly (usernameText,true)
  46.                 guiSetFont (usernameText,"default-bold-small")
  47.         usernameREdit = guiCreateEdit (105,42,175,35,"",false,registerWindow)
  48.             guiEditSetMaxLength (usernameREdit,21)
  49.         passwordText = guiCreateLabel (20,92,80,35,"Şifre",false,registerWindow)
  50.             guiEditSetReadOnly (passwordText,true)
  51.                 guiSetFont (passwordText,"default-bold-small")
  52.         passwordREdit = guiCreateEdit (105,92,175,35,"",false,registerWindow)
  53.             guiEditSetMaxLength (passwordREdit,21)
  54.                 guiEditSetMasked (passwordREdit,true)
  55.         passwordCText = guiCreateLabel (20,142,80,35,"Tekrar Şifre",false,registerWindow)
  56.             guiEditSetReadOnly (passwordCText,true)
  57.                 guiSetFont (passwordCText,"default-bold-small")
  58.         passwordCREdit = guiCreateEdit (105,142,175,35,"",false,registerWindow)
  59.             guiEditSetMaxLength (passwordCREdit,21)
  60.                 guiEditSetMasked (passwordCREdit,true)
  61.         registerRButton = guiCreateButton (20,192,260,40,"",false,registerWindow)
  62.         registerRLabel = guiCreateLabel (0,0,260,40,"Kayıt Ol",false,registerRButton)
  63.             guiLabelSetVerticalAlign (registerRLabel,"center")
  64.             guiLabelSetHorizontalAlign (registerRLabel,"center")
  65.                 guiSetFont (registerRLabel,"default-bold-small")
  66.         loginRButton = guiCreateButton (20,247,260,40,"",false,registerWindow)
  67.         loginRLabel = guiCreateLabel (0,0,260,40,"Giriş Yap",false,loginRButton)
  68.             guiLabelSetVerticalAlign (loginRLabel,"center")
  69.             guiLabelSetHorizontalAlign (loginRLabel,"center")
  70.                 guiSetFont (loginRLabel,"default-bold-small")
  71.         -- REMEMBER PLAYER ACCOUNT --
  72.         xml = xmlLoadFile("userdata.xml")
  73.     loadXML()
  74. end
  75.  addEventHandler ("onClientResourceStart",resourceRoot,loginPanel)
  76. -- HOVER BUTTON --
  77. addEventHandler ("onClientMouseEnter",root,
  78. function()
  79.     if source == loginLabel then
  80.             guiStaticImageLoadImage ( loginButton, "img/hoverButton.png" )
  81.         elseif source == registerLabel then
  82.                 guiStaticImageLoadImage ( registerButton, "img/hoverButton.png" )
  83.         elseif source == loginRLabel then
  84.                 guiStaticImageLoadImage ( loginRButton, "img/hoverButton.png" )
  85.         elseif source == registerRLabel then
  86.                 guiStaticImageLoadImage ( registerRButton, "img/hoverButton.png" )
  87.         end
  88. end
  89. )
  90. -- BUTTON --
  91. addEventHandler ("onClientMouseLeave",root,
  92. function()
  93.     if source == loginLabel then
  94.             guiStaticImageLoadImage ( loginButton, "img/button.png" )
  95.         elseif source == registerLabel then
  96.                 guiStaticImageLoadImage ( registerButton, "img/button.png" )
  97.         elseif source == loginRLabel then
  98.                 guiStaticImageLoadImage ( loginRButton, "img/button.png" )
  99.         elseif source == registerRLabel then
  100.                 guiStaticImageLoadImage ( registerRButton, "img/button.png" )
  101.         end
  102. end
  103. )
  104. -- REMEMBER PLAYER ACCOUNT --
  105. function loadXML()
  106.   if not xml then
  107.     xml = xmlCreateFile("userdata.xml","userdata")
  108.     usernameChild = xmlCreateChild(xml,"username")
  109.     passwordChild = xmlCreateChild(xml,"password")
  110.     checkboxChild = xmlCreateChild(xml,"state")
  111.     xmlSaveFile(xml)
  112.   else
  113.     usernameChild = xmlFindChild(xml,"username",0)
  114.     passwordChild = xmlFindChild(xml,"password",0)
  115.     checkboxChild = xmlFindChild(xml,"state",0)
  116.   end
  117.     usernameLoad = xmlNodeGetValue(usernameChild)
  118.     passwordLoad = xmlNodeGetValue(passwordChild)
  119.     guiSetText (usernameEdit,usernameLoad)
  120.     guiSetText (passwordEdit,passwordLoad)
  121.         if xmlNodeGetValue(checkboxChild) then
  122.             guiCheckBoxSetSelected (rememberCheckbox,true)
  123.         end
  124. end
  125. function saveXML(username,password,checkboxState)
  126.   if guiCheckBoxGetSelected (rememberCheckbox) == true then
  127.     xmlNodeSetValue(usernameChild,username)
  128.     xmlNodeSetValue(passwordChild,password)
  129.     xmlNodeSetValue(checkboxChild,tostring(checkboxState))
  130.     xmlSaveFile(xml)
  131.   else
  132.     xmlNodeSetValue(usernameChild,"")
  133.     xmlNodeSetValue(passwordChild,"")
  134.     xmlNodeSetValue(checkboxChild,"")
  135.     xmlSaveFile(xml)
  136.   end
  137. end
  138. addEvent("saveXML",true)
  139. addEventHandler("saveXML",getRootElement(),saveXML)
  140. -- LOGIN PANEL/REGISTER PANEL --
  141. function redirectPanel()
  142.     if (source == registerLabel) then
  143.             if (guiGetVisible (loginWindow) == true ) then
  144.                     guiSetVisible (loginWindow,false)
  145.                         guiSetVisible (registerWindow,true)
  146.                 end
  147.         end
  148.         if (source == loginRLabel) then
  149.             if (guiGetVisible (registerWindow) == true ) then
  150.                 guiSetVisible (registerWindow,false)
  151.                     guiSetVisible (loginWindow,true)
  152.                 end
  153.         end
  154. end
  155.  addEventHandler ("onClientGUIClick",getRootElement(),redirectPanel)
  156. -- REGISTER --
  157. function register()
  158.     if (source == registerRLabel) then
  159.             local username = guiGetText(usernameREdit)
  160.         local password = guiGetText (passwordREdit)
  161.                 if (guiGetText(usernameREdit) ~= "") and (guiGetText(passwordREdit) ~= "") and (guiGetText(passwordREdit) == guiGetText(passwordCREdit)) then
  162.                 triggerServerEvent("registerPlayer",getLocalPlayer(),getLocalPlayer(),username,password)
  163.                 elseif (guiGetText(usernameREdit) == "") then
  164.                     outputNotification ("Geçersiz kullanıcı adı.",3)
  165.                 elseif (guiGetText(passwordREdit) == "") or (guiGetText(passwordCREdit) == "") or (guiGetText(passwordREdit) ~= guiGetText(passwordCREdit)) then
  166.                     outputNotification ("Geçersiz şifre.",3)
  167.                 end
  168.         end
  169. end
  170.  addEventHandler ("onClientGUIClick",getRootElement(),register)
  171. -- WRONG USERNAME OR PASSWORD --
  172. function wrongAccount()
  173.     outputNotification ("Kullanıcı adı veya şifre yanlış..",3)
  174. end
  175.  addEvent ("wrongAccount",true)
  176.  addEventHandler ("wrongAccount",getRootElement(),wrongAccount)
  177. -- SUCCESFULLY LOGGED IN --
  178. function succesAccount()
  179.     outputNotification ("Başarıyla giriş yapıldı.",1)
  180.     stopSound(sound)            
  181. end
  182.  addEvent ("successfullyLogin",true)
  183.  addEventHandler ("successfullyLogin",getRootElement(),succesAccount)
  184. -- NOT REGISTER --
  185. function notRegister()
  186.     outputNotification ("Hesap bulunamadı, yeni bir hesap oluşturabilirsiniz!",3)
  187. end
  188.  addEvent ("notRegister",true)
  189.  addEventHandler ("notRegister",getRootElement(),notRegister)
  190. -- LOGIN --
  191. function login()
  192.     if (source == loginLabel) then
  193.             local username = guiGetText(usernameEdit)
  194.         local password = guiGetText(passwordEdit)
  195.                 if guiGetText(usernameEdit) ~= "" and guiGetText(passwordEdit) ~= "" then
  196.                     triggerServerEvent("loginPlayer",getLocalPlayer(),getLocalPlayer(),username,password)
  197.                 elseif guiGetText(usernameEdit) == "" and guiGetText(passwordEdit) == "" then
  198.                     outputNotification ("Geçersiz kullanıcı adı ve şifre",3)
  199.             elseif guiGetText(usernameEdit) == "" then
  200.                     outputNotification ("Geçersiz kullanıcı adı.",3)
  201.                 elseif guiGetText(passwordEdit) == "" then
  202.                     outputNotification ("Geçersiz şifre.",3)
  203.                 end
  204.         end
  205. end
  206.  addEventHandler ("onClientGUIClick",getRootElement(),login)
  207. -- CLOSE LOGIN PANEL --
  208. function cLoginPanel()
  209.     guiSetVisible (background,false)
  210.         showChat (true)
  211.         showPlayerHudComponent ("all", true)
  212.         showCursor (false)      
  213. end
  214.  addEvent ("hideLoginPanel",true)
  215.  addEventHandler ("hideLoginPanel",getRootElement(),cLoginPanel)
  216.  -- CLOSE REGISTER PANEL --
  217. function cRegisterPanel()
  218.     guiSetVisible (background,false)
  219.         showChat (true)
  220.         showPlayerHudComponent ("all", true)
  221.         showCursor (false)
  222. end
  223.  addEvent ("hideRegisterPanel",true)
  224.  addEventHandler ("hideRegisterPanel",getRootElement(),cRegisterPanel)
  225.  
  226. local sound
  227. addEventHandler("onClientResourceStart", resourceRoot,    
  228. function()        
  229. sound = playSound("ses.mp3", false)        
  230. setSoundVolume(sound, 1.0)    
  231. end)
« Son Düzenleme: 29 Eylül 2018, 22:18:28 Gönderen: Paradox »
 

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

Ynt: [YARDIM]Login Panele Müzik Eklemek
« Yanıtla #5 : 29 Eylül 2018, 18:29:19 »

emreozkantr

  • Yeni Üye
  • *
  • Default Avatar
  • İleti: 7
Ynt: [YARDIM]Login Panele Müzik Eklemek
« Yanıtla #6 : 29 Eylül 2018, 21:59:28 »
Yine olmadı Linkleri Görebilmek İçin Kayıt Olun veya Giriş Yapın
Kod: Lua
  1. -- ADD EVENT --
  2. addEvent ("registerPlayer",true)
  3. addEvent ("loginPlayer",true)
  4. -- REGISTER --
  5. function onRegister(player,username,password)
  6.     account = addAccount(username,password)
  7.         if (account) then
  8.             outputChatBox ("#FFA800[FFS] #C1C1C1You have successfully registered! Username: #FFA800"..username.." #C1C1C1Password: #FFA800"..password.."#C1C1C1.",player,255,255,255,true)
  9.                 local account = getAccount(username,password)
  10.                 if (account) then
  11.                     logIn (player,account,password)
  12.                         triggerClientEvent(player,"successfullyLogin",player)
  13.                 else
  14.                     triggerClientEvent(player,"notRegister",player)
  15.                 end
  16.                 triggerClientEvent(player,"hideRegisterPanel",player)
  17.         end
  18. end
  19.  addEventHandler ("registerPlayer",root,onRegister)
  20. -- LOGIN --
  21. function onLogin(player,username,password,checkboxState)
  22.     local account = getAccount(username,password)
  23.         if (account) then
  24.             logIn (player,account,password)
  25.                 triggerClientEvent(player,"successfullyLogin",player)
  26.                 triggerClientEvent(player,"hideLoginPanel",player)
  27.                 triggerClientEvent(player,"saveXML",getRootElement(),username,password,tostring(checkboxState))
  28.         else
  29.             triggerClientEvent(player,"wrongAccount",player)
  30.         end
  31. end
  32.  addEventHandler ("loginPlayer",root,onLogin)
 

Paradox

  • Kurucu
  • *
  • İleti: 677
  • SH Gaming
Ynt: [YARDIM]Login Panele Müzik Eklemek
« Yanıtla #7 : 29 Eylül 2018, 22:07:35 »
Bundan önceki iletimi güncelledim ordaki client.lua 'yı dene, muhtemelen çalışacaktır küçük bir hata yapmışım.  :)
 

emreozkantr

  • Yeni Üye
  • *
  • Default Avatar
  • İleti: 7
Ynt: [YARDIM]Login Panele Müzik Eklemek
« Yanıtla #8 : 30 Eylül 2018, 11:44:11 »
denedim de olmadı artık boşvermek lazım