System Vote Kick System with only 1 trigger!

Manix

Well-Known Member
Reaction score
29
Hey guys, I've created that vote-kick system for about 1 hour and it is simple as hell, all players must type -vote [number of player] and if all players exept the one that should be kicked have voted the player is kicked, here's the code and the map is attacked to the thread. :)

Code:
Vote Kick System
    Events
        Player - Player 1 (Red) types a chat message containing -vote  as A substring
        Player - Player 2 (Blue) types a chat message containing -vote  as A substring
        Player - Player 3 (Teal) types a chat message containing -vote  as A substring
        Player - Player 4 (Purple) types a chat message containing -vote  as A substring
        Player - Player 5 (Yellow) types a chat message containing -vote  as A substring
        Player - Player 6 (Orange) types a chat message containing -vote  as A substring
        Player - Player 7 (Green) types a chat message containing -vote  as A substring
        Player - Player 8 (Pink) types a chat message containing -vote  as A substring
        Player - Player 9 (Gray) types a chat message containing -vote  as A substring
        Player - Player 10 (Light Blue) types a chat message containing -vote  as A substring
        Player - Player 11 (Dark Green) types a chat message containing -vote  as A substring
        Player - Player 12 (Brown) types a chat message containing -vote  as A substring
    Conditions
    Actions
        Set All_Players = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to (-vote  + 1)
                VoteLimiter1[(Player number of (Triggering player))] Not equal to 2
            Then - Actions
                Set VoteLimiter1[(Player number of (Triggering player))] = 2
                Set VotesNeededForKick[1] = (VotesNeededForKick[1] + 1)
                Game - Display to All_Players the text: (Votes for  + ((Name of Player 1 (Red)) + ( to be kicked:  + (String(VotesNeededForKick[1])))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VotesNeededForKick[1] Greater than or equal to ((Number of players in All_Players) - 1)
                    Then - Actions
                        Game - Defeat Player 1 (Red) with the message: You were kicked !
                        Game - Display to All_Players the text: ((Name of Player 1 (Red)) +  has been kicked.)
                        Set VotesNeededForKick[1] = 0
                    Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VoteLimiter1[(Player number of (Triggering player))] Equal to 2
                    Then - Actions
                        Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to (-vote  + 2)
                VoteLimiter2[(Player number of (Triggering player))] Not equal to 2
            Then - Actions
                Set VoteLimiter2[(Player number of (Triggering player))] = 2
                Set VotesNeededForKick[2] = (VotesNeededForKick[2] + 1)
                Game - Display to All_Players the text: (Votes for  + ((Name of Player 2 (Blue)) + ( to be kicked:  + (String(VotesNeededForKick[2])))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VotesNeededForKick[2] Greater than or equal to ((Number of players in All_Players) - 1)
                    Then - Actions
                        Game - Defeat Player 2 (Blue) with the message: You were kicked !
                        Game - Display to All_Players the text: ((Name of Player 2 (Blue)) +  has been kicked.)
                        Set VotesNeededForKick[2] = 0
                    Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VoteLimiter2[(Player number of (Triggering player))] Equal to 2
                    Then - Actions
                        Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to (-vote  + 3)
                VoteLimiter3[(Player number of (Triggering player))] Not equal to 2
            Then - Actions
                Set VoteLimiter3[(Player number of (Triggering player))] = 2
                Set VotesNeededForKick[3] = (VotesNeededForKick[3] + 1)
                Game - Display to All_Players the text: (Votes for  + ((Name of Player 3 (Teal)) + ( to be kicked:  + (String(VotesNeededForKick[3])))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VotesNeededForKick[3] Greater than or equal to ((Number of players in All_Players) - 1)
                    Then - Actions
                        Game - Defeat Player 3 (Teal) with the message: You were kicked !
                        Game - Display to All_Players the text: ((Name of Player 3 (Teal)) +  has been kicked.)
                        Set VotesNeededForKick[3] = 0
                    Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VoteLimiter3[(Player number of (Triggering player))] Equal to 2
                    Then - Actions
                        Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to (-vote  + 4)
                VoteLimiter4[(Player number of (Triggering player))] Not equal to 2
            Then - Actions
                Set VoteLimiter4[(Player number of (Triggering player))] = 2
                Set VotesNeededForKick[4] = (VotesNeededForKick[4] + 1)
                Game - Display to All_Players the text: (Votes for  + ((Name of Player 4 (Purple)) + ( to be kicked:  + (String(VotesNeededForKick[4])))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VotesNeededForKick[4] Greater than or equal to ((Number of players in All_Players) - 1)
                    Then - Actions
                        Game - Defeat Player 4 (Purple) with the message: You were kicked !
                        Game - Display to All_Players the text: ((Name of Player 4 (Purple)) +  has been kicked.)
                        Set VotesNeededForKick[4] = 0
                    Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VoteLimiter4[(Player number of (Triggering player))] Equal to 2
                    Then - Actions
                        Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to (-vote  + 5)
                VoteLimiter5[(Player number of (Triggering player))] Not equal to 2
            Then - Actions
                Set VoteLimiter5[(Player number of (Triggering player))] = 2
                Set VotesNeededForKick[5] = (VotesNeededForKick[5] + 1)
                Game - Display to All_Players the text: (Votes for  + ((Name of Player 5 (Yellow)) + ( to be kicked:  + (String(VotesNeededForKick[5])))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VotesNeededForKick[5] Greater than or equal to ((Number of players in All_Players) - 1)
                    Then - Actions
                        Game - Defeat Player 5 (Yellow) with the message: You were kicked !
                        Game - Display to All_Players the text: ((Name of Player 5 (Yellow)) +  has been kicked.)
                        Set VotesNeededForKick[5] = 0
                    Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VoteLimiter5[(Player number of (Triggering player))] Equal to 2
                    Then - Actions
                        Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to (-vote  + 6)
                VoteLimiter6[(Player number of (Triggering player))] Not equal to 2
            Then - Actions
                Set VoteLimiter6[(Player number of (Triggering player))] = 2
                Set VotesNeededForKick[6] = (VotesNeededForKick[6] + 1)
                Game - Display to All_Players the text: (Votes for  + ((Name of Player 6 (Orange)) + ( to be kicked:  + (String(VotesNeededForKick[6])))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VotesNeededForKick[6] Greater than or equal to ((Number of players in All_Players) - 1)
                    Then - Actions
                        Game - Defeat Player 6 (Orange) with the message: You were kicked !
                        Game - Display to All_Players the text: ((Name of Player 6 (Orange)) +  has been kicked.)
                        Set VotesNeededForKick[6] = 0
                    Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VoteLimiter6[(Player number of (Triggering player))] Equal to 2
                    Then - Actions
                        Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to (-vote  + 7)
                VoteLimiter7[(Player number of (Triggering player))] Not equal to 2
            Then - Actions
                Set VoteLimiter7[(Player number of (Triggering player))] = 2
                Set VotesNeededForKick[7] = (VotesNeededForKick[7] + 1)
                Game - Display to All_Players the text: (Votes for  + ((Name of Player 7 (Green)) + ( to be kicked:  + (String(VotesNeededForKick[7])))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VotesNeededForKick[7] Greater than or equal to ((Number of players in All_Players) - 1)
                    Then - Actions
                        Game - Defeat Player 7 (Green) with the message: You were kicked !
                        Game - Display to All_Players the text: ((Name of Player 7 (Green)) +  has been kicked.)
                        Set VotesNeededForKick[7] = 0
                    Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VoteLimiter7[(Player number of (Triggering player))] Equal to 2
                    Then - Actions
                        Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to (-vote  + 8)
                VoteLimiter8[(Player number of (Triggering player))] Not equal to 2
            Then - Actions
                Set VoteLimiter8[(Player number of (Triggering player))] = 2
                Set VotesNeededForKick[8] = (VotesNeededForKick[8] + 1)
                Game - Display to All_Players the text: (Votes for  + ((Name of Player 8 (Pink)) + ( to be kicked:  + (String(VotesNeededForKick[8])))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VotesNeededForKick[8] Greater than or equal to ((Number of players in All_Players) - 1)
                    Then - Actions
                        Game - Defeat Player 8 (Pink) with the message: You were kicked !
                        Game - Display to All_Players the text: ((Name of Player 8 (Pink)) +  has been kicked.)
                        Set VotesNeededForKick[8] = 0
                    Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VoteLimiter8[(Player number of (Triggering player))] Equal to 2
                    Then - Actions
                        Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to (-vote  + 9)
                VoteLimiter9[(Player number of (Triggering player))] Not equal to 2
            Then - Actions
                Set VoteLimiter9[(Player number of (Triggering player))] = 2
                Set VotesNeededForKick[9] = (VotesNeededForKick[9] + 1)
                Game - Display to All_Players the text: (Votes for  + ((Name of Player 9 (Gray)) + ( to be kicked:  + (String(VotesNeededForKick[9])))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VotesNeededForKick[9] Greater than or equal to ((Number of players in All_Players) - 1)
                    Then - Actions
                        Game - Defeat Player 9 (Gray) with the message: You were kicked !
                        Game - Display to All_Players the text: ((Name of Player 9 (Gray)) +  has been kicked.)
                        Set VotesNeededForKick[9] = 0
                    Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VoteLimiter9[(Player number of (Triggering player))] Equal to 2
                    Then - Actions
                        Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to (-vote  + 10)
                VoteLimiter10[(Player number of (Triggering player))] Not equal to 2
            Then - Actions
                Set VoteLimiter10[(Player number of (Triggering player))] = 2
                Set VotesNeededForKick[10] = (VotesNeededForKick[10] + 1)
                Game - Display to All_Players the text: (Votes for  + ((Name of Player 10 (Light Blue)) + ( to be kicked:  + (String(VotesNeededForKick[10])))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VotesNeededForKick[10] Greater than or equal to ((Number of players in All_Players) - 1)
                    Then - Actions
                        Game - Defeat Player 10 (Light Blue) with the message: You were kicked !
                        Game - Display to All_Players the text: ((Name of Player 10 (Light Blue)) +  has been kicked.)
                        Set VotesNeededForKick[10] = 0
                    Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VoteLimiter10[(Player number of (Triggering player))] Equal to 2
                    Then - Actions
                        Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to (-vote  + 11)
                VoteLimiter11[(Player number of (Triggering player))] Not equal to 2
            Then - Actions
                Set VoteLimiter11[(Player number of (Triggering player))] = 2
                Set VotesNeededForKick[11] = (VotesNeededForKick[11] + 1)
                Game - Display to All_Players the text: (Votes for  + ((Name of Player 11 (Dark Green)) + ( to be kicked:  + (String(VotesNeededForKick[11])))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VotesNeededForKick[11] Greater than or equal to ((Number of players in All_Players) - 1)
                    Then - Actions
                        Game - Defeat Player 11 (Dark Green) with the message: You were kicked !
                        Game - Display to All_Players the text: ((Name of Player 11 (Dark Green)) +  has been kicked.)
                        Set VotesNeededForKick[11] = 0
                    Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VoteLimiter11[(Player number of (Triggering player))] Equal to 2
                    Then - Actions
                        Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to (-vote  + 12)
                VoteLimiter12[(Player number of (Triggering player))] Not equal to 2
            Then - Actions
                Set VoteLimiter12[(Player number of (Triggering player))] = 2
                Set VotesNeededForKick[12] = (VotesNeededForKick[12] + 1)
                Game - Display to All_Players the text: (Votes for  + ((Name of Player 12 (Brown)) + ( to be kicked:  + (String(VotesNeededForKick[12])))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VotesNeededForKick[12] Greater than or equal to ((Number of players in All_Players) - 1)
                    Then - Actions
                        Game - Defeat Player 12 (Brown) with the message: You were kicked !
                        Game - Display to All_Players the text: ((Name of Player 12 (Brown)) +  has been kicked.)
                        Set VotesNeededForKick[12] = 0
                    Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VoteLimiter12[(Player number of (Triggering player))] Equal to 2
                    Then - Actions
                        Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                    Else - Actions
        Custom script:   call DestroyForce( udg_All_Players ) //Player Group

Brief explanation: If you take a look at the code you shall probably ask yourself why did I create 12 variables called "VoteLimiter1-12" and they are all arrays, here's the answer - 12 variables with 12 arrays so every single player can vote for more than 1 player, otherwise, as an example - Player 1 types -vote 2, then if there is no "votelimiter2" if it was only 1 vote limiter it will not allow player 1 to vote for player 3 or 4 or whatever after he has voted for another player already.. Hope you understood me hehe :D


I'm expecting comments :p
 

Attachments

  • VoteKick System.w3x
    23.3 KB · Views: 193

Fluffball

Well-Known Member
Reaction score
35
Why can't you make a Boolean Array (Whether or not that player has already voted for that 1 player) and an Integer Array (That kicks when a player is above half of the total amount of players) Instead of 12 arrays?
 

Manix

Well-Known Member
Reaction score
29
I didn't understand you but "That kicks when a player is above half of the total amount of players" you can edit that in my system, you can set it to as much as you wish..
 

vypur85

Hibernate
Reaction score
803
This seems to be a shorter version. Not tested though:

Code:
Actions
    Set All_Players = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))
    For each (Integer A) from 1 to 12, do (Actions)
        Loop - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Entered chat string) Equal to (-vote  + (String((Integer A))))
                    ((Triggering player) is in VotedPlayer[(Integer A)]) Equal to False
                Then - Actions
                    Player Group - Add (Triggering player) to VotedPlayer[(Player number of (Player((Integer A))))]
                    Set VotesNeededForKick[(Integer A)] = (VotesNeededForKick[(Integer A)] + 1)
                    Game - Display to All_Players the text: (Votes for  + ((Name of (Player((Integer A)))) + ( to be kicked:  + (String(VotesNeededForKick[(Integer A)])))))
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            VotesNeededForKick[(Integer A)] Greater than or equal to ((Number of players in All_Players) - 1)
                        Then - Actions
                            Game - Defeat (Player((Integer A))) with the message: You were kicked !
                            Game - Display to All_Players the text: ((Name of (Player((Integer A)))) +  has been kicked.)
                            Set VotesNeededForKick[(Integer A)] = 0
                        Else - Actions
                Else - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            ((Triggering player) is in VotedPlayer[(Integer A)]) Equal to True
                        Then - Actions
                            Game - Display to (All players controlled by a ((Triggering player) controller) player) the text: You can NOT vote tw...
                        Else - Actions
    Custom script:   call DestroyForce( udg_All_Players ) //Player Group

VotedPlayer[X] is a Player Group variable. I just added this and removed your VoteLimit thing.
 

Manix

Well-Known Member
Reaction score
29
I don't really get integer A or B or whatever actions, but wouldn't that run 12 times ?
 

vypur85

Hibernate
Reaction score
803
> but wouldn't that run 12 times ?

Yeah. But there's a condition to check the entered chat string.

Code:
(Entered chat string) Equal to (-vote  + (String((Integer A))))

So, if you enter -vote1, the loop will run 12 times but only involve player[1] and not 2 to 12.

Not sure how to explain this. Just use your imagination with this example:

Code:
Actions
    For each (Integer A) from 1 to 1000000, do (Actions)
        Loop - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Integer A) Equal to 1
                Then - Actions
                    Game - Display to (All players) the text: Run
                Else - Actions

It loops 100000 times but only one game message will be displayed. Why?
 

Manix

Well-Known Member
Reaction score
29
Yeah i understood you =] but since i've done it the longer way there's no point to enshort it now (if there's a word like that lol xD) actually i prefer the longer way... I don't know why i think that the loops bug from time to time
 

dannyboydude

Ultra Cool Member
Reaction score
33
Code:
Actions
    For each (Integer A) from 1 to 1000000, do (Actions)
        Loop - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Integer A) Equal to 1
                Then - Actions
                    Game - Display to (All players) the text: Run
                Else - Actions

Your checking if its 1

not a different number so itl only display once.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top