Azlier
Old World Ghost
- Reaction score
- 461
Everybody loves the Player native, right? Well, this is faster. And it doesn't crash when you provide invalid integers. Also includes LocalPlayer, which is magic.
How magical.
How magical.
JASS:
library GetPlayer initializer Init
globals
private player array Players
private player theLocalPlayer
endglobals
constant function GetPlayer takes integer i returns player
return Players<i>
endfunction
constant function LocalPlayer takes nothing returns player
return theLocalPlayer
endfunction
private function Init takes nothing returns nothing
local integer i = 15
loop
exitwhen i < 0
set Players<i> = Player(i)
set i = i - 1
endloop
set theLocalPlayer = GetLocalPlayer()
endfunction
endlibrary
</i></i>