Easilly done with triggers however it is not always reliable, and may return the wrong person if the host is on a LAN network with another player or if the host has a too slow computer.
You use get local player to get the value of the player's PC when they run that action and imediatly sync it, the person who syncs first is the host. Search for the JASS functions, there have been countless made that do it semi reliably.