• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] VoteKickSystem

Status
Not open for further replies.
Level 1
Joined
Jun 13, 2010
Messages
5
Hi. I just want to post a votekick system i made last day

What you need:

Triggers:
Votekicksystem
VotekickChoice
VotekickDialogWatch
VotekickTimerWatch
Initialisation
RandomNamedTrigger

Variables:
KickVoteButtons[12] Type: Dialog Button
KickVoteCancelButton Type: Dialog Button
KickVoteDialog Type:Dialog
KickVoteHasVoted[12] Type: bool
KickVoteNo Type: Integer
KickVoteNoButton Type: Dialog Button
KickVotePlayerToKick Type: Player
KickVoteRunning Type: bool
KickVoteStartingPlayer Type: Player
KickVoteTimer Type: Timer
KickVoteTimerWindow Type: Timer Window
KickVoteVoteDialog Type: Dialog
KickVoteYes Type: Integer
KickVoteYesButton Type: Dialog Button
IngamePlayers_PlayerGroup



First Trigger Named Votekicksystem
  • Events
    • Player - Player 1 (Red) types a chat message containing -votekick as An exact match
    • Player - Player 2 (Blue) types a chat message containing -votekick as An exact match
    • Player - Player 3 (Teal) types a chat message containing -votekick as An exact match
    • Player - Player 4 (Purple) types a chat message containing -votekick as An exact match
    • Player - Player 5 (Yellow) types a chat message containing -votekick as An exact match
    • Player - Player 6 (Orange) types a chat message containing -votekick as An exact match
    • Player - Player 7 (Green) types a chat message containing -votekick as An exact match
    • Player - Player 8 (Pink) types a chat message containing -votekick as An exact match
  • Conditions
    • KickVoteRuning Equal to False
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of players in IngamePlayers_PlayerGroup) Less than or equal to 2
      • Then - Actions
        • Game - Display to (Player group((Triggering player))) the text: You need at least 3...
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • KickVoteRuning Equal to True
      • Then - Actions
        • Game - Display to (Player group((Triggering player))) the text: A player has alread...
      • Else - Actions
        • Set KickVoteRuning = True
    • Set KickVoteStartingPlayer = (Triggering player)
    • Dialog - Clear KickVoteDialog
    • Dialog - Change the title of KickVoteDialog to Which player to kic...
    • Player Group - Pick every player in IngamePlayers_PlayerGroup and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Picked player) Not equal to KickVoteStartingPlayer
          • Then - Actions
            • Dialog - Create a dialog button for KickVoteDialog labelled (Name of (Player((Player number of (Picked player)))))
            • Set KickVoteButtons[(Player number of (Picked player))] = (Last created dialog Button)
          • Else - Actions
    • Dialog - Create a dialog button for KickVoteDialog labelled Cancel
    • Set KickVoteCancelButton = (Last created dialog Button)
    • Dialog - Show KickVoteDialog for (Triggering player)
    • Trigger - Turn on VotekickChoice <gen>
