I am trying to make a custom UI for a kicksystem. To get the number of votes needed I am looping over i from 2 - 23. I dont want to use the first 2 players, its map specific and these two slots are used by the computer. When I add a PlayerSlotState check in the trigger, the trigger stops working. I am trying to check if the player is a player and if the player is still in the game.
I am also open for improvements. The else is not updated yet.
JASS:
function StartVoteKick takes integer playerid returns nothing
local integer i = 2
set KickOngoing = true
set KickYesVotes = 1
set KickNoVotes = 1
set KickPlayer = Player(playerid)
set KickCountdownTimer = 21
loop
exitwhen i > 23
if (IsPlayerAlly(Player(i), KickPlayer) == true) and (GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING) and (GetPlayerController(Player(i)) == MAP_CONTROL_USER) then
set KickTeamAmount = KickTeamAmount + 1
else
// disable button for players in the enemy team
call DisableButton(Player(i))
endif
set i = i + 1
endloop
// Empire and the player that gets votekicked
set KickTeamAmount = KickTeamAmount - 2
call BlzFrameSetText(Playername, udg_player_color_string[i+1] + GetPlayerName(KickPlayer) + "|r")
call BlzFrameSetVisible(KickMenu, true)
call EnableTrigger(TriggerTimer)
endfunction
I am also open for improvements. The else is not updated yet.