Advertisement
Guest User

client

a guest
Dec 14th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.70 KB | None | 0 0
  1. local Dialog = ImportPackage("dialogui")
  2. local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end
  3.  
  4. local animationMenu
  5. local danceMenu
  6. local actionMenu
  7. local diversMenu
  8.  
  9. AddEvent("OnTranslationReady", function()
  10.     animationMenu = Dialog.create(_("animation_menu"), nil, _("dance"), _("action"), _("divers"), _("cancel"))
  11.     danceMenu = Dialog.create(_("dance_menu"), nil, _("play"), _("cancel"))
  12.     Dialog.addSelect(danceMenu, 1, _("dance_list"), 8)
  13.     actionMenu = Dialog.create(_("action_menu"), nil, _("play"), _("cancel"))
  14.     Dialog.addSelect(actionMenu, 1, _("action_list"), 8)
  15.     diversMenu = Dialog.create(_("divers_menu"), nil, _("play"), _("cancel"))
  16.     Dialog.addSelect(diversMenu, 1, _("divers_list"), 8)
  17.     end)
  18.    
  19.     AddEvent("OnKeyPress", function(key)
  20.     if key == "F7" then
  21.         CallRemoteEvent("ServerAnimationMenu")
  22.     end
  23. end)
  24.  
  25. AddEvent("OnDialogSubmit", function(dialog, button, ...)
  26.     local args = { ... }
  27.  
  28.     if dialog == animationMenu then
  29.         if button == 1 then
  30.             Dialog.show(danceMenu)
  31.         end
  32.         if button == 2 then
  33.             Dialog.show(actionMenu)
  34.         end
  35.         if button == 3 then
  36.             Dialog.show(diversMenu)
  37.         end
  38.     end
  39.    
  40.     if dialog == danceMenu then
  41.         if button == 1 then
  42.             if args[1] == "" then
  43.                 AddPlayerChat(_("select_animation"))
  44.             else
  45.                 AddPlayerChat(args[1])
  46.                 CallRemoteEvent("PlayerSetDance", args[1])
  47.             end
  48.         end
  49.     end
  50.    
  51.     if dialog == actionMenu then
  52.         if button == 1 then
  53.             if args[1] == "" then
  54.                 AddPlayerChat(_("select_animation"))
  55.             else
  56.                 AddPlayerChat(args[1])
  57.                 CallRemoteEvent("PlayerSetAction", args[1])
  58.             end
  59.         end
  60.     end
  61.        
  62.     if dialog == diversMenu then
  63.         if button == 1 then
  64.             if args[1] == "" then
  65.                 AddPlayerChat(_("select_animation"))
  66.             else
  67.                 AddPlayerChat(args[1])
  68.                 CallRemoteEvent("PlayerSetDivers", args[1])
  69.             end
  70.         end
  71.     end
  72. end)
  73.  
  74. AddRemoteEvent("OpenAnimationMenu", function( danceIds, actionIds, diversIds, playersIds)
  75.  
  76.     local danceList = {}
  77.     for k,v in pairs(danceIds) do
  78.         danceList[k] = _(k)
  79.     end
  80.     Dialog.setSelectLabeledOptions(danceMenu, 1, 1, danceList)
  81.    
  82.     local actionList = {}
  83.     for k,v in pairs(actionIds) do
  84.         actionList[k] = _(k)
  85.     end
  86.     Dialog.setSelectLabeledOptions(actionMenu, 1, 1, actionList)
  87.  
  88.    
  89.     local diversList = {}
  90.     for k,v in pairs(diversIds) do
  91.         diversList[k] = _(k)
  92.     end
  93.     Dialog.setSelectLabeledOptions(diversMenu, 1, 1, diversList)
  94.    
  95.     Dialog.show(animationMenu)
  96. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement