Lua GetClosestPlayer

From ArcEmu-Wiki
Jump to: navigation, search
+/-
Main Page        LuaArcEmu Website     ArcEmu Forum     Bug Tracker



Syntax

pPlayer = pUnit:GetClosestPlayer()


Description

Used when you want the unit to target the closest player in range. Target must be a player and is a unit-only command. It is recommended to add nil checks after registering this command.


Example

function OnEnterWorld(event, pPlayer)
  if(pPlayer:GetClosestPlayer() ~=nil ) then
    -- Do stuff here if another player was found
  end
end
RegisterServerHook(4, "OnEnterWorld")
Personal tools