• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Player Count

Status
Not open for further replies.
Level 11
Joined
Sep 12, 2008
Messages
657
2 options - 1 = gui, 2 = vjass.

gui:

  • Count Players
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (((Picked player) controller) Equal to User) and (((Picked player) slot status) Equal to Is playing)
            • Then - Actions
              • Set AmountOfPlayers = (AmountOfPlayers + 1)
            • Else - Actions
vjass:

JASS:
function PlayerCount takes nothing returns nothing
    local integer AmountOfPlayers = 0
    local integer i = 0
    
    loop
    
    if GetPlayerSlotState(ConvertedPlayer((i))) == PLAYER_SLOT_STATE_PLAYING and ConvertedPlayer((i)) == MAP_CONTROL_USER then
        
        set AmountOfPlayers = AmountOfPlayers + 1
        
    endif
    
    set i = i + 1
    exitwhen i >= 11
    endloop
endfunction

edit:

  • Player Group - Pick every player in (All players matching (((Matching player) controller) Equal to User)) and do (Actions)
    • Loop - Actions
      • Set PlayerCount = ((PlayerCount)+1)
Hope it helps:)

that leaks.. sry.. ALL PLAYERS dont leak, but other then that.. its like a unit group, it leaks.
 
Level 7
Joined
Jun 8, 2010
Messages
283
How about the submenu? Go into the integer submenu you should scroll down on the functions list until you find something that says:

Game - Number of players

Not sure if this leaks though, havent tried it I just recently discovered it.
 
Status
Not open for further replies.
Top