List
#4
Use a global Lua table, and use it as a dictionary:
-- Initialize the array, this should be in a file outside of any functions
-- Maps UUID -> true for all players who are currently spying
g_SpyingPlayers = {}

-- Add a player:
g_SpyingPlayers[a_Player:GetUUID()] = true

-- Remove a player:
g_SpyingPlayers[a_Player:GetUUID()] = nil

-- Do something with all players:
for _, uuid in pairs(g_SpyingPlayers) do
  cRoot:Get():DoWithPlayerByUUID(uuid,
    function (a_CBPlayer)
      a_CBPlayer:SendMessage("You are spying")
    end
  )
end  -- for uuid - g_SpyingPlayers[]
Reply
Thanks given by:


Messages In This Thread
List - by Schwertspize - 11-29-2015, 09:58 PM
RE: List - by NiLSPACE - 11-29-2015, 10:02 PM
RE: List - by Schwertspize - 11-29-2015, 10:11 PM
RE: List - by xoft - 11-30-2015, 08:15 AM
RE: List - by Schwertspize - 11-30-2015, 04:46 PM



Users browsing this thread: 3 Guest(s)