Get player by name
#2
You can't get a player due to multi-threading reasons. Use callbacks instead:
cRoot:Get():FindAndDoWithPlayer(PlayerName, 
   function(a_Player)
      if (a_Player:GetName() ~= PlayerName) then
         -- Callback is called for the player who matches the target playername the closest.
         return false
      end
      -- Do stuff with the player
   end
)

Or if you already have the world object/know in which world the player is:
World:DoWithPlayer(PlayerName,
   function(a_Player)
      -- Do stuff. No need to check username here
   end
)
Reply
Thanks given by:


Messages In This Thread
Get player by name - by JuliB - 01-08-2016, 02:40 AM
RE: Get player by name - by NiLSPACE - 01-08-2016, 02:48 AM
RE: Get player by name - by JuliB - 01-08-2016, 03:06 AM
RE: Get player by name - by NiLSPACE - 01-08-2016, 03:13 AM
RE: Get player by name - by JuliB - 01-08-2016, 03:25 AM
RE: Get player by name - by NiLSPACE - 01-08-2016, 03:35 AM
RE: Get player by name - by JuliB - 01-08-2016, 03:50 AM
RE: Get player by name - by xoft - 01-08-2016, 07:55 AM
RE: Get player by name - by NiLSPACE - 01-08-2016, 05:45 PM
RE: Get player by name - by xoft - 01-08-2016, 11:44 PM
RE: Get player by name - by NiLSPACE - 01-09-2016, 12:03 AM



Users browsing this thread: 2 Guest(s)