Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | None | 0 0
  1. function update_players_here(event)
  2.     if not gmcp.Room then return end
  3.     if not players_here then players_here = {} end
  4.     if not players_heref then players_heref = {} end
  5.     if event == "gmcp.Room.Players" then
  6.         players_here = {}
  7.         for i,v in pairs(gmcp.Room.Players) do
  8.             if v.name ~= gmcp.Char.Name.name then
  9.                 table.insert(players_here, v.name)
  10.             end
  11.         end
  12.  
  13.     elseif event == "gmcp.Room.AddPlayer" then
  14.         if not table.contains(players_here, gmcp.Room.AddPlayer.name) then
  15.             table.insert(players_here, gmcp.Room.AddPlayer.name)
  16.         end
  17.     else
  18.  
  19.         for i,v in pairs(players_here) do
  20.             if v == gmcp.Room.RemovePlayer then
  21.                 table.remove(players_here, i)
  22.             end
  23.         end
  24.     end
  25.     players_heref = table.deepcopy(players_here)
  26.     if #players_heref ~= 0 then
  27.         for k,v in ipairs(players_heref) do
  28.             if not v:find("<") then
  29.                 players_heref[k] = "<" .. ndb.getcolorp(v) .. ">" .. v
  30.             end
  31.         end
  32.     end
  33.     agui_people_tracker:clear()
  34.     if #players_heref == 0 then
  35.         agui_people_tracker:cecho("<white>You are alone here.")
  36.     elseif #players_heref == 1 then
  37.         agui_people_tracker:cecho("<orange>"..#players_heref.."<white> other person here: ".. ndb.getcolorp(players_heref[1]) .. players_heref[1] .. "<white>.")
  38.     else
  39.         agui_people_tracker:cecho("<orange>"..#players_heref.."<white> others here: \n"..table.concat(players_heref, "<white>, ").."<white>.")
  40.     end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement