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.
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
I'm expecting comments
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
I'm expecting comments