Secound Trigger named VotekickChoice
  • Events
    • Dialog - A dialog button is clicked for KickVoteDialog
  • Conditions
  • Actions
    • Dialog - Hide KickVoteDialog for KickVoteStartingPlayer
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • KickVoteCancelButton Equal to (Clicked dialog button)
      • Then - Actions
        • Set KickVoteRuning = False
        • Trigger - Turn off (This trigger)
        • Skip remaining actions
      • Else - Actions
    • Player Group - Pick every player in IngamePlayers_PlayerGroup and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Clicked dialog button) Equal to KickVoteButtons[(Player number of (Picked player))]
          • Then - Actions
            • Set KickVotePlayerToKick = (Picked player)
          • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • KickVotePlayerToKick Equal to Player 1 (Red)
      • Then - Actions
        • Game - Display to (Player group(KickVoteStartingPlayer)) the text: You can not kick th...
        • Set KickVoteRuning = False
        • Trigger - Turn off (This trigger)
        • Skip remaining actions
      • Else - Actions
    • Dialog - Clear KickVoteVoteDialog
    • Dialog - Change the title of KickVoteVoteDialog to (((Name of KickVoteStartingPlayer) + want's to kick ) + (Name of KickVotePlayerToKick))
    • Dialog - Create a dialog button for KickVoteVoteDialog labelled Yes
    • Set KickVoteYesButton = (Last created dialog Button)
    • Dialog - Create a dialog button for KickVoteVoteDialog labelled No
    • Set KickVoteNoButton = (Last created dialog Button)
    • Countdown Timer - Start KickVoteTimer as a One-shot timer that will expire in 30.00 seconds
    • Set KickVoteTimer = (Last started timer)
    • Countdown Timer - Create a timer window for (Last started timer) with title Vote expires in:
    • Set KickVoteTimerWindow = (Last created timer window)
    • Player Group - Pick every player in IngamePlayers_PlayerGroup and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Picked player) Not equal to KickVotePlayerToKick
          • Then - Actions
            • Countdown Timer - Show KickVoteTimerWindow for (Picked player)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Picked player) Not equal to KickVoteStartingPlayer
              • Then - Actions
                • Dialog - Show KickVoteVoteDialog for (Picked player)
              • Else - Actions
                • Set KickVoteHasVoted[(Player number of (Picked player))] = True
          • Else - Actions
            • Set KickVoteHasVoted[(Player number of (Picked player))] = True
    • Set KickVoteYes = 1
    • Set KickVoteNo = 1
    • Trigger - Turn on VotekickDialogWatch <gen>
Third trigger named VotekickDialogWatch

  • Events
    • Dialog - A dialog button is clicked for KickVoteVoteDialog
  • Conditions
    • KickVoteHasVoted[(Player number of (Triggering player))] Equal to False
  • Actions
    • Set KickVoteHasVoted[(Player number of (Triggering player))] = True
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Clicked dialog button) Equal to KickVoteYesButton
      • Then - Actions
        • Set KickVoteYes = (KickVoteYes + 1)
      • Else - Actions
        • Set KickVoteNo = (KickVoteNo + 1)
    • Dialog - Hide KickVoteVoteDialog for (Triggering player)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (KickVoteNo + KickVoteYes) Greater than or equal to (Number of players in IngamePlayers_PlayerGroup)
      • Then - Actions
        • Trigger - Run VotekickTimerWatch <gen> (checking conditions)
      • Else - Actions
Fourth trigger named VotekickTimerWatch
  • Events
    • Time - KickVoteTimer expires
  • Conditions
    • KickVoteRuning Equal to True
  • Actions
    • Countdown Timer - Destroy KickVoteTimerWindow
    • Countdown Timer - Pause KickVoteTimer
    • Player Group - Pick every player in IngamePlayers_PlayerGroup and do (Dialog - Hide KickVoteVoteDialog for (Picked player))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (((Real((Number of players in IngamePlayers_PlayerGroup))) / 100.00) x 60.00) Less than or equal to (Real(KickVoteYes))
      • Then - Actions
        • Game - Defeat KickVotePlayerToKick with the message: You've been kicked
        • Game - Display to (All players) the text: Votekick Succes
        • Player Group - Remove KickVotePlayerToKick from IngamePlayers_PlayerGroup
      • Else - Actions
        • Player Group - Pick every player in IngamePlayers_PlayerGroup and do (Game - Display to (Player group((Picked player))) the text: Kickvote failed!)
5. trigger any name
  • Events
    • Player - Player 1 (Red) leaves the game
    • Player - Player 2 (Blue) leaves the game
    • Player - Player 3 (Teal) leaves the game
    • Player - Player 4 (Purple) leaves the game
    • Player - Player 5 (Yellow) leaves the game
    • Player - Player 6 (Orange) leaves the game
    • Player - Player 7 (Green) leaves the game
    • Player - Player 8 (Pink) leaves the game
  • Conditions
  • Actions
    • Game - Display to (All players) for 15.00 seconds the text: ((PlayerColor_String[(Player number of (Triggering player))] + (Name of (Triggering player))) + |r has left the game.)
    • Player Group - Remove (Triggering player) from IngamePlayers_PlayerGroup
Initialistation:
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Player Group - Pick every player in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing))) and do (Actions)
      • Loop - Actions
        • Player Group - Add (Picked player) to IngamePlayers_PlayerGroup
Test map soon
 
Status
Not open for further replies.
Top