mirror of
https://github.com/Resxt/Plutonium-T6-Scripts.git
synced 2025-04-20 05:55:43 +00:00
mapvote 2.0.0
Added support for zombies mode. Using the mapvote_maps dvar players can set a display name, the map name and the cfg name Added mapvote_limits_maps dvar Added mapvote_limits_modes dvar Added mapvote_limits_max dvar Users can now define maps and/or modes limits to have a precise amount of maps and/or modes on screen even if the available amount is above the max limit. The max limit is now 12 but can be lowered using a dvar Changed right click listener wait time from 0.35s to 0.25s for a better user experience Hide the map or mode when there's only one in the mapvote. It will still rotate to it but it's hidden so that the menu looks cleaner. The menu is centered accordingly Fixed the menu centering calculation, it's now really centered Removed the need to write map names in a certain way to work, users can now write map names the way they want
This commit is contained in:
parent
6e44160fc1
commit
ff3e41c419
@ -1,80 +1,124 @@
|
|||||||
# Mapvote
|
# Mapvote
|
||||||
|
|
||||||
A customizable mapvote script for multiplayer.
|
A customizable mapvote script for both multiplayer and zombies.
|
||||||
Zombies is not supported yet but is planned for the future.
|
|
||||||
|
|
||||||
Also note that this only works for dedicated servers.
|
Note that this only works for dedicated servers.
|
||||||
You can still run the script in a private match to get a preview of the colors and everything but it won't rotate to your chosen map/mode due a technical limitation.
|
You can still run the script in a private match to get a preview of the menu and configure it the way you like before using it on your server but it won't rotate to your chosen map/mode due to a technical limitation the game has.
|
||||||
|
|
||||||
This is heavily inspired by [LastDemon99's IW5 mapvote](https://github.com/LastDemon99/IW5_VoteSystem).
|
This is heavily inspired by [LastDemon99's IW5 mapvote](https://github.com/LastDemon99/IW5_VoteSystem).
|
||||||
I also re-used some code from [DoktorSAS T6 mapvote](https://github.com/DoktorSAS/PlutoniumT6Mapvote).
|
I also re-used some code from [DoktorSAS T6 mapvote](https://github.com/DoktorSAS/PlutoniumT6Mapvote).
|
||||||
Huge thanks to both of them.
|
Huge thanks to both of them.
|
||||||
|
|
||||||

|

|
||||||
*Mouse and keyboard input. Settings: default*
|
*Multiplayer mode. Mouse and keyboard input. Changed settings: limits modes: 3, horizontal spacing: 100,*
|
||||||
|
|
||||||

|

|
||||||
*Controller input. Settings: red colors, blur level: 5, horizontal spacing: 100, accent mode: max*
|
*Zombies mode. Controller input. Changed settings: red colors, accent mode: max*
|
||||||
|
|
||||||
## mapvote.gsc
|
## mapvote.gsc
|
||||||
|
|
||||||
This script can either be installed in the `scripts` folder or in the `scripts\mp` folder.
|
This script can be installed in any folder depending on what you want to do.
|
||||||
**IMPORTANT** Installing `mapvote_mp_extend.gsc` in `scripts\mp` is **mandatory** to make the mapvote work normally.
|
The recommended solution is to just install it in the `scripts` folder so that it will work out of the box for both mp and zm.
|
||||||
|
Since it's disabled by default it won't affect your servers or run unless you enable it so it's safe to have it in the `scripts` folder.
|
||||||
|
|
||||||
|
**[IMPORTANT]** Installing `mapvote_mp_extend.gsc` in `scripts\mp` is **mandatory** to make the mapvote work normally in multiplayer.
|
||||||
|
**[IMPORTANT]** Installing `mapvote_zm_extend.gsc` in `scripts\zm` is **mandatory** to make the mapvote work normally in zombies.
|
||||||
|
|
||||||
### Main features
|
### Main features
|
||||||
|
|
||||||
- It allows up to 6 maps and 4 modes to be displayed at once
|
- It allows up to 12 elements (maps + modes) to be displayed on screen
|
||||||
- It has separate map and mode choices
|
- You can configure how much maps and modes you want on screen
|
||||||
- It supports custom gamemode names and custom cfg
|
- It will automatically adapt the amount of elements to display if you don't choose a fixed amount of maps/modes to show
|
||||||
- It rotates a random map from the list when there are no votes for maps. Same applies for modes
|
- It has separate map and mode choices for multiplayer
|
||||||
|
- It supports custom CFG
|
||||||
|
- It supports custom gamemode names in multiplayer and custom map names in zombies
|
||||||
|
- It rotates a random map from the list when there are no votes for maps. Same applies for modes in multiplayer too
|
||||||
- Controllers are fully supported and work out of the box
|
- Controllers are fully supported and work out of the box
|
||||||
- It has a good level of customization
|
- It has a good level of customization
|
||||||
- It has a debug mode to quickly preview the menu
|
- It has a debug mode to quickly preview the menu and print some values in the console
|
||||||
|
|
||||||
### Getting started
|
### Getting started
|
||||||
|
|
||||||
By default the script is disabled to avoid running on all your servers.
|
By default the script is disabled to avoid running on all your servers.
|
||||||
Simply set `mapvote_enable` to 1 and the script will be loaded, which as a result will display the voting menu after the killcam.
|
Simply set `mapvote_enable` to 1 and the script will be loaded, which as a result will display the voting menu when the game ends (after the killcam in multiplayer and once every players are dead in zombies).
|
||||||
|
|
||||||
To configure the menu before putting it on your server I recommend running it in a custom game with the `mapvote_debug` dvar set to `1`.
|
To configure the menu before putting it on your server I recommend running it in a custom game with the `mapvote_debug` dvar set to `1`.
|
||||||
To do that use this command in the console `set mapvote_enable 1;set mapvote_debug 1` before running a custom game.
|
To do that use this command in the console `set mapvote_enable 1;set mapvote_debug 1` before running a custom game.
|
||||||
Start a custom game and pick any class and you will see the menu. Everything will work but map rotation which is normal.
|
Start a custom game and you will see the menu. Everything will work but map rotation which is normal.
|
||||||
You can then configure the dvars directly in your console and restart the map with `map_restart` in the console to edit the menu quickly and get your perfect setup.
|
You can then configure the dvars directly in your console and restart the map with `map_restart` in the console to edit the menu quickly and get your perfect setup.
|
||||||
|
|
||||||
### Dvars
|
### Dvars
|
||||||
|
|
||||||
Here are the dvars you can configure:
|
Here are the dvars you can configure:
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Multiplayer dvars</summary>
|
||||||
|
|
||||||
| Name | Description | Default value | Accepted values |
|
| Name | Description | Default value | Accepted values |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| mapvote_enable | Toggle whether the mapvote is activated or not. 0 is off and 1 is on | 0 | 0 or 1 |
|
| mapvote_enable | Toggle whether the mapvote is activated or not. 0 is off and 1 is on | 0 | 0 or 1 |
|
||||||
| mapvote_debug | Toggle whether the mapvote runs in debug mode or not. This will display the mapvote menu a few seconds after starting the game. 0 is off and 1 is on | 0 | 0 or 1 |
|
| mapvote_debug | Toggle whether the mapvote runs in debug mode or not. This will display the mapvote menu a few seconds after starting the game. 0 is off and 1 is on | 0 | 0 or 1 |
|
||||||
| mapvote_maps | A list of the maps that are available for rotation. Each map name needs to start with a capitalized letter and each map is separated with : | Every BO2 maps including DLC maps | Any map name, starting with a capitalized letter and separated with a colon (:) |
|
| mapvote_maps | A list of the maps that are available for rotation | Every maps including DLC maps | Any map name. Each map is separated with a colon (:) |
|
||||||
| mapvote_modes | A list of the modes that are available for rotation. The first parameter is how the mode will be displayed, it can be set to anything you like, the second parameter is the name of the cfg file to load found in the gamesettings folder | "Team Deathmatch,tdm:Domination,dom:Hardpoint,koth" | Any name you want followed by a comma (,) with the cfg name and separated with a colon (:) |
|
| mapvote_modes | A list of the modes that are available for rotation. The first parameter is how the mode will be displayed, it can be set to anything you like, the second parameter is the name of the cfg file to load | "Team Deathmatch,tdm:Domination,dom:Hardpoint,koth" | Any text followed by a comma (,) and then the cfg name. Each block is separated with a colon (:) |
|
||||||
| mapvote_colors_selected | The color of the text when hovered or selected. This is also the color of the votes count | "blue" | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
| mapvote_limits_maps | The amount of maps to display. 0 will handle it automatically | 0 | Any plain number from 0 to `mapvote_limits_max` |
|
||||||
| mapvote_colors_unselected | The color of the text when not hovered and not selected | "white" | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
| mapvote_limits_modes | The amount of modes to display. 0 will handle it automatically | 0 | Any plain number from 0 to `mapvote_limits_max` |
|
||||||
| mapvote_colors_timer | The color of the timer as long as it has more than 5 seconds remaining | "blue" | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
| mapvote_limits_max | The maximum amount of elements to display (maps + modes) | 12 | 2, 4, 6, 8, 10, 12 |
|
||||||
| mapvote_colors_timer_low | The color of the timer when it has 5 or less seconds remaining | "red" | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
| mapvote_colors_selected | The color of the text when hovered or selected. This is also the color of the votes count | blue | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
||||||
| mapvote_colors_help_text | The color of the help text at the bottom explaining how to use the menu | "white" | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
| mapvote_colors_unselected | The color of the text when not hovered and not selected | white | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
||||||
| mapvote_colors_help_accent | The color of the accented text of the help text at the bottom | "blue" | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
| mapvote_colors_timer | The color of the timer as long as it has more than 5 seconds remaining | blue | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
||||||
| mapvote_colors_help_accent_mode | The accenting mode for the help text. `standard` only puts the accent color on the button to press and `max` puts it on both the buttons and the action it does | "standard" | standard or max |
|
| mapvote_colors_timer_low | The color of the timer when it has 5 or less seconds remaining | red | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
||||||
|
| mapvote_colors_help_text | The color of the help text at the bottom explaining how to use the menu | white | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
||||||
|
| mapvote_colors_help_accent | The color of the accented text of the help text at the bottom | blue | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
||||||
|
| mapvote_colors_help_accent_mode | The accenting mode for the help text. `standard` only puts the accent color on the button to press and `max` puts it on both the buttons and the action it does | standard | standard or max |
|
||||||
| mapvote_sounds_menu_enabled | Toggle whether the mapvote menu sounds are enabled or not. 0 is off and 1 is on | 1 | 0 or 1 |
|
| mapvote_sounds_menu_enabled | Toggle whether the mapvote menu sounds are enabled or not. 0 is off and 1 is on | 1 | 0 or 1 |
|
||||||
| mapvote_sounds_timer_enabled | Toggle whether the timer will start making a beeping sound every second when there's 5 or less seconds remaining to vote or not. 0 is off and 1 is on | 1 | 0 or 1 |
|
| mapvote_sounds_timer_enabled | Toggle whether the timer will start making a beeping sound every second when there's 5 or less seconds remaining to vote or not. 0 is off and 1 is on | 1 | 0 or 1 |
|
||||||
| mapvote_vote_time | The time the vote lasts (in seconds) | 30 | Any plain number above 5 |
|
| mapvote_vote_time | The time the vote lasts (in seconds) | 30 | Any plain number above 5 |
|
||||||
| mapvote_blur_level | The amount of blur to put at the end of the killcam. The max recommended value is 5. 0 disables it | 2.5 | Any number |
|
| mapvote_blur_level | The amount of blur to put when the mapvote menu starts to show. The max recommended value is 5. 0 disables it | 2.5 | Any number |
|
||||||
| mapvote_blur_fade_in_time | The time (in seconds) it takes for the blur to reach `mapvote_blur_level`. For example if you set it to 10 and `mapvote_blur_level` is 5 then it will progressively blur the screen from 0 to 5 in 10 seconds | 2 | Any number |
|
| mapvote_blur_fade_in_time | The time (in seconds) it takes for the blur to reach `mapvote_blur_level`. For example if you set it to 10 and `mapvote_blur_level` is 5 then it will progressively blur the screen from 0 to 5 in 10 seconds | 2 | Any number |
|
||||||
| mapvote_horizontal_spacing | The horizontal spacing between the map/mode names on the left and the vote counts on the right. I recommend setting this value according to your map and modes length so that it doesn't overlap with the vote counts | 75 | Any plain number |
|
| mapvote_horizontal_spacing | The horizontal spacing between the map/mode names on the left and the vote counts on the right. I recommend setting this value according to the longest map or mode name length so that it doesn't overlap with the vote counts | 75 | Any plain number |
|
||||||
| mapvote_display_wait_time | Once the killcam ends, the time to wait before displaying the vote menu (in seconds) | 1 | 0.05 or above |
|
| mapvote_display_wait_time | Once the killcam ends, the time to wait before displaying the vote menu (in seconds) | 1 | Any number above 0.05 |
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Zombies dvars</summary>
|
||||||
|
|
||||||
|
| Name | Description | Default value | Accepted values |
|
||||||
|
|---|---|---|---|
|
||||||
|
| mapvote_enable | Toggle whether the mapvote is activated or not. 0 is off and 1 is on | 0 | 0 or 1 |
|
||||||
|
| mapvote_debug | Toggle whether the mapvote runs in debug mode or not. This will display the mapvote menu a few seconds after starting the game. 0 is off and 1 is on | 0 | 0 or 1 |
|
||||||
|
| mapvote_maps | A list of the maps that are available for rotation, including how you want to display it and which CFG to load | All survival/classic maps but Tranzit including DLC maps | Any text followed by a comma (,) with then the map name followed by a comma (,) and finally the CFG file name. Each block is separated with a colon (:) |
|
||||||
|
| mapvote_limits_max | The maximum amount of maps to display | 12 | Any plain number from 2 to 12 |
|
||||||
|
| mapvote_colors_selected | The color of the text when hovered or selected. This is also the color of the votes count | blue | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
||||||
|
| mapvote_colors_unselected | The color of the text when not hovered and not selected | white | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
||||||
|
| mapvote_colors_timer | The color of the timer as long as it has more than 5 seconds remaining | blue | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
||||||
|
| mapvote_colors_timer_low | The color of the timer when it has 5 or less seconds remaining | red | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
||||||
|
| mapvote_colors_help_text | The color of the help text at the bottom explaining how to use the menu | white | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
||||||
|
| mapvote_colors_help_accent | The color of the accented text of the help text at the bottom | blue | red, green, yellow, blue, cyan, purple, white, grey, gray, black |
|
||||||
|
| mapvote_colors_help_accent_mode | The accenting mode for the help text. `standard` only puts the accent color on the button to press and `max` puts it on both the buttons and the action it does | standard | standard or max |
|
||||||
|
| mapvote_vote_time | The time the vote lasts (in seconds) | 30 | Any plain number above 5 |
|
||||||
|
| mapvote_blur_level | The amount of blur to put when the mapvote menu starts to show. The max recommended value is 5. 0 disables it | 2.5 | Any number |
|
||||||
|
| mapvote_blur_fade_in_time | The time (in seconds) it takes for the blur to reach `mapvote_blur_level`. For example if you set it to 10 and `mapvote_blur_level` is 5 then it will progressively blur the screen from 0 to 5 in 10 seconds | 2 | Any number |
|
||||||
|
| mapvote_horizontal_spacing | The horizontal spacing between the map names on the left and the vote counts on the right. I recommend setting this value according to the longest map name length so that it doesn't overlap with the vote counts | 75 | Any plain number |
|
||||||
|
| mapvote_display_wait_time | Once the game over screen ends, the time to wait before displaying the vote menu (in seconds) | 1 | Any number above 0.05 |
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
Below is an example CFG showing how each dvars can be configured.
|
Below is an example CFG showing how each dvars can be configured.
|
||||||
The values you see are the default values that will be used if you don't set a dvar.
|
The values you see are the default values that will be used if you don't set a dvar.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Multiplayer CFG</summary>
|
||||||
|
|
||||||
```c
|
```c
|
||||||
set mapvote_enable 1
|
set mapvote_enable 1
|
||||||
set mapvote_maps "Aftermath:Cargo:Carrier:Drone:Express:Hijacked:Meltdown:Overflow:Plaza:Raid:Slums:Standoff:Turbine:Yemen:Nuketown:Downhill:Mirage:Hydro:Grind:Encore:Magma:Vertigo:Studio:Uplink:Detour:Cove:Rush:Dig:Frost:Pod:Takeoff"
|
set mapvote_maps "Aftermath:Cargo:Carrier:Drone:Express:Hijacked:Meltdown:Overflow:Plaza:Raid:Slums:Standoff:Turbine:Yemen:Nuketown:Downhill:Mirage:Hydro:Grind:Encore:Magma:Vertigo:Studio:Uplink:Detour:Cove:Rush:Dig:Frost:Pod:Takeoff"
|
||||||
set mapvote_modes "Team Deathmatch,tdm:Domination,dom:Hardpoint,koth"
|
set mapvote_modes "Team Deathmatch,tdm:Domination,dom:Hardpoint,koth"
|
||||||
|
set mapvote_limits_maps 0
|
||||||
|
set mapvote_limits_modes 0
|
||||||
|
set mapvote_limits_max 12
|
||||||
set mapvote_colors_selected "blue"
|
set mapvote_colors_selected "blue"
|
||||||
set mapvote_colors_unselected "white"
|
set mapvote_colors_unselected "white"
|
||||||
set mapvote_colors_timer "blue"
|
set mapvote_colors_timer "blue"
|
||||||
@ -104,18 +148,62 @@ Here are some pre-set values if you want to quickly copy/paste something
|
|||||||
| FFA 24/7 | "Free for All,dm" |
|
| FFA 24/7 | "Free for All,dm" |
|
||||||
| SND 24/7 | "Search & Destroy,sd" |
|
| SND 24/7 | "Search & Destroy,sd" |
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Zombies CFG</summary>
|
||||||
|
|
||||||
|
```c
|
||||||
|
set mapvote_enable 1
|
||||||
|
set mapvote_maps "Bus Depot,Bus Depot,zm_standard_transit:Town,Town,zm_standard_town:Farm,Farm,zm_standard_farm:Mob of The Dead,Mob of The Dead,zm_classic_prison:Nuketown,Nuketown,zm_standard_nuked:Origins,Origins,zm_classic_tomb:Buried,Buried,zm_classic_processing:Die Rise,Die Rise,zm_classic_rooftop"
|
||||||
|
set mapvote_limits_max 12
|
||||||
|
set mapvote_colors_selected "blue"
|
||||||
|
set mapvote_colors_unselected "white"
|
||||||
|
set mapvote_colors_timer "blue"
|
||||||
|
set mapvote_colors_timer_low "red"
|
||||||
|
set mapvote_colors_help_text "white"
|
||||||
|
set mapvote_colors_help_accent "blue"
|
||||||
|
set mapvote_colors_help_accent_mode "standard"
|
||||||
|
set mapvote_vote_time 30
|
||||||
|
set mapvote_blur_level 2.5
|
||||||
|
set mapvote_blur_fade_in_time 2
|
||||||
|
set mapvote_horizontal_spacing 75
|
||||||
|
set mapvote_display_wait_time 1
|
||||||
|
```
|
||||||
|
|
||||||
|
Here are some pre-set values if you want to quickly copy/paste something
|
||||||
|
|
||||||
|
| Description | Value |
|
||||||
|
|---|---|
|
||||||
|
| Tranzit & Tranzit survival maps | "Tranzit,Tranzit,zm_classic_transit:Bus Depot,Bus Depot,zm_standard_transit:Town,Town,zm_standard_town:Farm,Farm,zm_standard_farm" |
|
||||||
|
| DLC maps | "Buried,Buried,zm_classic_processing:Die Rise,Die Rise,zm_classic_rooftop:Mob of The Dead,Mob of The Dead,zm_classic_prison:Nuketown,Nuketown,zm_standard_nuked:Origins,Origins,zm_classic_tomb" |
|
||||||
|
| Grief maps | "Buried (Grief),Buried,zm_grief_street:Mob of The Dead (Grief),Mob of The Dead,zm_grief_cellblock:Farm (Grief),Farm,zm_grief_farm:Town (Grief),Town,zm_grief_town:Bus Depot (Grief),Bus Depot,zm_grief_transit" |
|
||||||
|
| Turned maps | "Buried (Turned),Buried,zm_cleansed_street:Diner (Turned),Diner,zm_cleansed_diner" |
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
### Notes
|
### Notes
|
||||||
|
|
||||||
- If right click is set to toggle ads then pressing right click will make the player go up by one every 0.35s.
|
- If right click is set to toggle ads then pressing right click will make the player go up by one every 0.25s until he right clicks again.
|
||||||
If I didn't change it to be that way players with toggle ads would have to press right click twice to go up by one all the time.
|
If I didn't change it to be that way players with toggle ads would have to press right click twice to go up by one all the time.
|
||||||
Now instead they simply right click once to start going up and right click again to stop.
|
Now instead they simply right click once to start going up and right click again to stop which is a better user experience.
|
||||||
|
- When there's only one map/mode, instead of showing a single vote possibility, your single map/mode will be hidden to make the user experience better but it will still always rotate to your one map/mode
|
||||||
|
- All the sounds (menu and timer) don't work in zombies.
|
||||||
|
The game seems to progressively (but quickly) mute the sound during the [intermission phase](https://github.com/plutoniummod/t6-scripts/blob/main/ZM/Core/maps/mp/zombies/_zm.gsc).
|
||||||
|
Until I find a way to play sounds in the intermission, if it's even possible, the zombies menu will sadly not have any sound
|
||||||
|
- If some map/mode names or vote count don't display at all then you probably have other scripts that create HUD elements and there's too much elements to display so either remove your script or lower `mapvote_limits_max` so that the mapvote will have less elements to display
|
||||||
- When two maps/modes have the same votes, the lowest one in the list will win. In the future it would be nice to randomize between both
|
- When two maps/modes have the same votes, the lowest one in the list will win. In the future it would be nice to randomize between both
|
||||||
- Ending the game with ESC doesn't work when in debug mode.
|
- Ending the game with ESC doesn't work when in debug mode.
|
||||||
Use `map_restart` in the console when your script is compiled. And if you want to leave use `disconnect` in the console until this is fixed
|
Use `map_restart` in the console when your script is compiled. And if you want to leave use `disconnect` in the console until this is fixed
|
||||||
- When there's only one map/mode the right map/mode will be chosen but adding an option to hide single vote elements would be nice
|
|
||||||
|
|
||||||
## mapvote_mp_extend.gsc
|
## mapvote_mp_extend.gsc
|
||||||
|
|
||||||
A small script that goes with `mapvote.gsc` to make it work in multiplayer.
|
A small script that goes with `mapvote.gsc` to make it work in multiplayer.
|
||||||
It has to be installed in the `mp` directory since it contains multiplayer only code.
|
It has to be installed in the `scripts\mp` directory since it contains multiplayer only code.
|
||||||
Putting it in `scripts` or `scripts\zm` will throw an error when booting up a zombies map.
|
Putting it in `scripts` or `scripts\zm` will throw an error when booting up a zombies map.
|
||||||
|
|
||||||
|
## mapvote_zm_extend.gsc
|
||||||
|
|
||||||
|
A small script that goes with `mapvote.gsc` to make it work in zombies.
|
||||||
|
It has to be installed in the `scripts\zm` directory since it contains zombies only code.
|
||||||
|
Putting it in `scripts` or `scripts\mp` will throw an error when booting up a multiplayer map.
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.1 MiB After Width: | Height: | Size: 3.1 MiB |
Binary file not shown.
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 862 KiB |
Binary file not shown.
BIN
mapvote/mapvote_zm_extend.gsc
Normal file
BIN
mapvote/mapvote_zm_extend.gsc
Normal file
Binary file not shown.
@ -45,8 +45,7 @@ InitMapvote()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Starting the mapvote normally is handled in mp\mapvote_mp_extend.gsc
|
// Starting the mapvote normally is handled in mp\mapvote_mp_extend.gsc and zm\mapvote_zm_extend.gsc
|
||||||
//replaceFunc(maps\mp\gametypes\_killcam::finalkillcamwaiter, ::OnKillcamEnd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,8 +53,21 @@ InitDvars()
|
|||||||
{
|
{
|
||||||
SetDvarIfNotInitialized("mapvote_debug", false);
|
SetDvarIfNotInitialized("mapvote_debug", false);
|
||||||
|
|
||||||
|
if (IsMultiplayerMode())
|
||||||
|
{
|
||||||
SetDvarIfNotInitialized("mapvote_maps", "Aftermath:Cargo:Carrier:Drone:Express:Hijacked:Meltdown:Overflow:Plaza:Raid:Slums:Standoff:Turbine:Yemen:Nuketown:Downhill:Mirage:Hydro:Grind:Encore:Magma:Vertigo:Studio:Uplink:Detour:Cove:Rush:Dig:Frost:Pod:Takeoff");
|
SetDvarIfNotInitialized("mapvote_maps", "Aftermath:Cargo:Carrier:Drone:Express:Hijacked:Meltdown:Overflow:Plaza:Raid:Slums:Standoff:Turbine:Yemen:Nuketown:Downhill:Mirage:Hydro:Grind:Encore:Magma:Vertigo:Studio:Uplink:Detour:Cove:Rush:Dig:Frost:Pod:Takeoff");
|
||||||
SetDvarIfNotInitialized("mapvote_modes", "Team Deathmatch,tdm:Domination,dom:Hardpoint,koth");
|
SetDvarIfNotInitialized("mapvote_modes", "Team Deathmatch,tdm:Domination,dom:Hardpoint,koth");
|
||||||
|
SetDvarIfNotInitialized("mapvote_limits_maps", 0);
|
||||||
|
SetDvarIfNotInitialized("mapvote_limits_modes", 0);
|
||||||
|
SetDvarIfNotInitialized("mapvote_sounds_menu_enabled", 1);
|
||||||
|
SetDvarIfNotInitialized("mapvote_sounds_timer_enabled", 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetDvarIfNotInitialized("mapvote_maps", "Bus Depot,Bus Depot,zm_standard_transit:Town,Town,zm_standard_town:Farm,Farm,zm_standard_farm:Mob of The Dead,Mob of The Dead,zm_classic_prison:Nuketown,Nuketown,zm_standard_nuked:Origins,Origins,zm_classic_tomb:Buried,Buried,zm_classic_processing:Die Rise,Die Rise,zm_classic_rooftop");
|
||||||
|
}
|
||||||
|
|
||||||
|
SetDvarIfNotInitialized("mapvote_limits_max", 12);
|
||||||
SetDvarIfNotInitialized("mapvote_colors_selected", "blue");
|
SetDvarIfNotInitialized("mapvote_colors_selected", "blue");
|
||||||
SetDvarIfNotInitialized("mapvote_colors_unselected", "white");
|
SetDvarIfNotInitialized("mapvote_colors_unselected", "white");
|
||||||
SetDvarIfNotInitialized("mapvote_colors_timer", "blue");
|
SetDvarIfNotInitialized("mapvote_colors_timer", "blue");
|
||||||
@ -63,8 +75,6 @@ InitDvars()
|
|||||||
SetDvarIfNotInitialized("mapvote_colors_help_text", "white");
|
SetDvarIfNotInitialized("mapvote_colors_help_text", "white");
|
||||||
SetDvarIfNotInitialized("mapvote_colors_help_accent", "blue");
|
SetDvarIfNotInitialized("mapvote_colors_help_accent", "blue");
|
||||||
SetDvarIfNotInitialized("mapvote_colors_help_accent_mode", "standard");
|
SetDvarIfNotInitialized("mapvote_colors_help_accent_mode", "standard");
|
||||||
SetDvarIfNotInitialized("mapvote_sounds_menu_enabled", 1);
|
|
||||||
SetDvarIfNotInitialized("mapvote_sounds_timer_enabled", 1);
|
|
||||||
SetDvarIfNotInitialized("mapvote_vote_time", 30);
|
SetDvarIfNotInitialized("mapvote_vote_time", 30);
|
||||||
SetDvarIfNotInitialized("mapvote_blur_level", 2.5);
|
SetDvarIfNotInitialized("mapvote_blur_level", 2.5);
|
||||||
SetDvarIfNotInitialized("mapvote_blur_fade_in_time", 2);
|
SetDvarIfNotInitialized("mapvote_blur_fade_in_time", 2);
|
||||||
@ -74,8 +84,51 @@ InitDvars()
|
|||||||
|
|
||||||
InitVariables()
|
InitVariables()
|
||||||
{
|
{
|
||||||
|
mapsArray = StrTok(GetDvar("mapvote_maps"), ":");
|
||||||
|
voteLimits = [];
|
||||||
|
|
||||||
|
if (IsMultiplayerMode())
|
||||||
|
{
|
||||||
|
modesArray = StrTok(GetDvar("mapvote_modes"), ":");
|
||||||
|
|
||||||
|
if (GetDvarInt("mapvote_limits_maps") == 0 && GetDvarInt("mapvote_limits_modes") == 0)
|
||||||
|
{
|
||||||
|
voteLimits = GetVoteLimits(mapsArray.size, modesArray.size);
|
||||||
|
}
|
||||||
|
else if (GetDvarInt("mapvote_limits_maps") > 0 && GetDvarInt("mapvote_limits_modes") == 0)
|
||||||
|
{
|
||||||
|
voteLimits = GetVoteLimits(GetDvarInt("mapvote_limits_maps"), modesArray.size);
|
||||||
|
}
|
||||||
|
else if (GetDvarInt("mapvote_limits_maps") == 0 && GetDvarInt("mapvote_limits_modes") > 0)
|
||||||
|
{
|
||||||
|
voteLimits = GetVoteLimits(mapsArray.size, GetDvarInt("mapvote_limits_modes"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
voteLimits = GetVoteLimits(GetDvarInt("mapvote_limits_maps"), GetDvarInt("mapvote_limits_modes"));
|
||||||
|
}
|
||||||
|
|
||||||
|
level.mapvote["limit"]["maps"] = voteLimits["maps"];
|
||||||
|
level.mapvote["limit"]["modes"] = voteLimits["modes"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (GetDvarInt("mapvote_limits_maps") == 0)
|
||||||
|
{
|
||||||
|
level.mapvote["limit"]["maps"] = GetVoteLimits(mapsArray.size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
level.mapvote["limit"]["maps"] = GetVoteLimits(GetDvarInt("mapvote_limits_maps"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SetMapvoteData("map");
|
SetMapvoteData("map");
|
||||||
|
|
||||||
|
if (IsMultiplayerMode())
|
||||||
|
{
|
||||||
SetMapvoteData("mode");
|
SetMapvoteData("mode");
|
||||||
|
}
|
||||||
|
|
||||||
level.mapvote["vote"]["maps"] = [];
|
level.mapvote["vote"]["maps"] = [];
|
||||||
level.mapvote["vote"]["modes"] = [];
|
level.mapvote["vote"]["modes"] = [];
|
||||||
@ -90,7 +143,7 @@ InitVariables()
|
|||||||
/*
|
/*
|
||||||
This is used instead of notifyonplayercommand("mapvote_up", "speed_throw")
|
This is used instead of notifyonplayercommand("mapvote_up", "speed_throw")
|
||||||
to fix an issue where players using toggle ads would have to press right click twice for it to register one right click.
|
to fix an issue where players using toggle ads would have to press right click twice for it to register one right click.
|
||||||
With this instead it keeps scrolling every 0.35s until they right click again which is a better user experience
|
With this instead it keeps scrolling every 0.25s until they right click again which is a better user experience
|
||||||
*/
|
*/
|
||||||
ListenForRightClick()
|
ListenForRightClick()
|
||||||
{
|
{
|
||||||
@ -101,7 +154,7 @@ ListenForRightClick()
|
|||||||
if (self AdsButtonPressed())
|
if (self AdsButtonPressed())
|
||||||
{
|
{
|
||||||
self notify("mapvote_up");
|
self notify("mapvote_up");
|
||||||
wait 0.35;
|
wait 0.25;
|
||||||
}
|
}
|
||||||
|
|
||||||
wait 0.05;
|
wait 0.05;
|
||||||
@ -134,6 +187,10 @@ ListenForVoteInputs()
|
|||||||
{
|
{
|
||||||
continue; // stop/skip execution
|
continue; // stop/skip execution
|
||||||
}
|
}
|
||||||
|
else if (section == "mode" && level.mapvote["modes"]["by_index"].size <= 1 && input != "mapvote_unselect" && input != "mapvote_debug")
|
||||||
|
{
|
||||||
|
continue; // stop/skip execution
|
||||||
|
}
|
||||||
|
|
||||||
if (input == "mapvote_down")
|
if (input == "mapvote_down")
|
||||||
{
|
{
|
||||||
@ -192,9 +249,22 @@ ListenForVoteInputs()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Print(player.name + " voted for map [" + player.mapvote["map"]["selected_index"] +"] " + level.mapvote["maps"]["by_index"][player.mapvote["map"]["selected_index"]]);
|
mapName = "";
|
||||||
|
|
||||||
|
if (IsMultiplayerMode())
|
||||||
|
{
|
||||||
|
mapName = level.mapvote["maps"]["by_index"][player.mapvote["map"]["selected_index"]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mapName = level.mapvote["maps"]["by_index"][player.mapvote["map"]["selected_index"]][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Print(player.name + " voted for map [" + player.mapvote["map"]["selected_index"] +"] " + mapName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsMultiplayerMode())
|
||||||
|
{
|
||||||
if (player.mapvote["mode"]["selected_index"] == -1)
|
if (player.mapvote["mode"]["selected_index"] == -1)
|
||||||
{
|
{
|
||||||
Print(player.name + " did not vote for any mode");
|
Print(player.name + " did not vote for any mode");
|
||||||
@ -205,6 +275,7 @@ ListenForVoteInputs()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wait 0.05;
|
wait 0.05;
|
||||||
}
|
}
|
||||||
@ -217,7 +288,23 @@ ListenForVoteInputs()
|
|||||||
CreateVoteMenu()
|
CreateVoteMenu()
|
||||||
{
|
{
|
||||||
spacing = 20;
|
spacing = 20;
|
||||||
hudLastPosY = -(((level.mapvote["maps"]["by_index"].size + level.mapvote["modes"]["by_index"].size + 1) * spacing) / 2);
|
hudLastPosY = 0;
|
||||||
|
|
||||||
|
if (IsMultiplayerMode())
|
||||||
|
{
|
||||||
|
sectionsSeparation = 0;
|
||||||
|
|
||||||
|
if (level.mapvote["modes"]["by_index"].size > 1)
|
||||||
|
{
|
||||||
|
sectionsSeparation = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hudLastPosY = -((((level.mapvote["maps"]["by_index"].size + level.mapvote["modes"]["by_index"].size + sectionsSeparation) * spacing) / 2) - (spacing / 2));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hudLastPosY = -(((level.mapvote["maps"]["by_index"].size * spacing) / 2) - (spacing / 2));
|
||||||
|
}
|
||||||
|
|
||||||
for (mapIndex = 0; mapIndex < level.mapvote["maps"]["by_index"].size; mapIndex++)
|
for (mapIndex = 0; mapIndex < level.mapvote["maps"]["by_index"].size; mapIndex++)
|
||||||
{
|
{
|
||||||
@ -228,7 +315,18 @@ CreateVoteMenu()
|
|||||||
|
|
||||||
foreach (player in GetHumanPlayers())
|
foreach (player in GetHumanPlayers())
|
||||||
{
|
{
|
||||||
player.mapvote["map"][mapIndex]["hud"] = player CreateHudText(level.mapvote["maps"]["by_index"][mapIndex], "objective", 1.5, "LEFT", "CENTER", -(GetDvarInt("mapvote_horizontal_spacing")), hudLastPosY);
|
mapName = "";
|
||||||
|
|
||||||
|
if (IsMultiplayerMode())
|
||||||
|
{
|
||||||
|
mapName = level.mapvote["maps"]["by_index"][mapIndex];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mapName = level.mapvote["maps"]["by_index"][mapIndex][0];
|
||||||
|
}
|
||||||
|
|
||||||
|
player.mapvote["map"][mapIndex]["hud"] = player CreateHudText(mapName, "objective", 1.5, "LEFT", "CENTER", -(GetDvarInt("mapvote_horizontal_spacing")), hudLastPosY);
|
||||||
|
|
||||||
if (mapIndex == 0)
|
if (mapIndex == 0)
|
||||||
{
|
{
|
||||||
@ -243,6 +341,8 @@ CreateVoteMenu()
|
|||||||
hudLastPosY += spacing;
|
hudLastPosY += spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsMultiplayerMode() && level.mapvote["modes"]["by_index"].size > 1)
|
||||||
|
{
|
||||||
hudLastPosY += spacing; // Space between maps and modes sections
|
hudLastPosY += spacing; // Space between maps and modes sections
|
||||||
|
|
||||||
for (modeIndex = 0; modeIndex < level.mapvote["modes"]["by_index"].size; modeIndex++)
|
for (modeIndex = 0; modeIndex < level.mapvote["modes"]["by_index"].size; modeIndex++)
|
||||||
@ -261,6 +361,7 @@ CreateVoteMenu()
|
|||||||
|
|
||||||
hudLastPosY += spacing;
|
hudLastPosY += spacing;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach(player in GetHumanPlayers())
|
foreach(player in GetHumanPlayers())
|
||||||
{
|
{
|
||||||
@ -326,10 +427,13 @@ StartVote()
|
|||||||
level.mapvote["vote"]["maps"][i] = 0;
|
level.mapvote["vote"]["maps"][i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsMultiplayerMode())
|
||||||
|
{
|
||||||
for (i = 0; i < level.mapvote["modes"]["by_index"].size; i++)
|
for (i = 0; i < level.mapvote["modes"]["by_index"].size; i++)
|
||||||
{
|
{
|
||||||
level.mapvote["vote"]["modes"][i] = 0;
|
level.mapvote["vote"]["modes"][i] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
level thread CreateVoteMenu();
|
level thread CreateVoteMenu();
|
||||||
level thread CreateVoteTimer();
|
level thread CreateVoteTimer();
|
||||||
@ -405,9 +509,21 @@ ListenForEndVote()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
modeName = "";
|
||||||
|
modeCfg = "";
|
||||||
|
mapName = "";
|
||||||
|
|
||||||
|
if (IsMultiplayerMode())
|
||||||
|
{
|
||||||
modeName = level.mapvote["modes"]["by_index"][mostVotedModeIndex];
|
modeName = level.mapvote["modes"]["by_index"][mostVotedModeIndex];
|
||||||
modeCfg = level.mapvote["modes"]["by_name"][level.mapvote["modes"]["by_index"][mostVotedModeIndex]];
|
modeCfg = level.mapvote["modes"]["by_name"][level.mapvote["modes"]["by_index"][mostVotedModeIndex]];
|
||||||
mapName = GetMapCodeName(level.mapvote["maps"]["by_index"][mostVotedMapIndex]);
|
mapName = GetMapCodeName(level.mapvote["maps"]["by_index"][mostVotedMapIndex]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
modeCfg = level.mapvote["maps"]["by_index"][mostVotedMapIndex][2];
|
||||||
|
mapName = GetMapCodeName(level.mapvote["maps"]["by_index"][mostVotedMapIndex][1]);
|
||||||
|
}
|
||||||
|
|
||||||
if (GetDvarInt("mapvote_debug"))
|
if (GetDvarInt("mapvote_debug"))
|
||||||
{
|
{
|
||||||
@ -417,40 +533,42 @@ ListenForEndVote()
|
|||||||
Print("[MAPVOTE] Rotating to " + mapName + " | " + modeName + " (" + modeCfg + ".cfg)");
|
Print("[MAPVOTE] Rotating to " + mapName + " | " + modeName + " (" + modeCfg + ".cfg)");
|
||||||
}
|
}
|
||||||
|
|
||||||
setdvar("sv_maprotationcurrent", "exec " + modeCfg + ".cfg map " + mapName);
|
SetDvar("sv_maprotationcurrent", "exec " + modeCfg + ".cfg map " + mapName);
|
||||||
setdvar("sv_maprotation", "exec " + modeCfg + ".cfg map " + mapName);
|
SetDvar("sv_maprotation", "exec " + modeCfg + ".cfg map " + mapName);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetMapvoteData(type)
|
SetMapvoteData(type)
|
||||||
{
|
{
|
||||||
limit = 0;
|
limit = level.mapvote["limit"][type + "s"];
|
||||||
|
|
||||||
availableElements = StrTok(GetDvar("mapvote_" + type + "s"), ":");
|
availableElements = StrTok(GetDvar("mapvote_" + type + "s"), ":");
|
||||||
|
|
||||||
if (type == "map")
|
if (availableElements.size < limit)
|
||||||
{
|
|
||||||
if (availableElements.size < 6)
|
|
||||||
{
|
{
|
||||||
limit = availableElements.size;
|
limit = availableElements.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == "map")
|
||||||
|
{
|
||||||
|
if (IsMultiplayerMode())
|
||||||
|
{
|
||||||
|
level.mapvote["maps"]["by_index"] = GetRandomUniqueElementsInArray(availableElements, limit);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
limit = 6;
|
zombiesArrays = GetRandomUniqueElementsInArray(availableElements, limit);
|
||||||
}
|
|
||||||
|
|
||||||
level.mapvote["maps"]["by_index"] = GetRandomUniqueElementsInArray(availableElements, limit);
|
level.mapvote["maps"]["by_index"] = [];
|
||||||
|
|
||||||
|
foreach (element in zombiesArrays)
|
||||||
|
{
|
||||||
|
splittedElement = StrTok(element, ",");
|
||||||
|
level.mapvote["maps"]["by_index"] = AddElementToArray(level.mapvote["maps"]["by_index"], array(splittedElement[0], splittedElement[1], splittedElement[2]));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (type == "mode")
|
else if (type == "mode")
|
||||||
{
|
{
|
||||||
if (availableElements.size < 4)
|
|
||||||
{
|
|
||||||
limit = availableElements.size;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
limit = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
finalElements = [];
|
finalElements = [];
|
||||||
|
|
||||||
foreach (mode in GetRandomUniqueElementsInArray(availableElements, limit))
|
foreach (mode in GetRandomUniqueElementsInArray(availableElements, limit))
|
||||||
@ -465,6 +583,68 @@ SetMapvoteData(type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Gets the amount of maps and modes to display on screen
|
||||||
|
This is used to get default values if the limits dvars are not set
|
||||||
|
It will dynamically adjust the amount of maps and modes to show
|
||||||
|
*/
|
||||||
|
GetVoteLimits(mapsAmount, modesAmount)
|
||||||
|
{
|
||||||
|
maxLimit = GetDvarInt("mapvote_limits_max");
|
||||||
|
limits = [];
|
||||||
|
|
||||||
|
if (!IsDefined(modesAmount))
|
||||||
|
{
|
||||||
|
if (mapsAmount <= maxLimit)
|
||||||
|
{
|
||||||
|
return mapsAmount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return maxLimit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((mapsAmount + modesAmount) <= maxLimit)
|
||||||
|
{
|
||||||
|
limits["maps"] = mapsAmount;
|
||||||
|
limits["modes"] = modesAmount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (mapsAmount >= (maxLimit / 2) && modesAmount >= (maxLimit))
|
||||||
|
{
|
||||||
|
limits["maps"] = (maxLimit / 2);
|
||||||
|
limits["modes"] = (maxLimit / 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (mapsAmount > (maxLimit / 2))
|
||||||
|
{
|
||||||
|
finalMapsAmount = 0;
|
||||||
|
|
||||||
|
if (modesAmount <= 1)
|
||||||
|
{
|
||||||
|
limits["maps"] = maxLimit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
limits["maps"] = (maxLimit - modesAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
limits["modes"] = modesAmount;
|
||||||
|
}
|
||||||
|
else if (modesAmount > (maxLimit / 2))
|
||||||
|
{
|
||||||
|
limits["maps"] = mapsAmount;
|
||||||
|
limits["modes"] = (maxLimit - mapsAmount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return limits;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* HUD section */
|
/* HUD section */
|
||||||
@ -619,6 +799,11 @@ IsBot()
|
|||||||
return IsDefined(self.pers["isBot"]) && self.pers["isBot"];
|
return IsDefined(self.pers["isBot"]) && self.pers["isBot"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IsMultiplayerMode()
|
||||||
|
{
|
||||||
|
return !IsDefined(level.zombiemode) || !level.zombiemode;
|
||||||
|
}
|
||||||
|
|
||||||
GetHumanPlayers()
|
GetHumanPlayers()
|
||||||
{
|
{
|
||||||
humanPlayers = [];
|
humanPlayers = [];
|
||||||
@ -627,7 +812,7 @@ GetHumanPlayers()
|
|||||||
{
|
{
|
||||||
if (!player IsBot())
|
if (!player IsBot())
|
||||||
{
|
{
|
||||||
humanPlayers[humanPlayers.size] = player;
|
humanPlayers = AddElementToArray(humanPlayers, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,102 +874,136 @@ AddElementToArray(array, element)
|
|||||||
|
|
||||||
GetMapCodeName(mapName)
|
GetMapCodeName(mapName)
|
||||||
{
|
{
|
||||||
switch(mapName)
|
formattedMapName = ToUpper(mapName);
|
||||||
|
|
||||||
|
if (IsMultiplayerMode())
|
||||||
{
|
{
|
||||||
case "Nuketown":
|
switch(formattedMapName)
|
||||||
|
{
|
||||||
|
case "NUKETOWN":
|
||||||
return "mp_nuketown_2020";
|
return "mp_nuketown_2020";
|
||||||
|
|
||||||
case "Hijacked":
|
case "HIJACKED":
|
||||||
return "mp_hijacked";
|
return "mp_hijacked";
|
||||||
|
|
||||||
case "Meltdown":
|
case "MELTDOWN":
|
||||||
return "mp_meltdown";
|
return "mp_meltdown";
|
||||||
|
|
||||||
case "Express":
|
case "EXPRESS":
|
||||||
return "mp_express";
|
return "mp_express";
|
||||||
|
|
||||||
case "Carrier":
|
case "CARRIER":
|
||||||
return "mp_carrier";
|
return "mp_carrier";
|
||||||
|
|
||||||
case "Overflow":
|
case "OVERFLOW":
|
||||||
return "mp_overflow";
|
return "mp_overflow";
|
||||||
|
|
||||||
case "Slums":
|
case "SLUMS":
|
||||||
return "mp_slums";
|
return "mp_slums";
|
||||||
|
|
||||||
case "Aftermath":
|
case "AFTERMATH":
|
||||||
return "mp_la";
|
return "mp_la";
|
||||||
|
|
||||||
case "Cargo":
|
case "CARGO":
|
||||||
return "mp_dockside";
|
return "mp_dockside";
|
||||||
|
|
||||||
case "Turbine":
|
case "TURBINE":
|
||||||
return "mp_turbine";
|
return "mp_turbine";
|
||||||
|
|
||||||
case "Drone":
|
case "DRONE":
|
||||||
return "mp_drone";
|
return "mp_drone";
|
||||||
|
|
||||||
case "Raid":
|
case "RAID":
|
||||||
return "mp_raid";
|
return "mp_raid";
|
||||||
|
|
||||||
case "Standoff":
|
case "STANDOFF":
|
||||||
return "mp_village";
|
return "mp_village";
|
||||||
|
|
||||||
case "Plaza":
|
case "PLAZA":
|
||||||
return "mp_nightclub";
|
return "mp_nightclub";
|
||||||
|
|
||||||
case "Yemen":
|
case "YEMEN":
|
||||||
return "mp_socotra";
|
return "mp_socotra";
|
||||||
|
|
||||||
case "Uplink":
|
case "UPLINK":
|
||||||
return "mp_uplink";
|
return "mp_uplink";
|
||||||
|
|
||||||
case "Detour":
|
case "DETOUR":
|
||||||
return "mp_bridge";
|
return "mp_bridge";
|
||||||
|
|
||||||
case "Cove":
|
case "COVE":
|
||||||
return "mp_castaway";
|
return "mp_castaway";
|
||||||
|
|
||||||
case "Rush":
|
case "RUSH":
|
||||||
return "mp_paintball";
|
return "mp_paintball";
|
||||||
|
|
||||||
case "Studio":
|
case "STUDIO":
|
||||||
return "mp_studio";
|
return "mp_studio";
|
||||||
|
|
||||||
case "Magma":
|
case "MAGMA":
|
||||||
return "mp_magma";
|
return "mp_magma";
|
||||||
|
|
||||||
case "Vertigo":
|
case "VERTIGO":
|
||||||
return "mp_vertigo";
|
return "mp_vertigo";
|
||||||
|
|
||||||
case "Encore":
|
case "ENCORE":
|
||||||
return "mp_concert";
|
return "mp_concert";
|
||||||
|
|
||||||
case "Downhill":
|
case "DOWNHILL":
|
||||||
return "mp_downhill";
|
return "mp_downhill";
|
||||||
|
|
||||||
case "Grind":
|
case "GRIND":
|
||||||
return "mp_skate";
|
return "mp_skate";
|
||||||
|
|
||||||
case "Hydro":
|
case "HYDRO":
|
||||||
return "mp_hydro";
|
return "mp_hydro";
|
||||||
|
|
||||||
case "Mirage":
|
case "MIRAGE":
|
||||||
return "mp_mirage";
|
return "mp_mirage";
|
||||||
|
|
||||||
case "Frost":
|
case "FROST":
|
||||||
return "mp_frostbite";
|
return "mp_frostbite";
|
||||||
|
|
||||||
case "Takeoff":
|
case "TAKEOFF":
|
||||||
return "mp_takeoff";
|
return "mp_takeoff";
|
||||||
|
|
||||||
case "Pod":
|
case "POD":
|
||||||
return "mp_pod";
|
return "mp_pod";
|
||||||
|
|
||||||
case "Dig":
|
case "DIG":
|
||||||
return "mp_dig";
|
return "mp_dig";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch(formattedMapName)
|
||||||
|
{
|
||||||
|
case "BURIED":
|
||||||
|
return "zm_buried";
|
||||||
|
|
||||||
|
case "DIE RISE":
|
||||||
|
return "zm_highrise";
|
||||||
|
|
||||||
|
case "MOB OF THE DEAD":
|
||||||
|
return "zm_prison";
|
||||||
|
|
||||||
|
case "NUKETOWN":
|
||||||
|
return "zm_nuked";
|
||||||
|
|
||||||
|
case "ORIGINS":
|
||||||
|
return "zm_tomb";
|
||||||
|
|
||||||
|
case "TRANZIT":
|
||||||
|
case "FARM":
|
||||||
|
case "TOWN":
|
||||||
|
case "BUS DEPOT":
|
||||||
|
return "zm_transit";
|
||||||
|
|
||||||
|
case "DINER":
|
||||||
|
return "zm_transit_dr";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GetGscColor(colorName)
|
GetGscColor(colorName)
|
||||||
{
|
{
|
||||||
|
155
mapvote/source/mapvote_zm_extend-source.gsc
Normal file
155
mapvote/source/mapvote_zm_extend-source.gsc
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
/*
|
||||||
|
All the credits for this script go to DoktorSAS for both the source code and for helping me figuring this out
|
||||||
|
https://github.com/DoktorSAS/PlutoniumT6Mapvote/blob/master/Zombies/mapvote.gsc
|
||||||
|
|
||||||
|
menuSounds = array("zmb_meteor_activate", "zmb_spawn_powerup", "zmb_powerup_grabbed", "zmb_switch_flip", "zmb_elec_start", "zmb_perks_packa_ready");
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include common_scripts\utility;
|
||||||
|
#include maps\mp\_utility;
|
||||||
|
|
||||||
|
Init()
|
||||||
|
{
|
||||||
|
if (GetDvarInt("mapvote_enable"))
|
||||||
|
{
|
||||||
|
replaceFunc(maps\mp\zombies\_zm::intermission, ::OnIntermissionStart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OnIntermissionStart()
|
||||||
|
{
|
||||||
|
level.intermission = 1;
|
||||||
|
level notify("intermission");
|
||||||
|
|
||||||
|
for (i = 0; i < level.players.size; i++)
|
||||||
|
{
|
||||||
|
level.players[i] thread player_intermission();
|
||||||
|
level.players[i] hide();
|
||||||
|
level.players[i] setclientuivisibilityflag("hud_visible", 0);
|
||||||
|
|
||||||
|
level.players[i] setclientthirdperson(0);
|
||||||
|
level.players[i].health = 100;
|
||||||
|
level.players[i] stopsounds();
|
||||||
|
level.players[i] stopsounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
wait GetDvarInt("mapvote_display_wait_time");
|
||||||
|
|
||||||
|
[[level.mapvote_start_function]]();
|
||||||
|
[[level.mapvote_end_function]]();
|
||||||
|
|
||||||
|
for (i = 0; i < level.players.size; i++)
|
||||||
|
{
|
||||||
|
level.players[i] notify("_zombie_game_over");
|
||||||
|
level.players[i].sessionstate = "intermission";
|
||||||
|
}
|
||||||
|
|
||||||
|
players = get_players();
|
||||||
|
i = 0;
|
||||||
|
while (i < players.size)
|
||||||
|
{
|
||||||
|
setclientsysstate("levelNotify", "zi", players[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
wait 0.25;
|
||||||
|
players = get_players();
|
||||||
|
i = 0;
|
||||||
|
while (i < players.size)
|
||||||
|
{
|
||||||
|
setclientsysstate("lsm", "0", players[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
level thread maps\mp\zombies\_zm::zombie_game_over_death();
|
||||||
|
}
|
||||||
|
|
||||||
|
player_intermission()
|
||||||
|
{
|
||||||
|
self closemenu();
|
||||||
|
self closeingamemenu();
|
||||||
|
|
||||||
|
level endon("stop_intermission");
|
||||||
|
self endon("disconnect");
|
||||||
|
self endon("death");
|
||||||
|
|
||||||
|
self.score = self.score_total;
|
||||||
|
|
||||||
|
self.spectatorclient = -1;
|
||||||
|
self.killcamentity = -1;
|
||||||
|
self.archivetime = 0;
|
||||||
|
self.psoffsettime = 0;
|
||||||
|
self.friendlydamage = undefined;
|
||||||
|
points = getstructarray("intermission", "targetname");
|
||||||
|
if (!isDefined(points) || points.size == 0)
|
||||||
|
{
|
||||||
|
points = getentarray("info_intermission", "classname");
|
||||||
|
|
||||||
|
location = getDvar("ui_zm_mapstartlocation");
|
||||||
|
for(i = 0;i < points.size;i++)
|
||||||
|
{
|
||||||
|
if(points[i].script_string == location)
|
||||||
|
{
|
||||||
|
points = points[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (points.size < 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isdefined(self.game_over_bg))
|
||||||
|
self.game_over_bg destroy();
|
||||||
|
org = undefined;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
points = array_randomize(points);
|
||||||
|
i = 0;
|
||||||
|
while (i < points.size)
|
||||||
|
{
|
||||||
|
point = points[i];
|
||||||
|
if (!isDefined(org))
|
||||||
|
{
|
||||||
|
self spawn(point.origin, point.angles);
|
||||||
|
}
|
||||||
|
if (isDefined(points[i].target))
|
||||||
|
{
|
||||||
|
if (!isDefined(org))
|
||||||
|
{
|
||||||
|
org = spawn("script_model", self.origin + vectorScale((0, 0, -1), 60));
|
||||||
|
org setmodel("tag_origin");
|
||||||
|
}
|
||||||
|
org.origin = points[i].origin;
|
||||||
|
org.angles = points[i].angles;
|
||||||
|
j = 0;
|
||||||
|
while (j < get_players().size)
|
||||||
|
{
|
||||||
|
player = get_players()[j];
|
||||||
|
player camerasetposition(org);
|
||||||
|
player camerasetlookat();
|
||||||
|
player cameraactivate(1);
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
speed = 20;
|
||||||
|
if (isDefined(points[i].speed))
|
||||||
|
{
|
||||||
|
speed = points[i].speed;
|
||||||
|
}
|
||||||
|
target_point = getstruct(points[i].target, "targetname");
|
||||||
|
dist = distance(points[i].origin, target_point.origin);
|
||||||
|
time = dist / speed;
|
||||||
|
q_time = time * 0.25;
|
||||||
|
if (q_time > 1)
|
||||||
|
{
|
||||||
|
q_time = 1;
|
||||||
|
}
|
||||||
|
org moveto(target_point.origin, time, q_time, q_time);
|
||||||
|
org rotateto(target_point.angles, time, q_time, q_time);
|
||||||
|
wait(time - q_time);
|
||||||
|
wait q_time;
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user