|
| 1 | +local players = {} |
| 2 | +local playerList = GetActivePlayers() |
| 3 | + |
| 4 | +for _, playerId in ipairs(playerList) do |
| 5 | + local playerName = GetPlayerName(playerId) |
| 6 | + table.insert(players, { |
| 7 | + label = playerName, |
| 8 | + value = playerId, |
| 9 | + icon = 'person', |
| 10 | + args = {id = GetPlayerServerId(playerId)} |
| 11 | + }) |
| 12 | + |
| 13 | +end |
| 14 | +lib.registerMenu({ |
| 15 | + id = 'zaps-rd-onlineplayers', |
| 16 | + title = 'Online Players', |
| 17 | + position = 'top-right', |
| 18 | + options = players |
| 19 | +}, function(selected, scrollIndex, args) |
| 20 | + |
| 21 | + lib.showMenu('zaps-rd-onlineplayers-options') |
| 22 | +end) |
| 23 | + lib.registerMenu({ |
| 24 | + id = 'zaps-rd-onlineplayers-options', |
| 25 | + title = 'Online Player Options', |
| 26 | + position = 'top-right', |
| 27 | + options = { |
| 28 | + {label = 'Kick Player', icon = 'k', args = {id = 'kick'}}, |
| 29 | + {label = 'Ban Player', icon = 'ban', args = {id = 'openselfoptions'}}, |
| 30 | + {label = 'Send Private Message', icon = 'message', args = {id = 'dm'}}, |
| 31 | + {label = 'Teleport To Player', icon = 'wand-magic', args = {id = 'tp'}}, |
| 32 | + |
| 33 | + } |
| 34 | + }, function(selected, scrollIndex, args) |
| 35 | + if args.id == 'dm' then |
| 36 | + privatemessage() |
| 37 | + elseif args.id == 'kick' then |
| 38 | +-- Might add ban also ??? |
| 39 | + |
| 40 | + end |
| 41 | + end) |
| 42 | + |
| 43 | + |
| 44 | +function privatemessage(messagecontents) |
| 45 | + local input = lib.inputDialog('Private Message', {'Message'}) |
| 46 | + |
| 47 | + if not input then return end |
| 48 | + input[1] = messagecontents |
| 49 | +-- Needs Finished |
| 50 | + |
| 51 | +end |
| 52 | + |
0 commit comments