mirror of
https://github.com/Resxt/Plutonium-IW5-Scripts.git
synced 2025-04-19 20:52:54 +00:00
actions_on_button_press 1.2
Changed votes required. Now requires more than 50% of the players: 1/1 | 2/2 | 3/4 | 3/5 | 4/6 etc. instead of all players
This commit is contained in:
parent
d05d242a44
commit
45b5cfc69a
@ -33,5 +33,6 @@ The player dies when pressing the button
|
|||||||
## camera_switch_vote_on_button_press.gsc
|
## camera_switch_vote_on_button_press.gsc
|
||||||
|
|
||||||
Allows the players to toggle their vote to change the `camera_thirdPerson` dvar on the server (players vote no by default)
|
Allows the players to toggle their vote to change the `camera_thirdPerson` dvar on the server (players vote no by default)
|
||||||
When everyone votes yes the server changes the dvar and resets the vote counts.
|
When enough players vote yes the server changes the dvar and resets the vote counts.
|
||||||
|
The amount of votes required is more than 50% of the players: 1/1 | 2/2 | 3/4 | 3/5 | 4/6 etc.
|
||||||
Bots are ignored for the votes.
|
Bots are ignored for the votes.
|
||||||
|
@ -94,9 +94,21 @@ DisplayVoteCount()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
level.camera_switch_vote_count_text setText("^1Votes to switch camera: " + yes_votes + "/" + human_players.size);
|
votes_required = 0;
|
||||||
|
|
||||||
if (yes_votes == human_players.size && human_players.size > 0)
|
// Votes required = more than 50% of the players: 1/1 | 2/2 | 3/4 | 3/5 | 4/6 etc.
|
||||||
|
if (human_players.size % 2 == 1)
|
||||||
|
{
|
||||||
|
votes_required = (human_players.size / 2 + 0.5);
|
||||||
|
}
|
||||||
|
else if (human_players.size % 2 == 0)
|
||||||
|
{
|
||||||
|
votes_required = (human_players.size / 2 + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
level.camera_switch_vote_count_text setText("^1Votes to switch camera: " + yes_votes + "/" + votes_required);
|
||||||
|
|
||||||
|
if (yes_votes >= votes_required && human_players.size > 0)
|
||||||
{
|
{
|
||||||
// Logic here
|
// Logic here
|
||||||
setDvar( "camera_thirdPerson", !getDvarInt( "camera_thirdPerson" ) );
|
setDvar( "camera_thirdPerson", !getDvarInt( "camera_thirdPerson" ) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user