Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Dialog = ImportPackage("dialogui")
- local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end
- local animationMenu
- local danceMenu
- local actionMenu
- local diversMenu
- AddEvent("OnTranslationReady", function()
- animationMenu = Dialog.create(_("animation_menu"), nil, _("dance"), _("action"), _("divers"), _("cancel"))
- danceMenu = Dialog.create(_("dance_menu"), nil, _("play"), _("cancel"))
- Dialog.addSelect(danceMenu, 1, _("dance_list"), 8)
- actionMenu = Dialog.create(_("action_menu"), nil, _("play"), _("cancel"))
- Dialog.addSelect(actionMenu, 1, _("action_list"), 8)
- diversMenu = Dialog.create(_("divers_menu"), nil, _("play"), _("cancel"))
- Dialog.addSelect(diversMenu, 1, _("divers_list"), 8)
- end)
- AddEvent("OnKeyPress", function(key)
- if key == "F7" then
- CallRemoteEvent("ServerAnimationMenu")
- end
- end)
- AddEvent("OnDialogSubmit", function(dialog, button, ...)
- local args = { ... }
- if dialog == animationMenu then
- if button == 1 then
- Dialog.show(danceMenu)
- end
- if button == 2 then
- Dialog.show(actionMenu)
- end
- if button == 3 then
- Dialog.show(diversMenu)
- end
- end
- if dialog == danceMenu then
- if button == 1 then
- if args[1] == "" then
- AddPlayerChat(_("select_animation"))
- else
- AddPlayerChat(args[1])
- CallRemoteEvent("PlayerSetDance", args[1])
- end
- end
- end
- if dialog == actionMenu then
- if button == 1 then
- if args[1] == "" then
- AddPlayerChat(_("select_animation"))
- else
- AddPlayerChat(args[1])
- CallRemoteEvent("PlayerSetAction", args[1])
- end
- end
- end
- if dialog == diversMenu then
- if button == 1 then
- if args[1] == "" then
- AddPlayerChat(_("select_animation"))
- else
- AddPlayerChat(args[1])
- CallRemoteEvent("PlayerSetDivers", args[1])
- end
- end
- end
- end)
- AddRemoteEvent("OpenAnimationMenu", function( danceIds, actionIds, diversIds, playersIds)
- local danceList = {}
- for k,v in pairs(danceIds) do
- danceList[k] = _(k)
- end
- Dialog.setSelectLabeledOptions(danceMenu, 1, 1, danceList)
- local actionList = {}
- for k,v in pairs(actionIds) do
- actionList[k] = _(k)
- end
- Dialog.setSelectLabeledOptions(actionMenu, 1, 1, actionList)
- local diversList = {}
- for k,v in pairs(diversIds) do
- diversList[k] = _(k)
- end
- Dialog.setSelectLabeledOptions(diversMenu, 1, 1, diversList)
- Dialog.show(animationMenu)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement