Advertisement
Guest User

Untitled

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