Im making a map and there are various commands i want the host to be able to use, the problem is that i dont like the idea of assigning the commands the a colour rather than the actual host. so i was wondering if there was any way to find the host via jass. I do believe there was a topic somewhere here that would be able to help me with this but ive spent 3 hours searching with no success.
(extracted from wc3Jass, made origionally by Tennis )
//This function takes nothing and returns the host of the game.
function GetHost takes nothing returns player
//This stores the Id + 1 for each player.
call StoreInteger(GameCache(), "missionKey", "key", GetPlayerId(GetLocalPlayer()) + 1)
//Setup the TriggerSyncReady call.
call TriggerSyncStart()
//Sync the value of the entry for each player.
//Each value will sync to the value of the host.
call SyncStoredInteger(GameCache(), "missionKey", "key")
//Wait until the Game Cache syncs the key for everyone.
call TriggerSyncReady()
//Return the synced value as a player.
return Player(GetStoredInteger(GameCache(), "missionKey", "key") - 1)
endfunction