GetLocalPlayer

async
This function is asynchronous. The values it returns are not guaranteed to be the same for each player. If you attempt to use it in an synchronous manner it may cause a desync.
comment

Returns reference to local player, as such it always points to yourself. Every other player in the game gets their player respectively.

Do not use this function until you understand it fully and know how to avoid desyncs! Always test your map in LAN multiplayer after changing code around it.

Warcraft 3 has the lock-step network/execution model. This means the game simulation and code run on all players' computers with the exact same data at any point in time. Look at this example (Lua):

function whoami_command()
    -- all players know who entered this command, equal value on every computer
    local player_who_entered_command = GetTriggerPlayer()
    -- this always points to you!
    local myself = GetLocalPlayer() 

    local command_player_name = GetPlayerName(player_who_entered_command)
    local my_player_name = GetPlayerName(myself)
    -- everybody will see this player's name
    DisplayTextToForce(GetPlayersAll(), "Player ".. command_player_name .." entered the whoami command!")
    -- everybody will see their own name!
    DisplayTextToForce(GetPlayersAll(), "But my name is: ".. my_player_name)
end

This function is always used when you want something only to happen to a certain player. However if you aren't careful, you will cause a desync: where one player's game state is different from everybody else! For example, you can apply camera position locally, this is how SetCameraPositionForPlayer works (Jass):

if (GetLocalPlayer() == whichPlayer) then
   // Use only local code (no net traffic) within this block to avoid desyncs.
   call SetCameraPosition(x, y)
endif

Basic rule: anything that's only visual (like unit color) will not desync... unless your code relies on the exact value later in the game: if cameraX is 123 then ... different players will have different camera positions here.

On the other hand, manipulating handles or creating units locally, changing their health, attack, invisibility etc. - anything that changes the game will desync:

if (GetLocalPlayer() == whichPlayer) then
   // INSTANTLY DESYNCS! The unit was only killed on one player's screen! Others think it's alive
   call KillUnit(someUnit)
endif
patch

1.00

return type
player
Source code
constant native GetLocalPlayer      takes nothing returns player
Source
common.j
wc3modding.com
GetLocalPlayer