├── TF2Dodgeball ├── cfg │ └── sourcemod │ │ ├── dodgeball_ffa_disable.cfg │ │ ├── dodgeball_ffa_enable.cfg │ │ ├── dodgeball_enable.cfg │ │ └── dodgeball_disable.cfg └── addons │ └── sourcemod │ ├── plugins │ └── TF2Dodgeball.smx │ ├── configs │ └── dodgeball │ │ └── general.cfg │ └── translations │ └── tfdb.phrases.txt ├── Subplugins ├── FFA │ ├── plugins │ │ └── TF2DodgeballFFA.smx │ ├── README.md │ └── scripting │ │ └── TF2DodgeballFFA.sp ├── Menu │ ├── plugins │ │ └── TF2DodgeballMenu.smx │ └── README.md ├── Print │ ├── plugins │ │ └── TF2DodgeballPrint.smx │ ├── README.md │ └── scripting │ │ └── TF2DodgeballPrint.sp ├── Votes │ ├── plugins │ │ └── TF2DodgeballVotes.smx │ ├── README.md │ └── scripting │ │ └── TF2DodgeballVotes.sp ├── Trails │ ├── plugins │ │ └── TF2DodgeballTrails.smx │ ├── README.md │ └── scripting │ │ ├── include │ │ └── tfdbtrails.inc │ │ └── TF2DodgeballTrails.sp ├── NoBlock │ ├── plugins │ │ └── TF2DodgeballNoBlock.smx │ ├── README.md │ └── scripting │ │ └── TF2DodgeballNoBlock.sp ├── EventFix │ ├── plugins │ │ └── TF2DodgeballEventFix.smx │ ├── README.md │ └── scripting │ │ └── TF2DodgeballEventFix.sp ├── AntiSnipe │ ├── plugins │ │ └── TF2DodgeballAntiSnipe.smx │ ├── README.md │ └── scripting │ │ ├── include │ │ └── collisionhook.inc │ │ └── TF2DodgeballAntiSnipe.sp ├── AntiSwitch │ ├── plugins │ │ └── TF2DodgeballAntiSwitch.smx │ ├── README.md │ └── scripting │ │ └── TF2DodgeballAntiSwitch.sp ├── Speedometer │ ├── plugins │ │ └── TF2DodgeballSpeedHud.smx │ ├── README.md │ └── scripting │ │ └── TF2DodgeballSpeedHud.sp ├── ExtraEvents │ ├── plugins │ │ └── TF2DodgeballExtraEvents.smx │ ├── README.md │ └── scripting │ │ └── TF2DodgeballExtraEvents.sp └── AirblastPrevention │ ├── plugins │ └── TF2AirblastPrevention.smx │ ├── README.md │ └── scripting │ └── TF2AirblastPrevention.sp ├── README.md └── LICENSE /TF2Dodgeball/cfg/sourcemod/dodgeball_ffa_disable.cfg: -------------------------------------------------------------------------------- 1 | sm_cvar tf_dodgeball_as_collision 1 2 | sm_cvar tf_dodgeball_as_damage 1 3 | -------------------------------------------------------------------------------- /TF2Dodgeball/cfg/sourcemod/dodgeball_ffa_enable.cfg: -------------------------------------------------------------------------------- 1 | sm_cvar tf_dodgeball_as_collision 0 2 | sm_cvar tf_dodgeball_as_damage 0 3 | -------------------------------------------------------------------------------- /Subplugins/FFA/plugins/TF2DodgeballFFA.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/Subplugins/FFA/plugins/TF2DodgeballFFA.smx -------------------------------------------------------------------------------- /Subplugins/Menu/plugins/TF2DodgeballMenu.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/Subplugins/Menu/plugins/TF2DodgeballMenu.smx -------------------------------------------------------------------------------- /Subplugins/Print/plugins/TF2DodgeballPrint.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/Subplugins/Print/plugins/TF2DodgeballPrint.smx -------------------------------------------------------------------------------- /Subplugins/Votes/plugins/TF2DodgeballVotes.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/Subplugins/Votes/plugins/TF2DodgeballVotes.smx -------------------------------------------------------------------------------- /Subplugins/Trails/plugins/TF2DodgeballTrails.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/Subplugins/Trails/plugins/TF2DodgeballTrails.smx -------------------------------------------------------------------------------- /Subplugins/NoBlock/plugins/TF2DodgeballNoBlock.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/Subplugins/NoBlock/plugins/TF2DodgeballNoBlock.smx -------------------------------------------------------------------------------- /Subplugins/EventFix/plugins/TF2DodgeballEventFix.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/Subplugins/EventFix/plugins/TF2DodgeballEventFix.smx -------------------------------------------------------------------------------- /Subplugins/AntiSnipe/plugins/TF2DodgeballAntiSnipe.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/Subplugins/AntiSnipe/plugins/TF2DodgeballAntiSnipe.smx -------------------------------------------------------------------------------- /Subplugins/AntiSwitch/plugins/TF2DodgeballAntiSwitch.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/Subplugins/AntiSwitch/plugins/TF2DodgeballAntiSwitch.smx -------------------------------------------------------------------------------- /Subplugins/Speedometer/plugins/TF2DodgeballSpeedHud.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/Subplugins/Speedometer/plugins/TF2DodgeballSpeedHud.smx -------------------------------------------------------------------------------- /TF2Dodgeball/addons/sourcemod/plugins/TF2Dodgeball.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/TF2Dodgeball/addons/sourcemod/plugins/TF2Dodgeball.smx -------------------------------------------------------------------------------- /Subplugins/ExtraEvents/plugins/TF2DodgeballExtraEvents.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/Subplugins/ExtraEvents/plugins/TF2DodgeballExtraEvents.smx -------------------------------------------------------------------------------- /Subplugins/AirblastPrevention/plugins/TF2AirblastPrevention.smx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Silorak/TF2-Dodgeball-Modified/HEAD/Subplugins/AirblastPrevention/plugins/TF2AirblastPrevention.smx -------------------------------------------------------------------------------- /Subplugins/AntiSwitch/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This subplugin prevents bots (and people) from switching the target of a rocket. 4 | 5 | # Convars 6 | 7 | * `tf_dodgeball_switch_bot` - Lock targets only for bots? 8 | -------------------------------------------------------------------------------- /Subplugins/EventFix/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This subplugin is supposed to fix [this](https://github.com/x07x08/TF2-Dodgeball-Modified/issues/7) issue. 4 | 5 | If you're experiencing similar problems, installing this should help. 6 | -------------------------------------------------------------------------------- /Subplugins/NoBlock/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This subplugin prevents collision with enemies (aka blocking). 4 | 5 | It's basically [this](https://github.com/Franc1sco/SimpleAnti-StuckNoBlock) plugin but specifically made to be used for dodgeball. 6 | -------------------------------------------------------------------------------- /Subplugins/AirblastPrevention/README.md: -------------------------------------------------------------------------------- 1 | # Commands 2 | 3 | * `sm_ab` - Toggles push prevention. 4 | 5 | # Convars 6 | 7 | * `tf_dodgeball_ab_command` - Allow people to toggle airblast prevention? Turning this off also enables airblast prevention on all clients. 8 | -------------------------------------------------------------------------------- /TF2Dodgeball/cfg/sourcemod/dodgeball_enable.cfg: -------------------------------------------------------------------------------- 1 | // ---- Config file executes when the Dodgeball game mode is enabled ---- 2 | 3 | // Set the burst ammo to 0 4 | sm_cvar tf_flamethrower_burstammo 0 5 | 6 | // Disable any class restriction / fast respawn plugins here 7 | // ... 8 | 9 | // Disables arena queue 10 | sm_cvar tf_arena_use_queue 0 11 | -------------------------------------------------------------------------------- /TF2Dodgeball/cfg/sourcemod/dodgeball_disable.cfg: -------------------------------------------------------------------------------- 1 | // ---- Config file executes when the Dodgeball game mode is disabled ---- 2 | 3 | // Set the burst ammo to 25 (default) 4 | sm_cvar tf_flamethrower_burstammo 25 5 | 6 | // Reenable any class restriction / fast respawn plugins here 7 | // ... 8 | 9 | // Enables arena queue 10 | sm_cvar tf_arena_use_queue 1 11 | -------------------------------------------------------------------------------- /Subplugins/ExtraEvents/README.md: -------------------------------------------------------------------------------- 1 | # Descrption 2 | 3 | This subplugin adds a few extra events to be used with the configuration system. 4 | 5 | For now there's only one event : `on destroyed`. 6 | 7 | More details about each event can be found in the [configuration file](https://github.com/x07x08/TF2-Dodgeball-Modified/blob/main/TF2Dodgeball/addons/sourcemod/configs/dodgeball/general.cfg). 8 | -------------------------------------------------------------------------------- /Subplugins/AntiSnipe/README.md: -------------------------------------------------------------------------------- 1 | # Requirements 2 | 3 | * Optional [CollisionHook](https://forums.alliedmods.net/showthread.php?t=197815) 4 | * Download it from [here](https://github.com/Adrianilloo/Collisionhook) 5 | 6 | # Description 7 | 8 | This subplugin can be used to toggle collision and / or damage on clients if they are a rocket's target. 9 | 10 | # Convars 11 | ```c 12 | tf_dodgeball_as_damage "1" - Hook damage for anti-sniping? 13 | tf_dodgeball_as_collision "1" - Change player collisions for anti-sniping? 14 | ``` 15 | -------------------------------------------------------------------------------- /Subplugins/Menu/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This is a menu for admins to change rockets, rocket classes and spawner classes. 4 | 5 | # Commands 6 | 7 | | Commands | Description | 8 | |--------------------|-------------------------------------------| 9 | | `sm_tfdb` | Displays the dodgeball menu | 10 | 11 | # Notes 12 | 13 | Rocket class changes will not refresh the class of active rockets. 14 | 15 | To do that you have to either destroy all active rockets or reapply the class of a rocket. 16 | -------------------------------------------------------------------------------- /Subplugins/Speedometer/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This is a small HUD that shows the speed (and deflections) of a rocket. Visibility preferences are saved. 4 | 5 | # Commands 6 | 7 | | Commands | Description | 8 | |--------------------|-------------------------------------------| 9 | | `sm_rockethud` | Toggles the rocket speedometer | 10 | | `sm_rocketspeedo` | Alternative to `sm_rockethud` | 11 | 12 | # Notes 13 | 14 | To further customize the hud, check the `Hud_Speedometer` phrase inside `tfdb.phrases.txt`. 15 | -------------------------------------------------------------------------------- /Subplugins/Trails/README.md: -------------------------------------------------------------------------------- 1 |

Commands

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 | 17 | 23 | 24 | 25 |
NameDescription
10 |

sm_rockettrails

11 |

sm_hidetrails

12 | sm_toggletrails 13 |
Toggle the visibility of custom rocket particle trails.
18 |

sm_rocketsprites

19 |

sm_hidesprites

20 |

sm_togglesprites

21 | sm_rocketspritetrails 22 |
Toggle the visibility of custom rocket sprite trails.
26 | -------------------------------------------------------------------------------- /Subplugins/AntiSnipe/scripting/include/collisionhook.inc: -------------------------------------------------------------------------------- 1 | #if defined _collisionhook_included 2 | #endinput 3 | #endif 4 | #define _collisionhook_included 5 | 6 | // called when the game is performing vphysics collision checks between entities 7 | // return something other than Plugin_Continue to have the game use the result parameter 8 | forward Action CH_ShouldCollide(int ent1, int ent2, bool &result); 9 | 10 | // called when the game performs collision checks through traces (only for traces using filters) 11 | // return something other than Plugin_Continue to have the game use the result parameter 12 | // note: any code in this forward should be very performant, the game will use many filtered traces per player per game frame 13 | forward Action CH_PassFilter(int ent1, int ent2, bool &result); 14 | 15 | public Extension __ext_collisionhook = 16 | { 17 | name = "CollisionHook", 18 | file = "collisionhook.ext", 19 | 20 | #if defined AUTOLOAD_EXTENSIONS 21 | autoload = 1, 22 | #else 23 | autoload = 0, 24 | #endif 25 | #if defined REQUIRE_EXTENSIONS 26 | required = 1, 27 | #else 28 | required = 0, 29 | #endif 30 | 31 | }; 32 | -------------------------------------------------------------------------------- /Subplugins/AntiSwitch/scripting/TF2DodgeballAntiSwitch.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | #include 7 | 8 | #define PLUGIN_NAME "[TFDB] Anti switch" 9 | #define PLUGIN_AUTHOR "x07x08" 10 | #define PLUGIN_DESCRIPTION "Locks the target of any rocket" 11 | #define PLUGIN_VERSION "1.0.0" 12 | #define PLUGIN_URL "https://github.com/x07x08/TF2-Dodgeball-Modified" 13 | 14 | int g_iTarget[MAXPLAYERS + 1] = {-1, ...}; 15 | ConVar g_hCvarBotOnly; 16 | 17 | public Plugin myinfo = 18 | { 19 | name = PLUGIN_NAME, 20 | author = PLUGIN_AUTHOR, 21 | description = PLUGIN_DESCRIPTION, 22 | version = PLUGIN_VERSION, 23 | url = PLUGIN_URL 24 | }; 25 | 26 | public void OnPluginStart() 27 | { 28 | g_hCvarBotOnly = CreateConVar("tf_dodgeball_switch_bot", "1", "Lock targets only for bots?", _, true, 0.0, true, 1.0); 29 | } 30 | 31 | public void OnClientDisconnect(int iClient) 32 | { 33 | g_iTarget[iClient] = -1; 34 | } 35 | 36 | public void OnClientConnected(int iClient) 37 | { 38 | g_iTarget[iClient] = -1; 39 | } 40 | 41 | public Action TFDB_OnRocketDeflectPre(int iIndex, int iEntity, int iOwner, int &iTarget) 42 | { 43 | int iPreviousTarget = EntRefToEntIndex(g_iTarget[iOwner]); 44 | 45 | if ((iPreviousTarget == -1) || 46 | !IsPlayerAlive(iPreviousTarget) || 47 | (!(TFDB_GetRocketFlags(iIndex) & RocketFlag_IsNeutral) && (GetClientTeam(iOwner) == GetClientTeam(iPreviousTarget)))) 48 | { 49 | g_iTarget[iOwner] = EntIndexToEntRef(iTarget); 50 | iPreviousTarget = iTarget; 51 | } 52 | 53 | if (!g_hCvarBotOnly.BoolValue || IsFakeClient(iOwner)) 54 | { 55 | iTarget = iPreviousTarget; 56 | 57 | return Plugin_Changed; 58 | } 59 | 60 | return Plugin_Continue; 61 | } 62 | -------------------------------------------------------------------------------- /Subplugins/NoBlock/scripting/TF2DodgeballNoBlock.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #define PLUGIN_NAME "[TFDB] No block" 10 | #define PLUGIN_AUTHOR "x07x08" 11 | #define PLUGIN_DESCRIPTION "Removes collision between enemies." 12 | #define PLUGIN_VERSION "1.0.3" 13 | #define PLUGIN_URL "https://github.com/x07x08/TF2-Dodgeball-Modified" 14 | 15 | #define COLLISION_GROUP_PUSHAWAY 17 16 | 17 | bool g_bLoaded; 18 | 19 | public Plugin myinfo = 20 | { 21 | name = PLUGIN_NAME, 22 | author = PLUGIN_AUTHOR, 23 | description = PLUGIN_DESCRIPTION, 24 | version = PLUGIN_VERSION, 25 | url = PLUGIN_URL 26 | }; 27 | 28 | public void OnPluginStart() 29 | { 30 | if (!TFDB_IsDodgeballEnabled()) return; 31 | 32 | TFDB_OnRocketsConfigExecuted(); 33 | 34 | for (int iClient = 1; iClient <= MaxClients; iClient++) 35 | { 36 | if (!IsClientInGame(iClient) || !IsPlayerAlive(iClient)) continue; 37 | 38 | SetEntProp(iClient, Prop_Data, "m_CollisionGroup", COLLISION_GROUP_PUSHAWAY); 39 | } 40 | } 41 | 42 | public void TFDB_OnRocketsConfigExecuted() 43 | { 44 | if (g_bLoaded) return; 45 | 46 | HookEvent("player_spawn", OnPlayerSpawn); 47 | 48 | g_bLoaded = true; 49 | } 50 | 51 | public void OnMapEnd() 52 | { 53 | if (!g_bLoaded) return; 54 | 55 | UnhookEvent("player_spawn", OnPlayerSpawn); 56 | 57 | g_bLoaded = false; 58 | } 59 | 60 | public void OnPlayerSpawn(Event hEvent, char[] strEventName, bool bDontBroadcast) 61 | { 62 | int iClient = GetClientOfUserId(hEvent.GetInt("userid")); 63 | 64 | if (GetClientTeam(iClient) <= 1) return; 65 | 66 | // SetEntityCollisionGroup makes the server crash after a while. No idea why. 67 | SetEntProp(iClient, Prop_Data, "m_CollisionGroup", COLLISION_GROUP_PUSHAWAY); 68 | } 69 | -------------------------------------------------------------------------------- /Subplugins/FFA/README.md: -------------------------------------------------------------------------------- 1 |

Convars

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
NameDefault valueDescription
tf_dodgeball_ffa_bot1Disable FFA when a bot joins?
tf_dodgeball_ffa_timeout150Vote timeout (in seconds)
tf_dodgeball_ffa_duration20Vote duration (in seconds)
tf_dodgeball_ffa_mode1 28 | How does changing FFA affect the rockets?
29 | 0 - No effect, wait for the next spawn
30 | 1 - Destroy all active rockets
31 | 2 - Immediately change the rockets to be neutral 32 |
tf_dodgeball_ffa_stealing1Allow stealing in FFA mode?
tf_dodgeball_ffa_disablecfgsourcemod/dodgeball_ffa_disable.cfgConfig file to execute when disabling FFA mode
tf_dodgeball_ffa_enablecfgsourcemod/dodgeball_ffa_enable.cfgConfig file to execute when enabling FFA mode
tf_dodgeball_ffa_teams1Automatically swap players when a team is empty in FFA mode?
55 | 56 |

Commands

57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
NameDescription
sm_ffaForcefully toggle FFA
sm_voteffaStart a vote to toggle FFA
72 | -------------------------------------------------------------------------------- /Subplugins/Votes/README.md: -------------------------------------------------------------------------------- 1 |

Convars

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
NameDefault valueDescription
tf_dodgeball_votes_bounce_duration20Vote duration (in seconds) for bounce votes
tf_dodgeball_votes_class_duration20Vote duration (in seconds) for class votes
tf_dodgeball_votes_count_duration20Vote duration (in seconds) for count votes
tf_dodgeball_votes_bounce_timeout150Vote timeout (in seconds) for bounce votes
tf_dodgeball_votes_class_timeout150Vote timeout (in seconds) for class votes
tf_dodgeball_votes_count_timeout150Vote timeout (in seconds) for count votes
40 | 41 |

Commands

42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 54 | 55 | 56 | 57 | 62 | 63 | 64 | 65 | 70 | 71 | 72 |
NameDescription
50 |

sm_vrb

51 |

sm_votebounce

52 | sm_voterocketbounce 53 |
Start a vote to toggle no bounce mode.
58 |

sm_vrc

59 |

sm_voteclass

60 | sm_voterocketclass 61 |
Start a vote to change the main rocket class.
66 |

sm_vrcount

67 |

sm_votecount

68 | sm_voterocketcount 69 |
Start a vote to change the maximum rockets count.
73 | -------------------------------------------------------------------------------- /Subplugins/Print/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This subplugin can be used to print messages and replace the client indexes given by the main dodgeball plugin. 4 | 5 | To replace an index, surround it in a pair of `"##"` (without quotes). 6 | 7 | Example : `##@dead##` 8 | 9 | Colors are supported as well (uses [`multicolors.inc`](https://github.com/Bara/Multi-Colors/blob/master/addons/sourcemod/scripting/include/multicolors.inc) to compile). 10 | 11 | Example : `{steelblue}##@dead##{default}` 12 | 13 | # Commands 14 | ``` 15 | tf_dodgeball_print - Prints a message to chat and replaces client indexes inside a pair of '##' 16 | tf_dodgeball_print_c - Prints a message to a client and replaces client indexes inside a pair of '##' 17 | tf_dodgeball_phrase - Prints a translation phrase to chat (phrase and args must be surrounded by []) (phrase arguments must be separated by a comma [,]) 18 | tf_dodgeball_phrase_c - Prints a translation phrase to a client (client, phrase and args must be surrounded by []) (phrase arguments must be separated by a comma [,]) 19 | ``` 20 | 21 | # Full example 22 | 23 | Phrase inside [`tfdb.phrases.txt`](https://github.com/x07x08/TF2-Dodgeball-Modified/blob/main/TF2Dodgeball/addons/sourcemod/translations/tfdb.phrases.txt) : 24 | 25 | ``` 26 | "Dodgeball_Death_Message" 27 | { 28 | "#format" "{1:N},{2:i}" 29 | "en" "[{olive}TFDB{default}] {burlywood}{1}{default} died to a rocket travelling {red}{2}{default} MpH" 30 | } 31 | ``` 32 | 33 | Death message using `tf_dodgeball_phrase` : 34 | 35 | ``` 36 | // >>> Events <<< 37 | "on spawn" "" 38 | "on deflect" "" 39 | "on kill" "tf_dodgeball_phrase [Dodgeball_Death_Message] [@dead, @mphspeed]" 40 | "on explode" "" 41 | "on no target" "" 42 | ``` 43 | 44 | Death message using `tf_dodgeball_print` : 45 | 46 | ``` 47 | // >>> Events <<< 48 | "on spawn" "" 49 | "on deflect" "" 50 | "on kill" "tf_dodgeball_print [{olive}TFDB{default}] {burlywood}##@dead##{default} died to a rocket travelling {red}@mphspeed{default} MpH" 51 | "on explode" "" 52 | "on no target" "" 53 | ``` 54 | 55 | # Credits 56 | 1. Smlib : [GitHub Link](https://github.com/bcserv/smlib) 57 | 2. Print by Matheus28 : [AlliedMods Link](https://forums.alliedmods.net/showthread.php?p=1363600) 58 | -------------------------------------------------------------------------------- /Subplugins/EventFix/scripting/TF2DodgeballEventFix.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | 6 | #define PLUGIN_NAME "[TFDB] Event fix" 7 | #define PLUGIN_AUTHOR "x07x08" 8 | #define PLUGIN_DESCRIPTION "Fixes a very weird issue that happens when unhooking event callbacks..." 9 | #define PLUGIN_VERSION "1.0.2" 10 | #define PLUGIN_URL "https://github.com/x07x08/TF2-Dodgeball-Modified" 11 | 12 | public Plugin myinfo = 13 | { 14 | name = PLUGIN_NAME, 15 | author = PLUGIN_AUTHOR, 16 | description = PLUGIN_DESCRIPTION, 17 | version = PLUGIN_VERSION, 18 | url = PLUGIN_URL 19 | }; 20 | 21 | public void OnPluginStart() 22 | { 23 | // https://forums.alliedmods.net/showthread.php?p=2050730 24 | // 25 | // This plugin somehow made it so I didn't get any UnhookEvent errors when changing maps. 26 | // Keep in mind, those event callbacks shouldn't be related in any way with the ones from the dodgeball plugin. 27 | // That doesn't seem to be the case... 28 | // Oh well... wasted a bunch of time on this. 29 | // 30 | // Refer to : https://github.com/x07x08/TF2-Dodgeball-Modified/issues/7 31 | 32 | // https://github.com/alliedmodders/sourcemod/blob/5addaffa5665f353c874f45505914ab692535c24/core/EventManager.cpp#L262 33 | // 34 | // If n plugins try to unhook the same event (at the same time, like inside OnMapEnd), the last one always fails and 35 | // throws an EventHookErr_NotActive error. 36 | // 37 | // Example : 38 | // Plugins 1, 2 and 3 hook the "player_team" event inside OnConfigsExecuted and unhook it inside OnMapEnd. 39 | // Plugin 3 will always throw (if it was the last one loaded). 40 | // 41 | // This might happen because the event manager wrongly removes the entire event structure while the 42 | // last plugin hasn't unloaded its events (throws on line 268) or there's an off-by-one error (line(s) 295 and / or 309) 43 | // that causes the former to occur. 44 | // 45 | // This issue will not happen if the event is hooked in another plugin and never unhooked. 46 | // The best way to observe it is on a clean install of SourceMod. 47 | 48 | HookEvent("teamplay_round_start", VoidCallback); 49 | HookEvent("arena_round_start", VoidCallback); 50 | HookEvent("teamplay_round_win", VoidCallback); 51 | HookEvent("player_spawn", VoidCallback); 52 | HookEvent("player_death", VoidCallback); 53 | HookEvent("post_inventory_application", VoidCallback); 54 | HookEvent("teamplay_broadcast_audio", VoidCallback); 55 | HookEvent("object_deflected", VoidCallback); 56 | 57 | HookEvent("player_team", VoidCallback); 58 | } 59 | 60 | public void VoidCallback(Event hEvent, char[] strEventName, bool bDontBroadcast) 61 | { 62 | return; 63 | } 64 | -------------------------------------------------------------------------------- /Subplugins/AntiSnipe/scripting/TF2DodgeballAntiSnipe.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | 7 | #undef REQUIRE_EXTENSIONS 8 | #include 9 | #define REQUIRE_EXTENSIONS 10 | 11 | #include 12 | 13 | #define PLUGIN_NAME "[TFDB] Anti-Sniping & Anti-Teamkilling" 14 | #define PLUGIN_AUTHOR "x07x08" 15 | #define PLUGIN_DESCRIPTION "Blocks snipes and teamkills." 16 | #define PLUGIN_VERSION "1.2.2" 17 | #define PLUGIN_URL "https://github.com/x07x08/TF2-Dodgeball-Modified" 18 | 19 | ConVar g_hCvarHookDamage; 20 | ConVar g_hCvarHookCollision; 21 | 22 | public Plugin myinfo = 23 | { 24 | name = PLUGIN_NAME, 25 | author = PLUGIN_AUTHOR, 26 | description = PLUGIN_DESCRIPTION, 27 | version = PLUGIN_VERSION, 28 | url = PLUGIN_URL 29 | }; 30 | 31 | public void OnPluginStart() 32 | { 33 | g_hCvarHookDamage = CreateConVar("tf_dodgeball_as_damage", "1", "Hook damage for anti-sniping?", _, true, 0.0, true, 1.0); 34 | g_hCvarHookCollision = CreateConVar("tf_dodgeball_as_collision", "1", "Change player collisions for anti-sniping?", _, true, 0.0, true, 1.0); 35 | 36 | if (!TFDB_IsDodgeballEnabled()) return; 37 | 38 | for (int iClient = 1; iClient <= MaxClients; iClient++) 39 | { 40 | if (!IsClientInGame(iClient)) continue; 41 | 42 | SDKHook(iClient, SDKHook_OnTakeDamage, OnPlayerTakeDamage); 43 | } 44 | } 45 | 46 | public void OnClientPutInServer(int iClient) 47 | { 48 | if (!TFDB_IsDodgeballEnabled()) return; 49 | 50 | SDKHook(iClient, SDKHook_OnTakeDamage, OnPlayerTakeDamage); 51 | } 52 | 53 | public Action OnPlayerTakeDamage(int iVictim, int &iAttacker, int &iInflictor, float &fDamage, int &iDamageType) 54 | { 55 | if (!g_hCvarHookDamage.BoolValue) return Plugin_Continue; 56 | 57 | int iIndex = TFDB_FindRocketByEntity(iInflictor); 58 | 59 | if (iIndex == -1) return Plugin_Continue; 60 | 61 | int iTarget = EntRefToEntIndex(TFDB_GetRocketTarget(iIndex)); 62 | 63 | if (!(IsValidClient(iTarget) && (iVictim != iTarget))) return Plugin_Continue; 64 | 65 | fDamage = 0.0; 66 | 67 | return Plugin_Changed; 68 | } 69 | 70 | public Action CH_PassFilter(int iEntity1, int iEntity2, bool &bResult) 71 | { 72 | if (!TFDB_IsDodgeballEnabled() || !g_hCvarHookCollision.BoolValue) return Plugin_Continue; 73 | 74 | int iIndex1 = TFDB_FindRocketByEntity(iEntity1); 75 | int iIndex2 = TFDB_FindRocketByEntity(iEntity2); 76 | 77 | if (((iIndex1 != -1) && (EntRefToEntIndex(TFDB_GetRocketTarget(iIndex1)) != iEntity2)) 78 | || ((iIndex2 != -1) && (EntRefToEntIndex(TFDB_GetRocketTarget(iIndex2)) != iEntity1))) 79 | { 80 | bResult = false; 81 | 82 | return Plugin_Changed; 83 | } 84 | 85 | return Plugin_Continue; 86 | } 87 | 88 | stock bool IsValidClient(int iClient, bool bAlive = false) 89 | { 90 | return iClient >= 1 && 91 | iClient <= MaxClients && 92 | IsClientInGame(iClient) && 93 | (!bAlive || IsPlayerAlive(iClient)); 94 | } 95 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Convars 2 | ```ini 3 | tf_dodgeball_enablecfg "sourcemod/dodgeball_enable.cfg" - Config file to execute when enabling the Dodgeball game mode. 4 | tf_dodgeball_disablecfg "sourcemod/dodgeball_disable.cfg" - Config file to execute when disabling the Dodgeball game mode. 5 | tf_dodgeball_sp_number "3" - How many steals before you get slayed? 6 | tf_dodgeball_sp_damage "0" - Reduce all damage on stolen rockets? 7 | tf_dodgeball_sp_distance "48.0" - The distance between players for a steal to register. 8 | tf_dodgeball_delay_prevention "1" - Enable delay prevention? 9 | tf_dodgeball_dp_time "5" - How much time [in seconds] before delay prevention activates? 10 | tf_dodgeball_dp_speedup "100" - How much speed [in hammer units per second] should the rocket gain when delayed? 11 | tf_dodgeball_redirect_damage "1" - Reduce all damage when a rocket has an invalid target? 12 | tf_dodgeball_sp_message "1" - Display the steal message(s)? 13 | tf_dodgeball_dp_message "1" - Display the delay message(s)? 14 | ``` 15 | 16 | # Commands 17 | For a list of commands, check the configuration file located in [`addons/sourcemod/configs/dodgeball`](https://github.com/x07x08/TF2-Dodgeball-Modified/tree/main/TF2Dodgeball/addons/sourcemod/configs/dodgeball). 18 | 19 | # Installation 20 | 21 | 1. `TF2Dodgeball` : Its contents go inside `tf`. 22 | 2. `Subplugins` : Copy the contents of a subplugin folder (ex. `Menu`) inside `tf/addons`. 23 | - The `README.md` files can be omitted. 24 | - It's recommended to install the [`EventFix`](https://github.com/x07x08/TF2-Dodgeball-Modified/tree/main/Subplugins/EventFix) subplugin. 25 | 26 | # Requirements 27 | - [Multi-Colors](https://github.com/Bara/Multi-Colors) (compile only). 28 | - Optional [CollisionHook](https://forums.alliedmods.net/showthread.php?t=197815) (for the [Anti snipe](https://github.com/x07x08/TF2-Dodgeball-Modified/tree/main/Subplugins/AntiSnipe) plugin) 29 | * Download it from [here](https://github.com/Adrianilloo/Collisionhook) 30 | 31 | # Nuke model 32 | By default, the plugin uses a custom model for the `"nuke"` rocket class. It can be found here : [AlliedMods Link](https://forums.alliedmods.net/showpost.php?s=8fa72450fa0c4941c927d01d2d6245c9&p=2180141&postcount=350) 33 | 34 | # Features 35 | - Steal and delay prevention from updated YADBP. 36 | - "Keep direction" feature from Redux. 37 | - Steal distance CVar. 38 | - Additional parameters for internal commands. 39 | - Limits for speed and turnrate parameters. 40 | - No damage on rockets if the target suicides / disconnects (toggleable via a CVar). 41 | - No damage on stolen rockets (toggleable via a CVar). 42 | - Custom trails toggleable client-side. 43 | 44 | # Fixes 45 | - Fixed looping explosion sounds. 46 | - Fixed 0% chance rocket classes being rarely chosen. 47 | - Fixed neutral rockets. 48 | 49 | Report bugs using the [Issues](https://github.com/x07x08/TF2-Dodgeball-Modified/issues) tab. 50 | 51 | # Credits 52 | 1. The original YADB plugin by Damizean : [AlliedMods Link](https://forums.alliedmods.net/showthread.php?t=134503) 53 | 2. The updated YADB plugin by bloody & lizzy : [AlliedMods Link](https://forums.alliedmods.net/showthread.php?p=2534328) | [GitHub Account](https://github.com/keybangz) 54 | 3. Dodgeball Redux by ClassicGuzzi : [AlliedMods Link](https://forums.alliedmods.net/showthread.php?p=2226728) | [GitHub Link](https://github.com/ClassicSpeed/dodgeball) 55 | 4. BloodyNightmare and Mitchell for the original airblast prevention plugin : [AlliedMods Link](https://forums.alliedmods.net/showthread.php?t=233475) 56 | 5. Syntax converter batch by Dragokas : [AlliedMods Link](https://forums.alliedmods.net/showpost.php?p=2593268&postcount=54) 57 | -------------------------------------------------------------------------------- /Subplugins/AirblastPrevention/scripting/TF2AirblastPrevention.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #define PLUGIN_NAME "[TFDB] Airblast push prevention" 11 | #define PLUGIN_AUTHOR "BloodyNightmare, Mitchell, edited by x07x08" 12 | #define PLUGIN_DESCRIPTION "Prevents users from pushing each other by airblasting." 13 | #define PLUGIN_VERSION "1.2.2" 14 | #define PLUGIN_URL "https://github.com/x07x08/TF2-Dodgeball-Modified" 15 | 16 | ConVar g_hCvarCommandEnabled; 17 | bool g_bClientEnabled[MAXPLAYERS + 1] = {true, ...}; 18 | bool g_bLoaded; 19 | 20 | public Plugin myinfo = 21 | { 22 | name = PLUGIN_NAME, 23 | author = PLUGIN_AUTHOR, 24 | description = PLUGIN_DESCRIPTION, 25 | version = PLUGIN_VERSION, 26 | url = PLUGIN_URL 27 | }; 28 | 29 | public void OnPluginStart() 30 | { 31 | LoadTranslations("tfdb.phrases.txt"); 32 | 33 | g_hCvarCommandEnabled = CreateConVar("tf_dodgeball_ab_command", "1", "Allow people to toggle airblast prevention?\n Turning this off also enables airblast prevention on all clients.", _, true, 0.0, true, 1.0); 34 | 35 | RegConsoleCmd("sm_ab", CmdAirblastPrevention, "Toggles push prevention."); 36 | 37 | if (!TFDB_IsDodgeballEnabled()) return; 38 | 39 | TFDB_OnRocketsConfigExecuted(); 40 | 41 | for (int iClient = 1; iClient <= MaxClients; iClient++) 42 | { 43 | if (!IsClientInGame(iClient)) continue; 44 | 45 | SDKHook(iClient, SDKHook_WeaponCanUse, WeaponCanUseCallback); 46 | 47 | // Enabled by default 48 | SetEntityFlags(iClient, GetEntityFlags(iClient) | FL_NOTARGET); 49 | } 50 | } 51 | 52 | public void TFDB_OnRocketsConfigExecuted() 53 | { 54 | if (g_bLoaded) return; 55 | 56 | HookEvent("player_spawn", OnPlayerSpawn); 57 | HookEvent("player_death", OnPlayerDeath); 58 | 59 | g_hCvarCommandEnabled.AddChangeHook(CvarCommandCallback); 60 | 61 | g_bLoaded = true; 62 | } 63 | 64 | public void OnMapEnd() 65 | { 66 | if (!g_bLoaded) return; 67 | 68 | UnhookEvent("player_spawn", OnPlayerSpawn); 69 | UnhookEvent("player_death", OnPlayerDeath); 70 | 71 | g_hCvarCommandEnabled.RemoveChangeHook(CvarCommandCallback); 72 | 73 | g_bLoaded = false; 74 | } 75 | 76 | public void OnPlayerSpawn(Event hEvent, char[] strEventName, bool bDontBroadcast) 77 | { 78 | int iClient = GetClientOfUserId(hEvent.GetInt("userid")); 79 | 80 | if (g_bClientEnabled[iClient]) 81 | { 82 | // Sound issue. 83 | SetEntityFlags(iClient, GetEntityFlags(iClient) | FL_NOTARGET); 84 | } 85 | } 86 | 87 | public void OnPlayerDeath(Event hEvent, char[] strEventName, bool bDontBroadcast) 88 | { 89 | int iClient = GetClientOfUserId(hEvent.GetInt("userid")); 90 | 91 | // If you spectate an enemy, he will "airblast" you. 92 | // Forcefully adding FL_NOTARGET seems to fix the problem. 93 | SetEntityFlags(iClient, GetEntityFlags(iClient) | FL_NOTARGET); 94 | } 95 | 96 | public Action CmdAirblastPrevention(int iClient, int iArgs) 97 | { 98 | if (iClient == 0) 99 | { 100 | ReplyToCommand(iClient, "Command is in-game only."); 101 | 102 | return Plugin_Handled; 103 | } 104 | 105 | if (!TFDB_IsDodgeballEnabled() || !g_hCvarCommandEnabled.BoolValue) 106 | { 107 | CReplyToCommand(iClient, "%t", "Command_Disabled"); 108 | 109 | return Plugin_Handled; 110 | } 111 | 112 | g_bClientEnabled[iClient] = !g_bClientEnabled[iClient]; 113 | 114 | if (IsPlayerAlive(iClient)) 115 | { 116 | ToggleAirblastPrevention(iClient); 117 | } 118 | 119 | CReplyToCommand(iClient, "%t", g_bClientEnabled[iClient] ? "Dodgeball_AirblastPreventionCmd_Enabled" : "Dodgeball_AirblastPreventionCmd_Disabled"); 120 | 121 | return Plugin_Handled; 122 | } 123 | 124 | public void OnClientDisconnect(int iClient) 125 | { 126 | g_bClientEnabled[iClient] = false; 127 | } 128 | 129 | public void OnClientConnected(int iClient) 130 | { 131 | g_bClientEnabled[iClient] = true; 132 | } 133 | 134 | public void OnClientPutInServer(int iClient) 135 | { 136 | if (!g_bLoaded) return; 137 | 138 | SDKHook(iClient, SDKHook_WeaponCanUse, WeaponCanUseCallback); 139 | } 140 | 141 | // https://forums.alliedmods.net/showthread.php?t=265707 142 | // SDKHook_WeaponCanUse fires for any weapon change (including pickup) 143 | 144 | public Action WeaponCanUseCallback(int iClient, int iWeapon) 145 | { 146 | int iFlags = GetEntityFlags(iClient); 147 | 148 | if (!(iFlags & FL_NOTARGET)) return Plugin_Continue; 149 | 150 | SetEntityFlags(iClient, iFlags & ~FL_NOTARGET); 151 | 152 | RequestFrame(ResetAirblastPrevention, GetClientUserId(iClient)); 153 | 154 | return Plugin_Continue; 155 | } 156 | 157 | public void ResetAirblastPrevention(any iUserId) 158 | { 159 | int iClient = GetClientOfUserId(iUserId); 160 | 161 | if (iClient == 0 || !IsClientInGame(iClient) || !g_bClientEnabled[iClient]) return; 162 | 163 | SetEntityFlags(iClient, GetEntityFlags(iClient) | FL_NOTARGET); 164 | } 165 | 166 | void ToggleAirblastPrevention(int iClient) 167 | { 168 | int iFlags = GetEntityFlags(iClient); 169 | 170 | SetEntityFlags(iClient, g_bClientEnabled[iClient] ? iFlags | FL_NOTARGET : iFlags & ~FL_NOTARGET); 171 | } 172 | 173 | public void CvarCommandCallback(ConVar hConVar, const char[] strOldValue, const char[] strNewValue) 174 | { 175 | if (hConVar.BoolValue) return; 176 | 177 | for (int iClient = 1; iClient <= MaxClients; iClient++) 178 | { 179 | if (!IsClientInGame(iClient)) continue; 180 | 181 | g_bClientEnabled[iClient] = true; 182 | 183 | if (IsPlayerAlive(iClient)) SetEntityFlags(iClient, GetEntityFlags(iClient) | FL_NOTARGET); 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /Subplugins/Trails/scripting/include/tfdbtrails.inc: -------------------------------------------------------------------------------- 1 | #if defined _tfdbtrails_included 2 | #endinput 3 | #endif 4 | #define _tfdbtrails_included 5 | 6 | #define ROCKET_MODEL "models/weapons/w_models/w_rocket.mdl" 7 | #define ROCKET_CRIT_BLU "critical_rocket_blue" 8 | #define ROCKET_CRIT_RED "critical_rocket_red" 9 | #define ROCKET_TRAIL_FIRE "rockettrail_fire" 10 | #define EMPTY_MODEL "models/empty.mdl" 11 | 12 | enum TrailFlags 13 | { 14 | TrailFlag_None = 0, 15 | TrailFlag_CustomTrail = 1 << 0, 16 | TrailFlag_CustomSprite = 1 << 1, 17 | TrailFlag_RemoveParticles = 1 << 2, 18 | TrailFlag_ReplaceParticles = 1 << 3 19 | }; 20 | 21 | /** 22 | * Gets the fake entity reference of a rocket. 23 | * 24 | * @note Make sure to check if the rocket has the "RocketFlag_RemoveParticles" flag. 25 | * 26 | * @param iIndex Rocket index. 27 | * @return Fake entity reference. 28 | * @error Invalid index. 29 | */ 30 | 31 | native int TFDB_GetRocketFakeEntity(int iIndex); 32 | 33 | /** 34 | * Sets the fake entity reference of a rocket. 35 | * 36 | * @note Make sure to check if the rocket has the "RocketFlag_RemoveParticles" flag. 37 | * 38 | * @param iIndex Rocket index. 39 | * @param iFakeEntity New fake entity reference. 40 | * @noreturn 41 | * @error Invalid index. 42 | */ 43 | 44 | native void TFDB_SetRocketFakeEntity(int iIndex, int iFakeEntity); 45 | 46 | /** 47 | * Gets the trail particle of a rocket class. 48 | * 49 | * @param iClass Rocket class. 50 | * @param strBuffer Buffer to store the trail particle of the rocket class. 51 | * @param iMaxLen Size of the buffer array. 52 | * @noreturn 53 | * @error Invalid rocket class. 54 | */ 55 | 56 | native void TFDB_GetRocketClassTrail(int iClass, char[] strBuffer, int iMaxLen); 57 | 58 | /** 59 | * Sets the trail particle of a rocket class. 60 | * 61 | * @param iClass Rocket class. 62 | * @param strPath New rocket class trail particle. 63 | * @noreturn 64 | * @error Invalid rocket class. 65 | */ 66 | 67 | native void TFDB_SetRocketClassTrail(int iClass, const char[] strPath); 68 | 69 | /** 70 | * Gets the sprite trail material path of a rocket class (no extension). 71 | * 72 | * @param iClass Rocket class. 73 | * @param strBuffer Buffer to store the sprite trail material path of the rocket class. 74 | * @param iMaxLen Size of the buffer array. 75 | * @noreturn 76 | * @error Invalid rocket class. 77 | */ 78 | 79 | native void TFDB_GetRocketClassSprite(int iClass, char[] strBuffer, int iMaxLen); 80 | 81 | /** 82 | * Sets the sprite trail material path of a rocket class (no extension). 83 | * 84 | * @param iClass Rocket class. 85 | * @param strPath New rocket class sprite trail material path. 86 | * @noreturn 87 | * @error Invalid rocket class. 88 | */ 89 | 90 | native void TFDB_SetRocketClassSprite(int iClass, const char[] strPath); 91 | 92 | /** 93 | * Gets the sprite trail color of a rocket class. 94 | * 95 | * @param iClass Rocket class. 96 | * @param strBuffer Buffer to store the sprite trail color of the rocket class. 97 | * @param iMaxLen Size of the buffer array. 98 | * @noreturn 99 | * @error Invalid rocket class. 100 | */ 101 | 102 | native void TFDB_GetRocketClassSpriteColor(int iClass, char[] strBuffer, int iMaxLen); 103 | 104 | /** 105 | * Sets the sprite trail color of a rocket class. 106 | * 107 | * @param iClass Rocket class. 108 | * @param strBuffer New rocket class sprite trail color. 109 | * @noreturn 110 | * @error Invalid rocket class. 111 | */ 112 | 113 | native void TFDB_SetRocketClassSpriteColor(int iClass, const char[] strBuffer); 114 | 115 | /** 116 | * Gets the sprite trail lifetime of a rocket class. 117 | * 118 | * @param iClass Rocket class. 119 | * @return Rocket class sprite trail lifetime. 120 | * @error Invalid rocket class. 121 | */ 122 | 123 | native float TFDB_GetRocketClassSpriteLifetime(int iClass); 124 | 125 | /** 126 | * Sets the sprite trail lifetime of a rocket class. 127 | * 128 | * @param iClass Rocket class. 129 | * @param fLifetime New rocket class sprite trail lifetime. 130 | * @noreturn 131 | * @error Invalid rocket class. 132 | */ 133 | 134 | native void TFDB_SetRocketClassSpriteLifetime(int iClass, float fLifetime); 135 | 136 | /** 137 | * Gets the sprite trail start width of a rocket class. 138 | * 139 | * @param iClass Rocket class. 140 | * @return Rocket class sprite trail start width. 141 | * @error Invalid rocket class. 142 | */ 143 | 144 | native float TFDB_GetRocketClassSpriteStartWidth(int iClass); 145 | 146 | /** 147 | * Sets the sprite trail start width of a rocket class. 148 | * 149 | * @param iClass Rocket class. 150 | * @param fWidth New rocket class sprite trail start width. 151 | * @noreturn 152 | * @error Invalid rocket class. 153 | */ 154 | 155 | native void TFDB_SetRocketClassSpriteStartWidth(int iClass, float fWidth); 156 | 157 | /** 158 | * Gets the sprite trail end width of a rocket class. 159 | * 160 | * @param iClass Rocket class. 161 | * @return Rocket class sprite trail end width. 162 | * @error Invalid rocket class. 163 | */ 164 | 165 | native float TFDB_GetRocketClassSpriteEndWidth(int iClass); 166 | 167 | /** 168 | * Sets the sprite trail end width of a rocket class. 169 | * 170 | * @param iClass Rocket class. 171 | * @param fWidth New rocket class sprite trail end width. 172 | * @noreturn 173 | * @error Invalid rocket class. 174 | */ 175 | 176 | native void TFDB_SetRocketClassSpriteEndWidth(int iClass, float fWidth); 177 | 178 | /** 179 | * Gets the sprite texture resolution of a rocket class. 180 | * 181 | * @param iClass Rocket class. 182 | * @return Rocket class sprite texture resolution. 183 | * @error Invalid rocket class. 184 | */ 185 | 186 | native float TFDB_GetRocketClassTextureRes(int iClass); 187 | 188 | /** 189 | * Sets the sprite texture resolution of a rocket class. 190 | * 191 | * @param iClass Rocket class. 192 | * @param fResolution New rocket class sprite texture resolution. 193 | * @noreturn 194 | * @error Invalid rocket class. 195 | */ 196 | 197 | native void TFDB_SetRocketClassTextureRes(int iClass, float fResolution); 198 | 199 | /** 200 | * Gets the trail flags of a rocket class. 201 | * 202 | * @param iClass Rocket class. 203 | * @return Rocket class trail flags. 204 | * @error Invalid rocket class. 205 | */ 206 | 207 | native TrailFlags TFDB_GetRocketClassTrailFlags(int iClass); 208 | 209 | /** 210 | * Sets the trail flags of a rocket class. 211 | * 212 | * @param iClass Rocket class. 213 | * @param iFlags New rocket class trail flags. 214 | * @noreturn 215 | * @error Invalid rocket class. 216 | */ 217 | 218 | native void TFDB_SetRocketClassTrailFlags(int iClass, TrailFlags iFlags); 219 | 220 | public SharedPlugin __pl_TFDBTrails = 221 | { 222 | name = "tfdbtrails", 223 | file = "TF2DodgeballTrails.smx", 224 | 225 | #if defined REQUIRE_PLUGIN 226 | required=1, 227 | #else 228 | required=0, 229 | #endif 230 | }; 231 | 232 | #if !defined REQUIRE_PLUGIN 233 | public void __pl_TFDBTrails_SetNTVOptional() 234 | { 235 | MarkNativeAsOptional("TFDB_GetRocketFakeEntity"); 236 | MarkNativeAsOptional("TFDB_SetRocketFakeEntity"); 237 | MarkNativeAsOptional("TFDB_GetRocketClassTrail"); 238 | MarkNativeAsOptional("TFDB_SetRocketClassTrail"); 239 | MarkNativeAsOptional("TFDB_GetRocketClassSprite"); 240 | MarkNativeAsOptional("TFDB_SetRocketClassSprite"); 241 | MarkNativeAsOptional("TFDB_GetRocketClassSpriteColor"); 242 | MarkNativeAsOptional("TFDB_SetRocketClassSpriteColor"); 243 | MarkNativeAsOptional("TFDB_GetRocketClassSpriteLifetime"); 244 | MarkNativeAsOptional("TFDB_SetRocketClassSpriteLifetime"); 245 | MarkNativeAsOptional("TFDB_GetRocketClassSpriteStartWidth"); 246 | MarkNativeAsOptional("TFDB_SetRocketClassSpriteStartWidth"); 247 | MarkNativeAsOptional("TFDB_GetRocketClassSpriteEndWidth"); 248 | MarkNativeAsOptional("TFDB_SetRocketClassSpriteEndWidth"); 249 | MarkNativeAsOptional("TFDB_GetRocketClassTextureRes"); 250 | MarkNativeAsOptional("TFDB_SetRocketClassTextureRes"); 251 | MarkNativeAsOptional("TFDB_GetRocketClassTrailFlags"); 252 | MarkNativeAsOptional("TFDB_SetRocketClassTrailFlags"); 253 | } 254 | #endif 255 | -------------------------------------------------------------------------------- /Subplugins/ExtraEvents/scripting/TF2DodgeballExtraEvents.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #define PLUGIN_NAME "[TFDB] Extra events" 10 | #define PLUGIN_AUTHOR "x07x08" 11 | #define PLUGIN_DESCRIPTION "Adds more events for use with external commands." 12 | #define PLUGIN_VERSION "1.0.1" 13 | #define PLUGIN_URL "https://github.com/x07x08/TF2-Dodgeball-Modified" 14 | 15 | int g_iRocketClassCount; 16 | 17 | DataPack g_hRocketClassCmdsOnDestroyed[MAX_ROCKET_CLASSES]; 18 | 19 | public Plugin myinfo = 20 | { 21 | name = PLUGIN_NAME, 22 | author = PLUGIN_AUTHOR, 23 | description = PLUGIN_DESCRIPTION, 24 | version = PLUGIN_VERSION, 25 | url = PLUGIN_URL 26 | }; 27 | 28 | public void OnPluginStart() 29 | { 30 | if (!TFDB_IsDodgeballEnabled()) return; 31 | 32 | TFDB_OnRocketsConfigExecuted("general.cfg"); 33 | 34 | for (int iIndex = 0; iIndex < MAX_ROCKETS; iIndex++) 35 | { 36 | if (!TFDB_IsValidRocket(iIndex)) continue; 37 | 38 | SDKHook(EntRefToEntIndex(TFDB_GetRocketEntity(iIndex)), SDKHook_Touch, OnTouch); 39 | } 40 | } 41 | 42 | public void TFDB_OnRocketsConfigExecuted(const char[] strConfigFile) 43 | { 44 | if (!(strcmp(strConfigFile, "general.cfg") == 0)) return; 45 | 46 | for (int iIndex = 0; iIndex < g_iRocketClassCount; iIndex++) 47 | { 48 | delete g_hRocketClassCmdsOnDestroyed[iIndex]; 49 | } 50 | 51 | g_iRocketClassCount = 0; 52 | 53 | ParseConfigurations(strConfigFile); 54 | } 55 | 56 | public void OnMapEnd() 57 | { 58 | for (int iIndex = 0; iIndex < g_iRocketClassCount; iIndex++) 59 | { 60 | delete g_hRocketClassCmdsOnDestroyed[iIndex]; 61 | } 62 | 63 | g_iRocketClassCount = 0; 64 | } 65 | 66 | void ParseConfigurations(const char[] strConfigFile) 67 | { 68 | char strPath[PLATFORM_MAX_PATH]; 69 | char strFileName[PLATFORM_MAX_PATH]; 70 | FormatEx(strFileName, sizeof(strFileName), "configs/dodgeball/%s", strConfigFile); 71 | BuildPath(Path_SM, strPath, sizeof(strPath), strFileName); 72 | 73 | if (!FileExists(strPath, true)) return; 74 | 75 | KeyValues kvConfig = new KeyValues("TF2_Dodgeball"); 76 | 77 | if (kvConfig.ImportFromFile(strPath) == false) SetFailState("Error while parsing the configuration file."); 78 | 79 | kvConfig.GotoFirstSubKey(); 80 | 81 | do 82 | { 83 | char strSection[64]; kvConfig.GetSectionName(strSection, sizeof(strSection)); 84 | 85 | if (StrEqual(strSection, "classes")) ParseClasses(kvConfig); 86 | } 87 | while (kvConfig.GotoNextKey()); 88 | 89 | delete kvConfig; 90 | } 91 | 92 | void ParseClasses(KeyValues kvConfig) 93 | { 94 | char strBuffer[256]; 95 | 96 | kvConfig.GotoFirstSubKey(); 97 | do 98 | { 99 | int iIndex = g_iRocketClassCount; 100 | 101 | kvConfig.GetString("on destroyed", strBuffer, sizeof(strBuffer)); 102 | g_hRocketClassCmdsOnDestroyed[iIndex] = ParseCommands(strBuffer); 103 | 104 | g_iRocketClassCount++; 105 | } 106 | while (kvConfig.GotoNextKey()); 107 | 108 | kvConfig.GoBack(); 109 | } 110 | 111 | DataPack ParseCommands(char[] strLine) 112 | { 113 | TrimString(strLine); 114 | 115 | if (!strLine[0]) 116 | { 117 | return null; 118 | } 119 | 120 | char strStrings[8][255]; 121 | int iNumStrings = ExplodeString(strLine, ";", strStrings, 8, 255); 122 | 123 | DataPack hDataPack = new DataPack(); 124 | hDataPack.WriteCell(iNumStrings); 125 | 126 | for (int i = 0; i < iNumStrings; i++) 127 | { 128 | hDataPack.WriteString(strStrings[i]); 129 | } 130 | 131 | return hDataPack; 132 | } 133 | 134 | void ExecuteCommands(DataPack hDataPack, 135 | int iClass, 136 | int iRocket, 137 | int iOwner, 138 | int iTarget, 139 | int iLastDead, 140 | float fSpeed, 141 | int iNumDeflections, 142 | float fMphSpeed) 143 | { 144 | hDataPack.Reset(false); 145 | int iNumCommands = hDataPack.ReadCell(); 146 | 147 | while (iNumCommands-- > 0) 148 | { 149 | static char strCmd[256], strBuffer[32]; 150 | 151 | hDataPack.ReadString(strCmd, sizeof(strCmd)); 152 | ReplaceString(strCmd, sizeof(strCmd), "@name", GetRocketClassLongName(iClass)); 153 | FormatEx(strBuffer, sizeof(strBuffer), "%i", iRocket); ReplaceString(strCmd, sizeof(strCmd), "@rocket", strBuffer); 154 | FormatEx(strBuffer, sizeof(strBuffer), "%i", iOwner); ReplaceString(strCmd, sizeof(strCmd), "@owner", strBuffer); 155 | FormatEx(strBuffer, sizeof(strBuffer), "%i", iTarget); ReplaceString(strCmd, sizeof(strCmd), "@target", strBuffer); 156 | FormatEx(strBuffer, sizeof(strBuffer), "%i", iLastDead); ReplaceString(strCmd, sizeof(strCmd), "@dead", strBuffer); 157 | FormatEx(strBuffer, sizeof(strBuffer), "%i", iNumDeflections); ReplaceString(strCmd, sizeof(strCmd), "@deflections", strBuffer); 158 | FormatEx(strBuffer, sizeof(strBuffer), "%f", fSpeed); ReplaceString(strCmd, sizeof(strCmd), "@speed", strBuffer); 159 | FormatEx(strBuffer, sizeof(strBuffer), "%i", RoundToNearest(fMphSpeed)); ReplaceString(strCmd, sizeof(strCmd), "@mphspeed", strBuffer); 160 | FormatEx(strBuffer, sizeof(strBuffer), "%i", RoundToNearest(fSpeed * 0.042614)); ReplaceString(strCmd, sizeof(strCmd), "@capmphspeed", strBuffer); 161 | FormatEx(strBuffer, sizeof(strBuffer), "%f", fMphSpeed / 0.042614); ReplaceString(strCmd, sizeof(strCmd), "@nocapspeed", strBuffer); 162 | FormatEx(strBuffer, sizeof(strBuffer), "%.2f", fSpeed); ReplaceString(strCmd, sizeof(strCmd), "@2dspeed", strBuffer); 163 | FormatEx(strBuffer, sizeof(strBuffer), "%.2f", fMphSpeed / 0.042614); ReplaceString(strCmd, sizeof(strCmd), "@2dnocapspeed", strBuffer); 164 | 165 | ServerCommand(strCmd); 166 | } 167 | } 168 | 169 | public void TFDB_OnRocketCreated(int iIndex, int iEntity) 170 | { 171 | SDKHook(iEntity, SDKHook_Touch, OnTouch); 172 | } 173 | 174 | public Action OnTouch(int iEntity, int iOther) 175 | { 176 | int iIndex = TFDB_FindRocketByEntity(iEntity); 177 | 178 | if (iIndex == -1) return Plugin_Continue; 179 | 180 | int iClass = TFDB_GetRocketClass(iIndex); 181 | 182 | if (g_hRocketClassCmdsOnDestroyed[iClass] == null) return Plugin_Continue; 183 | 184 | DataPack hTouchInfo = new DataPack(); 185 | 186 | hTouchInfo.WriteCell(iClass); 187 | hTouchInfo.WriteCell(EntIndexToEntRef(iEntity)); 188 | hTouchInfo.WriteCell(EntIndexToEntRef(GetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity"))); 189 | hTouchInfo.WriteCell(TFDB_GetRocketTarget(iIndex)); 190 | hTouchInfo.WriteCell(EntIndexToEntRef(TFDB_GetLastDeadClient())); 191 | hTouchInfo.WriteCell(TFDB_GetRocketSpeed(iIndex)); 192 | hTouchInfo.WriteCell(TFDB_GetRocketEventDeflections(iIndex)); 193 | hTouchInfo.WriteCell(TFDB_GetRocketMphSpeed(iIndex)); 194 | hTouchInfo.WriteCell(((iOther > 0) && (iOther <= MaxClients)) ? GetClientUserId(iOther) : -1); 195 | 196 | RequestFrame(TouchRequestFrame, hTouchInfo); 197 | 198 | return Plugin_Continue; 199 | } 200 | 201 | public void TouchRequestFrame(DataPack hTouchInfo) 202 | { 203 | hTouchInfo.Reset(); 204 | 205 | int iClass = hTouchInfo.ReadCell(); 206 | int iRocket = EntRefToEntIndex(hTouchInfo.ReadCell()); 207 | int iOwner = EntRefToEntIndex(hTouchInfo.ReadCell()); 208 | int iTarget = EntRefToEntIndex(hTouchInfo.ReadCell()); 209 | int iLastDead = EntRefToEntIndex(hTouchInfo.ReadCell()); 210 | float fSpeed = hTouchInfo.ReadCell(); 211 | int iNumDeflections = hTouchInfo.ReadCell(); 212 | float fMphSpeed = hTouchInfo.ReadCell(); 213 | 214 | int iOther = hTouchInfo.ReadCell(); 215 | 216 | delete hTouchInfo; 217 | 218 | if (iRocket != -1) return; 219 | 220 | if (iOther != -1) 221 | { 222 | if (((iOther = GetClientOfUserId(iOther)) == 0) || 223 | !(IsClientInGame(iOther) && IsPlayerAlive(iOther))) 224 | { 225 | return; 226 | } 227 | 228 | iTarget = iOther; 229 | } 230 | 231 | ExecuteCommands(g_hRocketClassCmdsOnDestroyed[iClass], 232 | iClass, 233 | iRocket, 234 | iOwner, 235 | iTarget, 236 | iLastDead, 237 | fSpeed, 238 | iNumDeflections, 239 | fMphSpeed); 240 | } 241 | 242 | char[] GetRocketClassLongName(int iClass) 243 | { 244 | char strBuffer[32]; TFDB_GetRocketClassLongName(iClass, strBuffer, sizeof(strBuffer)); 245 | 246 | return strBuffer; 247 | } 248 | -------------------------------------------------------------------------------- /Subplugins/Speedometer/scripting/TF2DodgeballSpeedHud.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #define PLUGIN_NAME "[TFDB] Rocket Speedometer" 12 | #define PLUGIN_AUTHOR "x07x08" 13 | #define PLUGIN_DESCRIPTION "Shows the speed of the last deflected rocket" 14 | #define PLUGIN_VERSION "1.1.2" 15 | #define PLUGIN_URL "https://github.com/x07x08/TF2-Dodgeball-Modified" 16 | 17 | int g_iLastRocket = -1; 18 | bool g_bShowHud[MAXPLAYERS + 1]; 19 | char g_strMultiHudText[225]; // This seems to be limit for ShowHudText / ShowSyncHudText 20 | Cookie g_hCookieShowHud; 21 | Handle g_hHudTimer; 22 | Handle g_hMainHudSync; 23 | Handle g_hMultiHudSync; 24 | bool g_bLoaded; 25 | 26 | public Plugin myinfo = 27 | { 28 | name = PLUGIN_NAME, 29 | author = PLUGIN_AUTHOR, 30 | description = PLUGIN_DESCRIPTION, 31 | version = PLUGIN_VERSION, 32 | url = PLUGIN_URL 33 | }; 34 | 35 | public void OnPluginStart() 36 | { 37 | LoadTranslations("tfdb.phrases.txt"); 38 | 39 | RegConsoleCmd("sm_rockethud", CmdToggleSpeedometer); 40 | RegConsoleCmd("sm_rocketspeedo", CmdToggleSpeedometer); 41 | 42 | g_hCookieShowHud = new Cookie("tfdb_rockethud", "Show rocket speedometer", CookieAccess_Protected); 43 | 44 | if (!TFDB_IsDodgeballEnabled()) return; 45 | 46 | for (int iClient = 1; iClient <= MaxClients; iClient++) 47 | { 48 | if (!AreClientCookiesCached(iClient)) continue; 49 | 50 | OnClientCookiesCached(iClient); 51 | } 52 | 53 | TFDB_OnRocketsConfigExecuted(); 54 | 55 | if (TFDB_GetRoundStarted()) 56 | { 57 | g_iLastRocket = FindLastRocket(); 58 | g_strMultiHudText = "\0"; 59 | 60 | g_hHudTimer = CreateTimer(0.1, HudTimerCallback, _, TIMER_REPEAT); 61 | } 62 | } 63 | 64 | public void OnMapEnd() 65 | { 66 | if (!g_bLoaded) return; 67 | 68 | g_iLastRocket = -1; 69 | g_strMultiHudText = "\0"; 70 | 71 | if (g_hHudTimer != null) KillTimer(g_hHudTimer); 72 | g_hHudTimer = null; 73 | 74 | delete g_hMainHudSync; 75 | delete g_hMultiHudSync; 76 | 77 | UnhookEvent("teamplay_round_win", OnRoundEnd); 78 | UnhookEvent("arena_round_start", OnSetupFinished); 79 | 80 | g_bLoaded = false; 81 | } 82 | 83 | public void TFDB_OnRocketsConfigExecuted() 84 | { 85 | if (g_bLoaded) return; 86 | 87 | g_hMainHudSync = CreateHudSynchronizer(); 88 | g_hMultiHudSync = CreateHudSynchronizer(); 89 | 90 | HookEvent("teamplay_round_win", OnRoundEnd); 91 | HookEvent("arena_round_start", OnSetupFinished); 92 | 93 | g_bLoaded = true; 94 | } 95 | 96 | public void OnClientDisconnect(int iClient) 97 | { 98 | g_bShowHud[iClient] = false; 99 | } 100 | 101 | public void OnClientConnected(int iClient) 102 | { 103 | g_bShowHud[iClient] = true; 104 | } 105 | 106 | public void OnClientCookiesCached(int iClient) 107 | { 108 | char strValue[4]; g_hCookieShowHud.Get(iClient, strValue, sizeof(strValue)); 109 | 110 | // Taken from FF2 111 | if (!strValue[0]) 112 | { 113 | g_hCookieShowHud.Set(iClient, "1"); 114 | strValue = "1"; 115 | } 116 | 117 | g_bShowHud[iClient] = !!StringToInt(strValue); 118 | } 119 | 120 | public void OnRoundEnd(Event hEvent, char[] strEventName, bool bDontBroadcast) 121 | { 122 | g_iLastRocket = -1; 123 | g_strMultiHudText = "\0"; 124 | 125 | if (g_hHudTimer != null) 126 | { 127 | KillTimer(g_hHudTimer); 128 | g_hHudTimer = null; 129 | } 130 | 131 | for (int iClient = 1; iClient <= MaxClients; iClient++) 132 | { 133 | if (!IsClientInGame(iClient)) continue; 134 | 135 | ClearSyncHud(iClient, g_hMainHudSync); 136 | ClearSyncHud(iClient, g_hMultiHudSync); 137 | } 138 | } 139 | 140 | public void OnSetupFinished(Event hEvent, char[] strEventName, bool bDontBroadcast) 141 | { 142 | if (!BothTeamsPlaying()) return; 143 | 144 | g_iLastRocket = -1; 145 | g_strMultiHudText = "\0"; 146 | 147 | g_hHudTimer = CreateTimer(0.1, HudTimerCallback, _, TIMER_REPEAT); 148 | } 149 | 150 | public Action CmdToggleSpeedometer(int iClient, int iArgs) 151 | { 152 | if (iClient == 0) 153 | { 154 | ReplyToCommand(iClient, "Command is in-game only."); 155 | 156 | return Plugin_Handled; 157 | } 158 | 159 | if (!TFDB_IsDodgeballEnabled()) 160 | { 161 | CReplyToCommand(iClient, "%t", "Command_Disabled"); 162 | 163 | return Plugin_Handled; 164 | } 165 | 166 | g_bShowHud[iClient] = !g_bShowHud[iClient]; 167 | 168 | char strValue[4]; IntToString(g_bShowHud[iClient], strValue, sizeof(strValue)); 169 | g_hCookieShowHud.Set(iClient, strValue); 170 | 171 | if (!g_bShowHud[iClient]) 172 | { 173 | ClearSyncHud(iClient, g_hMainHudSync); 174 | ClearSyncHud(iClient, g_hMultiHudSync); 175 | } 176 | 177 | CReplyToCommand(iClient, "%t", g_bShowHud[iClient] ? "Hud_Enabled" : "Hud_Disabled"); 178 | 179 | return Plugin_Handled; 180 | } 181 | 182 | public Action TFDB_OnRocketDeflectPre(int iIndex) 183 | { 184 | g_iLastRocket = iIndex; 185 | 186 | ShowMainRocketHudAll(iIndex); 187 | 188 | return Plugin_Continue; 189 | } 190 | 191 | public void TFDB_OnRocketCreated(int iIndex) 192 | { 193 | g_iLastRocket = iIndex; 194 | 195 | ShowMainRocketHudAll(iIndex); 196 | } 197 | 198 | // https://forums.alliedmods.net/showthread.php?t=208847 199 | 200 | public Action HudTimerCallback(Handle hTimer) 201 | { 202 | for (int iClient = 1; iClient <= MaxClients; iClient++) 203 | { 204 | if (!IsClientInGame(iClient) || !g_bShowHud[iClient]) continue; 205 | 206 | g_strMultiHudText = "\0"; 207 | 208 | for (int iIndex = 0; iIndex < MAX_ROCKETS; iIndex++) 209 | { 210 | if (!TFDB_IsValidRocket(iIndex)) continue; 211 | 212 | if (iIndex == g_iLastRocket) 213 | { 214 | ShowMainRocketHud(iClient, iIndex); 215 | } 216 | else 217 | { 218 | FormatMultiRocketHud(iClient, iIndex, g_strMultiHudText, sizeof(g_strMultiHudText)); 219 | } 220 | } 221 | 222 | if (g_strMultiHudText[0]) 223 | { 224 | SetHudTextParams(0.05, 0.05, 0.1, 255, 255, 255, 255, 0, 0.0, 0.12, 0.12); 225 | 226 | ShowSyncHudText(iClient, g_hMultiHudSync, g_strMultiHudText); 227 | } 228 | } 229 | 230 | return Plugin_Continue; 231 | } 232 | 233 | void ShowMainRocketHud(int iClient, int iIndex) 234 | { 235 | SetHudTextParams(-1.0, 0.9, 0.1, 255, 255, 255, 255, 0, 0.0, 0.12, 0.12); 236 | 237 | ShowSyncHudText(iClient, g_hMainHudSync, "%t", "Hud_Speedometer", TFDB_GetRocketMphSpeed(iIndex), 238 | TFDB_GetRocketSpeed(iIndex), 239 | TFDB_GetRocketDeflections(iIndex), 240 | iIndex, 241 | GetRocketLongName(iIndex)); 242 | } 243 | 244 | void ShowMainRocketHudAll(int iIndex) 245 | { 246 | for (int iClient = 1; iClient <= MaxClients; iClient++) 247 | { 248 | if (!IsClientInGame(iClient) || !g_bShowHud[iClient]) continue; 249 | 250 | ShowMainRocketHud(iClient, iIndex); 251 | } 252 | } 253 | 254 | void FormatMultiRocketHud(int iClient, int iIndex, char[] strBuffer, int iMaxLen) 255 | { 256 | static int iLength; 257 | 258 | if ((iLength + strlen(strBuffer)) >= iMaxLen) return; 259 | 260 | iLength = strlen(strBuffer); 261 | 262 | Format(strBuffer, iMaxLen, "%s%T\n", strBuffer, "Hud_SpeedometerEx", iClient, TFDB_GetRocketMphSpeed(iIndex), 263 | TFDB_GetRocketSpeed(iIndex), 264 | TFDB_GetRocketDeflections(iIndex), 265 | iIndex, 266 | GetRocketLongName(iIndex)); 267 | 268 | iLength = strlen(strBuffer) - iLength; 269 | } 270 | 271 | stock bool BothTeamsPlaying() 272 | { 273 | bool bRedFound, bBluFound; 274 | 275 | for (int iClient = 1; iClient <= MaxClients; iClient++) 276 | { 277 | if (!IsClientInGame(iClient) || !IsPlayerAlive(iClient)) continue; 278 | 279 | int iTeam = GetClientTeam(iClient); 280 | 281 | if (iTeam == view_as(TFTeam_Red)) bRedFound = true; 282 | if (iTeam == view_as(TFTeam_Blue)) bBluFound = true; 283 | } 284 | 285 | return bRedFound && bBluFound; 286 | } 287 | 288 | char[] GetRocketLongName(int iIndex) 289 | { 290 | char strBuffer[32]; TFDB_GetRocketClassLongName(TFDB_GetRocketClass(iIndex), strBuffer, sizeof(strBuffer)); 291 | 292 | return strBuffer; 293 | } 294 | 295 | int FindLastRocket() 296 | { 297 | float fDeflectionTime; 298 | float fSpawnTime; 299 | int iDeflectionIndex; 300 | int iSpawnIndex; 301 | 302 | for (int iIndex = 0; iIndex < MAX_ROCKETS; iIndex++) 303 | { 304 | if (!TFDB_IsValidRocket(iIndex)) continue; 305 | 306 | if (TFDB_GetRocketLastDeflectionTime(iIndex) > fDeflectionTime) 307 | { 308 | iDeflectionIndex = iIndex; 309 | fDeflectionTime = TFDB_GetRocketLastDeflectionTime(iIndex); 310 | } 311 | 312 | if (TFDB_GetLastSpawnTime(iIndex) > fSpawnTime) 313 | { 314 | iSpawnIndex = iIndex; 315 | fSpawnTime = TFDB_GetLastSpawnTime(iIndex); 316 | } 317 | } 318 | 319 | return fDeflectionTime < fSpawnTime ? iSpawnIndex : iDeflectionIndex; 320 | } 321 | -------------------------------------------------------------------------------- /Subplugins/Print/scripting/TF2DodgeballPrint.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | 7 | #define PLUGIN_NAME "[TFDB] Print & replace client indexes" 8 | #define PLUGIN_AUTHOR "x07x08" 9 | #define PLUGIN_DESCRIPTION "Does what it says" 10 | #define PLUGIN_VERSION "1.1.2" 11 | #define PLUGIN_URL "https://github.com/x07x08/TF2-Dodgeball-Modified" 12 | 13 | char g_strCmdBuffer[255]; 14 | char g_strExplodeBuffer[32][255]; 15 | 16 | Regex g_hBracketsPattern; 17 | 18 | public Plugin myinfo = 19 | { 20 | name = PLUGIN_NAME, 21 | author = PLUGIN_AUTHOR, 22 | description = PLUGIN_DESCRIPTION, 23 | version = PLUGIN_VERSION, 24 | url = PLUGIN_URL 25 | }; 26 | 27 | public void OnPluginStart() 28 | { 29 | LoadTranslations("tfdb.phrases.txt"); 30 | 31 | g_hBracketsPattern = new Regex("(?<=\\[)(.*?)(?=\\])"); 32 | 33 | RegAdminCmd("tf_dodgeball_print", CmdPrintMessage, ADMFLAG_CHAT, "Prints a message to chat and replaces client indexes inside a pair of '##'"); 34 | RegAdminCmd("tf_dodgeball_print_c", CmdPrintMessageClient, ADMFLAG_CHAT, "Prints a message to a client and replaces client indexes inside a pair of '##'"); 35 | RegAdminCmd("tf_dodgeball_phrase", CmdPrintPhrase, ADMFLAG_CHAT, "Prints a translation phrase to chat"); 36 | RegAdminCmd("tf_dodgeball_phrase_c", CmdPrintPhraseClient, ADMFLAG_CHAT, "Prints a translation phrase to a client"); 37 | } 38 | 39 | public Action CmdPrintMessage(int iClient, int iArgs) 40 | { 41 | if (!(iArgs >= 1)) 42 | { 43 | ReplyToCommand(iClient, "Usage : tf_dodgeball_print "); 44 | 45 | return Plugin_Handled; 46 | } 47 | 48 | GetCmdArgString(g_strCmdBuffer, sizeof(g_strCmdBuffer)); 49 | TrimString(g_strCmdBuffer); 50 | 51 | int iNumStrings = ExplodeString(g_strCmdBuffer, "##", g_strExplodeBuffer, sizeof(g_strExplodeBuffer), sizeof(g_strExplodeBuffer[])); 52 | int iIndex; 53 | 54 | for (int iPos = 0; iPos < iNumStrings; iPos++) 55 | { 56 | if (!g_strExplodeBuffer[iPos][0]) continue; 57 | 58 | if ((StringToIntEx(g_strExplodeBuffer[iPos], iIndex) == strlen(g_strExplodeBuffer[iPos])) && 59 | ((iIndex >= 1) && (iIndex <= MaxClients) && IsClientInGame(iIndex))) 60 | { 61 | FormatEx(g_strExplodeBuffer[iPos], sizeof(g_strExplodeBuffer[]), "%N", iIndex); 62 | } 63 | } 64 | 65 | ImplodeStrings(g_strExplodeBuffer, iNumStrings, "", g_strCmdBuffer, sizeof(g_strCmdBuffer)); 66 | 67 | CPrintToChatAll(g_strCmdBuffer); 68 | 69 | return Plugin_Handled; 70 | } 71 | 72 | public Action CmdPrintMessageClient(int iClient, int iArgs) 73 | { 74 | if (!(iArgs >= 2)) 75 | { 76 | ReplyToCommand(iClient, "Usage : tf_dodgeball_print_c "); 77 | 78 | return Plugin_Handled; 79 | } 80 | 81 | char strBuffer[8]; 82 | 83 | GetCmdArgString(g_strCmdBuffer, sizeof(g_strCmdBuffer)); 84 | 85 | int iLength = BreakString(g_strCmdBuffer, strBuffer, sizeof(strBuffer)); 86 | int iTarget = StringToInt(strBuffer); 87 | 88 | TrimString(g_strCmdBuffer[iLength]); 89 | 90 | int iNumStrings = ExplodeString(g_strCmdBuffer[iLength], "##", g_strExplodeBuffer, sizeof(g_strExplodeBuffer), sizeof(g_strExplodeBuffer[])); 91 | int iIndex; 92 | 93 | for (int iPos = 0; iPos < iNumStrings; iPos++) 94 | { 95 | if (!g_strExplodeBuffer[iPos][0]) continue; 96 | 97 | if ((StringToIntEx(g_strExplodeBuffer[iPos], iIndex) == strlen(g_strExplodeBuffer[iPos])) && 98 | ((iIndex >= 1) && (iIndex <= MaxClients) && IsClientInGame(iIndex))) 99 | { 100 | FormatEx(g_strExplodeBuffer[iPos], sizeof(g_strExplodeBuffer[]), "%N", iIndex); 101 | } 102 | } 103 | 104 | ImplodeStrings(g_strExplodeBuffer, iNumStrings, "", g_strCmdBuffer[iLength], sizeof(g_strCmdBuffer)); 105 | 106 | if ((iTarget >= 1) && (iTarget <= MaxClients) && IsClientInGame(iTarget)) 107 | { 108 | CPrintToChat(iTarget, g_strCmdBuffer[iLength]); 109 | } 110 | 111 | return Plugin_Handled; 112 | } 113 | 114 | public Action CmdPrintPhrase(int iClient, int iArgs) 115 | { 116 | char strPhrase[48]; 117 | 118 | GetCmdArgString(g_strCmdBuffer, sizeof(g_strCmdBuffer)); TrimString(g_strCmdBuffer); 119 | 120 | int iMatches = g_hBracketsPattern.MatchAll(g_strCmdBuffer); 121 | 122 | if (!(iMatches >= 1)) 123 | { 124 | ReplyToCommand(iClient, "Usage : tf_dodgeball_phrase (phrase and args must be surrounded by []) (phrase arguments must be separated by a comma [,])"); 125 | 126 | return Plugin_Handled; 127 | } 128 | 129 | any aArgs[32]; 130 | 131 | g_hBracketsPattern.GetSubString(0, strPhrase, sizeof(strPhrase), 0); TrimString(strPhrase); 132 | 133 | if (iMatches == 2) 134 | { 135 | g_hBracketsPattern.GetSubString(0, g_strCmdBuffer, sizeof(g_strCmdBuffer), 1); 136 | 137 | int iStrings = ExplodeString(g_strCmdBuffer, ",", g_strExplodeBuffer, sizeof(g_strExplodeBuffer), sizeof(g_strExplodeBuffer[])); 138 | 139 | for (int iIndex = 0; iIndex < iStrings; iIndex++) 140 | { 141 | TrimString(g_strExplodeBuffer[iIndex]); 142 | 143 | if ((StringToIntEx(g_strExplodeBuffer[iIndex], aArgs[iIndex]) == strlen(g_strExplodeBuffer[iIndex])) || 144 | (StringToFloatEx(g_strExplodeBuffer[iIndex], aArgs[iIndex]) == strlen(g_strExplodeBuffer[iIndex]))) 145 | { 146 | g_strExplodeBuffer[iIndex] = "\0"; 147 | } 148 | } 149 | } 150 | 151 | PrintPhrase(strPhrase, g_strExplodeBuffer, aArgs, true); 152 | 153 | return Plugin_Handled; 154 | } 155 | 156 | public Action CmdPrintPhraseClient(int iClient, int iArgs) 157 | { 158 | char strPhrase[48], strTarget[8]; 159 | 160 | GetCmdArgString(g_strCmdBuffer, sizeof(g_strCmdBuffer)); TrimString(g_strCmdBuffer); 161 | 162 | int iMatches = g_hBracketsPattern.MatchAll(g_strCmdBuffer); 163 | 164 | if (!(iMatches >= 2)) 165 | { 166 | ReplyToCommand(iClient, "Usage : tf_dodgeball_phrase_c (client, phrase and args must be surrounded by []) (phrase arguments must be separated by a comma [,])"); 167 | 168 | return Plugin_Handled; 169 | } 170 | 171 | any aArgs[32]; 172 | 173 | g_hBracketsPattern.GetSubString(0, strTarget, sizeof(strTarget), 0); TrimString(strTarget); 174 | g_hBracketsPattern.GetSubString(0, strPhrase, sizeof(strPhrase), 1); TrimString(strPhrase); 175 | 176 | int iTarget = StringToInt(strTarget); 177 | 178 | if (iMatches == 3) 179 | { 180 | g_hBracketsPattern.GetSubString(0, g_strCmdBuffer, sizeof(g_strCmdBuffer), 2); 181 | 182 | int iStrings = ExplodeString(g_strCmdBuffer, ",", g_strExplodeBuffer, sizeof(g_strExplodeBuffer), sizeof(g_strExplodeBuffer[])); 183 | 184 | for (int iIndex = 0; iIndex < iStrings; iIndex++) 185 | { 186 | TrimString(g_strExplodeBuffer[iIndex]); 187 | 188 | if ((StringToIntEx(g_strExplodeBuffer[iIndex], aArgs[iIndex]) == strlen(g_strExplodeBuffer[iIndex])) || 189 | (StringToFloatEx(g_strExplodeBuffer[iIndex], aArgs[iIndex]) == strlen(g_strExplodeBuffer[iIndex]))) 190 | { 191 | g_strExplodeBuffer[iIndex] = "\0"; 192 | } 193 | } 194 | } 195 | 196 | if ((iTarget >= 1) && (iTarget <= MaxClients) && IsClientInGame(iTarget)) 197 | { 198 | PrintPhrase(strPhrase, g_strExplodeBuffer, aArgs, false, iTarget); 199 | } 200 | 201 | return Plugin_Handled; 202 | } 203 | 204 | void PrintPhrase(const char[] strPhrase, const char strArgs[32][255], const any aArgs[32], bool bAll, int iClient = -1) 205 | { 206 | if (bAll) 207 | { 208 | // There are a maximum of 32 arguments for the translation format function. 209 | // Three of them seem to be reserved : 210 | // 211 | // - One for the phrase name 212 | // - One for the client or the language ID (no idea which) 213 | // - One that is unknown to me (most likely one of the above) 214 | // 215 | // Found the optimal number through plenty of crashes. 216 | 217 | // Ok so this has 29 arguments, which contradicts everything above... 218 | // I have no clue why this works with 29 instead of 28... 219 | 220 | CPrintToChatAll("%t", strPhrase, HandleBadConversion(strArgs, aArgs, 0), 221 | HandleBadConversion(strArgs, aArgs, 1), 222 | HandleBadConversion(strArgs, aArgs, 2), 223 | HandleBadConversion(strArgs, aArgs, 3), 224 | HandleBadConversion(strArgs, aArgs, 4), 225 | HandleBadConversion(strArgs, aArgs, 5), 226 | HandleBadConversion(strArgs, aArgs, 6), 227 | HandleBadConversion(strArgs, aArgs, 7), 228 | HandleBadConversion(strArgs, aArgs, 8), 229 | HandleBadConversion(strArgs, aArgs, 9), 230 | HandleBadConversion(strArgs, aArgs, 10), 231 | HandleBadConversion(strArgs, aArgs, 11), 232 | HandleBadConversion(strArgs, aArgs, 12), 233 | HandleBadConversion(strArgs, aArgs, 13), 234 | HandleBadConversion(strArgs, aArgs, 14), 235 | HandleBadConversion(strArgs, aArgs, 15), 236 | HandleBadConversion(strArgs, aArgs, 16), 237 | HandleBadConversion(strArgs, aArgs, 17), 238 | HandleBadConversion(strArgs, aArgs, 18), 239 | HandleBadConversion(strArgs, aArgs, 19), 240 | HandleBadConversion(strArgs, aArgs, 20), 241 | HandleBadConversion(strArgs, aArgs, 21), 242 | HandleBadConversion(strArgs, aArgs, 22), 243 | HandleBadConversion(strArgs, aArgs, 23), 244 | HandleBadConversion(strArgs, aArgs, 24), 245 | HandleBadConversion(strArgs, aArgs, 25), 246 | HandleBadConversion(strArgs, aArgs, 26), 247 | HandleBadConversion(strArgs, aArgs, 27), 248 | HandleBadConversion(strArgs, aArgs, 28)); 249 | } 250 | else 251 | { 252 | CPrintToChat(iClient, "%t", strPhrase, HandleBadConversion(strArgs, aArgs, 0), 253 | HandleBadConversion(strArgs, aArgs, 1), 254 | HandleBadConversion(strArgs, aArgs, 2), 255 | HandleBadConversion(strArgs, aArgs, 3), 256 | HandleBadConversion(strArgs, aArgs, 4), 257 | HandleBadConversion(strArgs, aArgs, 5), 258 | HandleBadConversion(strArgs, aArgs, 6), 259 | HandleBadConversion(strArgs, aArgs, 7), 260 | HandleBadConversion(strArgs, aArgs, 8), 261 | HandleBadConversion(strArgs, aArgs, 9), 262 | HandleBadConversion(strArgs, aArgs, 10), 263 | HandleBadConversion(strArgs, aArgs, 11), 264 | HandleBadConversion(strArgs, aArgs, 12), 265 | HandleBadConversion(strArgs, aArgs, 13), 266 | HandleBadConversion(strArgs, aArgs, 14), 267 | HandleBadConversion(strArgs, aArgs, 15), 268 | HandleBadConversion(strArgs, aArgs, 16), 269 | HandleBadConversion(strArgs, aArgs, 17), 270 | HandleBadConversion(strArgs, aArgs, 18), 271 | HandleBadConversion(strArgs, aArgs, 19), 272 | HandleBadConversion(strArgs, aArgs, 20), 273 | HandleBadConversion(strArgs, aArgs, 21), 274 | HandleBadConversion(strArgs, aArgs, 22), 275 | HandleBadConversion(strArgs, aArgs, 23), 276 | HandleBadConversion(strArgs, aArgs, 24), 277 | HandleBadConversion(strArgs, aArgs, 25), 278 | HandleBadConversion(strArgs, aArgs, 26), 279 | HandleBadConversion(strArgs, aArgs, 27)); 280 | } 281 | } 282 | 283 | // If I do "!strArgs[iIndex][0] ? aArgs[iIndex] : strArgs[iIndex]", it will print random stuff. 284 | // Found out it's because it returns a value on one side of the conditional operator and an array on the other. 285 | // I wasted 2 hours on this issue. 286 | 287 | any[] HandleBadConversion(const char[][] strArgs, const any[] aArgs, int iIndex) 288 | { 289 | any aTemp[1][1]; aTemp[0][0] = aArgs[iIndex]; 290 | 291 | return !strArgs[iIndex][0] ? aTemp[0] : strArgs[iIndex]; 292 | } 293 | -------------------------------------------------------------------------------- /Subplugins/Votes/scripting/TF2DodgeballVotes.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #define PLUGIN_NAME "[TFDB] Votes" 10 | #define PLUGIN_AUTHOR "x07x08" 11 | #define PLUGIN_DESCRIPTION "Various rocket votes." 12 | #define PLUGIN_VERSION "1.0.1" 13 | #define PLUGIN_URL "https://github.com/x07x08/TF2-Dodgeball-Modified" 14 | 15 | int g_iSpawnersCount; 16 | 17 | ConVar g_hCvarVoteBounceDuration; 18 | ConVar g_hCvarVoteClassDuration; 19 | ConVar g_hCvarVoteCountDuration; 20 | ConVar g_hCvarVoteBounceTimeout; 21 | ConVar g_hCvarVoteClassTimeout; 22 | ConVar g_hCvarVoteCountTimeout; 23 | 24 | bool g_bVoteBounceAllowed; 25 | bool g_bVoteClassAllowed; 26 | bool g_bVoteCountAllowed; 27 | 28 | float g_fLastVoteBounceTime; 29 | float g_fLastVoteClassTime; 30 | float g_fLastVoteCountTime; 31 | 32 | bool g_bBounceEnabled; 33 | int g_iMainRocketClass = -1; 34 | int g_iRocketsCount = -1; 35 | 36 | int g_iSavedMaxRockets[MAX_SPAWNER_CLASSES]; 37 | 38 | bool g_bLoaded; 39 | 40 | public Plugin myinfo = 41 | { 42 | name = PLUGIN_NAME, 43 | author = PLUGIN_AUTHOR, 44 | description = PLUGIN_DESCRIPTION, 45 | version = PLUGIN_VERSION, 46 | url = PLUGIN_URL 47 | }; 48 | 49 | public void OnPluginStart() 50 | { 51 | LoadTranslations("tfdb.phrases.txt"); 52 | 53 | g_hCvarVoteBounceDuration = CreateConVar("tf_dodgeball_votes_bounce_duration", "20", _, _, true, 0.0); 54 | g_hCvarVoteClassDuration = CreateConVar("tf_dodgeball_votes_class_duration", "20", _, _, true, 0.0); 55 | g_hCvarVoteCountDuration = CreateConVar("tf_dodgeball_votes_count_duration", "20", _, _, true, 0.0); 56 | g_hCvarVoteBounceTimeout = CreateConVar("tf_dodgeball_votes_bounce_timeout", "150", _, _, true, 0.0); 57 | g_hCvarVoteClassTimeout = CreateConVar("tf_dodgeball_votes_class_timeout", "150", _, _, true, 0.0); 58 | g_hCvarVoteCountTimeout = CreateConVar("tf_dodgeball_votes_count_timeout", "150", _, _, true, 0.0); 59 | 60 | RegConsoleCmd("sm_vrb", CmdVoteBounce, "Start a rocket bounce vote"); 61 | RegConsoleCmd("sm_vrc", CmdVoteClass, "Start a rocket class vote"); 62 | RegConsoleCmd("sm_vrcount", CmdVoteCount, "Start a rocket count vote"); 63 | RegConsoleCmd("sm_votebounce", CmdVoteBounce, "Start a rocket bounce vote"); 64 | RegConsoleCmd("sm_voteclass", CmdVoteClass, "Start a rocket class vote"); 65 | RegConsoleCmd("sm_votecount", CmdVoteCount, "Start a rocket count vote"); 66 | RegConsoleCmd("sm_voterocketbounce", CmdVoteBounce, "Start a rocket bounce vote"); 67 | RegConsoleCmd("sm_voterocketclass", CmdVoteClass, "Start a rocket class vote"); 68 | RegConsoleCmd("sm_voterocketcount", CmdVoteCount, "Start a rocket count vote"); 69 | 70 | if (!TFDB_IsDodgeballEnabled()) return; 71 | 72 | char strMapName[64]; GetCurrentMap(strMapName, sizeof(strMapName)); 73 | char strMapFile[PLATFORM_MAX_PATH]; FormatEx(strMapFile, sizeof(strMapFile), "%s.cfg", strMapName); 74 | 75 | TFDB_OnRocketsConfigExecuted("general.cfg"); 76 | TFDB_OnRocketsConfigExecuted(strMapFile); 77 | } 78 | 79 | public void OnMapEnd() 80 | { 81 | if (!g_bLoaded) return; 82 | 83 | g_bVoteBounceAllowed = 84 | g_bVoteClassAllowed = 85 | g_bVoteCountAllowed = false; 86 | 87 | g_fLastVoteBounceTime = 88 | g_fLastVoteClassTime = 89 | g_fLastVoteCountTime = 0.0; 90 | 91 | g_bBounceEnabled = false; 92 | g_iMainRocketClass = -1; 93 | g_iRocketsCount = -1; 94 | 95 | g_bLoaded = false; 96 | 97 | g_iSpawnersCount = 0; 98 | } 99 | 100 | public void TFDB_OnRocketsConfigExecuted(const char[] strConfigFile) 101 | { 102 | if (!g_bLoaded) 103 | { 104 | g_bVoteBounceAllowed = 105 | g_bVoteClassAllowed = 106 | g_bVoteCountAllowed = true; 107 | 108 | g_fLastVoteBounceTime = 109 | g_fLastVoteClassTime = 110 | g_fLastVoteCountTime = 0.0; 111 | 112 | g_bBounceEnabled = false; 113 | g_iMainRocketClass = -1; 114 | g_iRocketsCount = -1; 115 | 116 | g_bLoaded = true; 117 | } 118 | 119 | if (strcmp(strConfigFile, "general.cfg") == 0) 120 | { 121 | g_iSpawnersCount = 0; 122 | } 123 | 124 | ParseConfigurations(strConfigFile); 125 | } 126 | 127 | public Action CmdVoteBounce(int iClient, int iArgs) 128 | { 129 | if (iClient == 0) 130 | { 131 | ReplyToCommand(iClient, "Command is in-game only."); 132 | 133 | return Plugin_Handled; 134 | } 135 | 136 | if (!TFDB_IsDodgeballEnabled()) 137 | { 138 | CReplyToCommand(iClient, "%t", "Command_Disabled"); 139 | 140 | return Plugin_Handled; 141 | } 142 | 143 | if (IsVoteInProgress()) 144 | { 145 | CReplyToCommand(iClient, "%t", "Dodgeball_FFAVote_Conflict"); 146 | 147 | return Plugin_Handled; 148 | } 149 | 150 | if (g_bVoteBounceAllowed) 151 | { 152 | g_bVoteBounceAllowed = false; 153 | g_fLastVoteBounceTime = GetGameTime(); 154 | 155 | StartBounceVote(); 156 | CreateTimer(g_hCvarVoteBounceTimeout.FloatValue, VoteBounceTimeoutCallback, _, TIMER_FLAG_NO_MAPCHANGE); 157 | } 158 | else 159 | { 160 | CReplyToCommand(iClient, "%t", "Dodgeball_BounceVote_Cooldown", 161 | RoundToCeil((g_fLastVoteBounceTime + g_hCvarVoteBounceTimeout.FloatValue) - GetGameTime())); 162 | } 163 | 164 | return Plugin_Handled; 165 | } 166 | 167 | void StartBounceVote() 168 | { 169 | char strMode[16]; 170 | strMode = !g_bBounceEnabled ? "Enable" : "Disable"; 171 | 172 | Menu hMenu = new Menu(VoteMenuHandler); 173 | hMenu.VoteResultCallback = VoteBounceResultHandler; 174 | 175 | hMenu.SetTitle("%s no rocket bounce mode?", strMode); 176 | 177 | hMenu.AddItem("0", "Yes"); 178 | hMenu.AddItem("1", "No"); 179 | 180 | int iTotal; 181 | int[] iClients = new int[MaxClients]; 182 | 183 | for (int iClient = 1; iClient <= MaxClients; iClient++) 184 | { 185 | if (!IsClientInGame(iClient) || IsFakeClient(iClient) || GetClientTeam(iClient) <= 1) 186 | { 187 | continue; 188 | } 189 | 190 | iClients[iTotal++] = iClient; 191 | } 192 | 193 | hMenu.DisplayVote(iClients, iTotal, g_hCvarVoteBounceDuration.IntValue); 194 | } 195 | 196 | public int VoteMenuHandler(Menu hMenu, MenuAction iMenuActions, int iParam1, int iParam2) 197 | { 198 | switch (iMenuActions) 199 | { 200 | case MenuAction_End : 201 | { 202 | delete hMenu; 203 | } 204 | } 205 | 206 | return 0; 207 | } 208 | 209 | public void VoteBounceResultHandler(Menu hMenu, 210 | int iNumVotes, 211 | int iNumClients, 212 | const int[][] iClientInfo, 213 | int iNumItems, 214 | const int[][] iItemInfo) 215 | { 216 | int iWinnerIndex = 0; 217 | 218 | if (iNumItems > 1 && 219 | (iItemInfo[0][VOTEINFO_ITEM_VOTES] == iItemInfo[1][VOTEINFO_ITEM_VOTES])) 220 | { 221 | iWinnerIndex = GetRandomInt(0, 1); 222 | } 223 | 224 | char strWinner[8]; hMenu.GetItem(iItemInfo[iWinnerIndex][VOTEINFO_ITEM_INDEX], strWinner, sizeof(strWinner)); 225 | 226 | if (StrEqual(strWinner, "0")) 227 | { 228 | ToggleBounce(); 229 | } 230 | else 231 | { 232 | CPrintToChatAll("%t", "Dodgeball_BounceVote_Failed"); 233 | } 234 | } 235 | 236 | void ToggleBounce() 237 | { 238 | if (!g_bBounceEnabled) 239 | { 240 | EnableBounce(); 241 | } 242 | else 243 | { 244 | DisableBounce(); 245 | } 246 | } 247 | 248 | void EnableBounce() 249 | { 250 | g_bBounceEnabled = true; 251 | 252 | for (int iIndex = 0; iIndex < MAX_ROCKETS; iIndex++) 253 | { 254 | if (!TFDB_IsValidRocket(iIndex)) continue; 255 | 256 | TFDB_SetRocketBounces(iIndex, TFDB_GetRocketClassMaxBounces(TFDB_GetRocketClass(iIndex))); 257 | } 258 | 259 | CPrintToChatAll("%t", "Dodgeball_BounceVote_Enabled"); 260 | } 261 | 262 | void DisableBounce() 263 | { 264 | g_bBounceEnabled = false; 265 | 266 | for (int iIndex = 0; iIndex < MAX_ROCKETS; iIndex++) 267 | { 268 | if (!TFDB_IsValidRocket(iIndex)) continue; 269 | 270 | TFDB_SetRocketBounces(iIndex, 0); 271 | } 272 | 273 | CPrintToChatAll("%t", "Dodgeball_BounceVote_Disabled"); 274 | } 275 | 276 | public Action CmdVoteClass(int iClient, int iArgs) 277 | { 278 | if (iClient == 0) 279 | { 280 | ReplyToCommand(iClient, "Command is in-game only."); 281 | 282 | return Plugin_Handled; 283 | } 284 | 285 | if (!TFDB_IsDodgeballEnabled()) 286 | { 287 | CReplyToCommand(iClient, "%t", "Command_Disabled"); 288 | 289 | return Plugin_Handled; 290 | } 291 | 292 | if (IsVoteInProgress()) 293 | { 294 | CReplyToCommand(iClient, "%t", "Dodgeball_FFAVote_Conflict"); 295 | 296 | return Plugin_Handled; 297 | } 298 | 299 | if (g_bVoteClassAllowed) 300 | { 301 | g_bVoteClassAllowed = false; 302 | g_fLastVoteClassTime = GetGameTime(); 303 | 304 | StartClassVote(); 305 | CreateTimer(g_hCvarVoteClassTimeout.FloatValue, VoteClassTimeoutCallback, _, TIMER_FLAG_NO_MAPCHANGE); 306 | } 307 | else 308 | { 309 | CReplyToCommand(iClient, "%t", "Dodgeball_ClassVote_Cooldown", 310 | RoundToCeil((g_fLastVoteClassTime + g_hCvarVoteClassTimeout.FloatValue) - GetGameTime())); 311 | } 312 | 313 | return Plugin_Handled; 314 | } 315 | 316 | void StartClassVote() 317 | { 318 | Menu hMenu = new Menu(VoteMenuHandler); 319 | hMenu.VoteResultCallback = VoteClassResultHandler; 320 | 321 | hMenu.SetTitle("Change main rocket class?"); 322 | 323 | if (g_iMainRocketClass != -1) 324 | { 325 | hMenu.AddItem("-1", "Reset the spawn chances"); 326 | } 327 | 328 | char strClass[8], strRocketClassLongName[32]; 329 | 330 | for (int iClass = 0; iClass < TFDB_GetRocketClassCount(); iClass++) 331 | { 332 | IntToString(iClass, strClass, sizeof(strClass)); 333 | TFDB_GetRocketClassLongName(iClass, strRocketClassLongName, sizeof(strRocketClassLongName)); 334 | 335 | hMenu.AddItem(strClass, strRocketClassLongName, ITEMDRAW_DEFAULT); 336 | } 337 | 338 | int iTotal; 339 | int[] iClients = new int[MaxClients]; 340 | 341 | for (int iClient = 1; iClient <= MaxClients; iClient++) 342 | { 343 | if (!IsClientInGame(iClient) || IsFakeClient(iClient) || GetClientTeam(iClient) <= 1) 344 | { 345 | continue; 346 | } 347 | 348 | iClients[iTotal++] = iClient; 349 | } 350 | 351 | hMenu.DisplayVote(iClients, iTotal, g_hCvarVoteClassDuration.IntValue); 352 | } 353 | 354 | public void VoteClassResultHandler(Menu hMenu, 355 | int iNumVotes, 356 | int iNumClients, 357 | const int[][] iClientInfo, 358 | int iNumItems, 359 | const int[][] iItemInfo) 360 | { 361 | int iWinnerIndex = 0; 362 | int iClassCount = TFDB_GetRocketClassCount(); 363 | 364 | if (g_iMainRocketClass != -1) iClassCount++; 365 | 366 | bool bEqual = AreVotesEqual(iItemInfo, iClassCount); 367 | 368 | if (bEqual) iWinnerIndex = GetRandomInt(0, (iClassCount - 1)); 369 | 370 | char strWinner[8], strClassLongName[32]; 371 | 372 | hMenu.GetItem(iItemInfo[iWinnerIndex][VOTEINFO_ITEM_INDEX], strWinner, sizeof(strWinner), _, strClassLongName, sizeof(strClassLongName)); 373 | 374 | g_iMainRocketClass = StringToInt(strWinner); 375 | 376 | if (g_iMainRocketClass == -1) 377 | { 378 | CPrintToChatAll("%t", "Dodgeball_ClassVote_Reset"); 379 | } 380 | else 381 | { 382 | CPrintToChatAll("%t", "Dodgeball_ClassVote_Changed", strClassLongName); 383 | } 384 | 385 | TFDB_DestroyRockets(); 386 | } 387 | 388 | public Action CmdVoteCount(int iClient, int iArgs) 389 | { 390 | if (iClient == 0) 391 | { 392 | ReplyToCommand(iClient, "Command is in-game only."); 393 | 394 | return Plugin_Handled; 395 | } 396 | 397 | if (!TFDB_IsDodgeballEnabled()) 398 | { 399 | CReplyToCommand(iClient, "%t", "Command_Disabled"); 400 | 401 | return Plugin_Handled; 402 | } 403 | 404 | if (IsVoteInProgress()) 405 | { 406 | CReplyToCommand(iClient, "%t", "Dodgeball_FFAVote_Conflict"); 407 | 408 | return Plugin_Handled; 409 | } 410 | 411 | if (g_bVoteCountAllowed) 412 | { 413 | g_bVoteCountAllowed = false; 414 | g_fLastVoteCountTime = GetGameTime(); 415 | 416 | StartCountVote(); 417 | CreateTimer(g_hCvarVoteCountTimeout.FloatValue, VoteCountTimeoutCallback, _, TIMER_FLAG_NO_MAPCHANGE); 418 | } 419 | else 420 | { 421 | CReplyToCommand(iClient, "%t", "Dodgeball_CountVote_Cooldown", 422 | RoundToCeil((g_fLastVoteCountTime + g_hCvarVoteCountTimeout.FloatValue) - GetGameTime())); 423 | } 424 | 425 | return Plugin_Handled; 426 | } 427 | 428 | void StartCountVote() 429 | { 430 | Menu hMenu = new Menu(VoteMenuHandler); 431 | hMenu.VoteResultCallback = VoteCountResultHandler; 432 | 433 | hMenu.SetTitle("Change rockets count?"); 434 | 435 | if (g_iRocketsCount != -1) 436 | { 437 | hMenu.AddItem("-1", "Reset rockets count"); 438 | } 439 | 440 | hMenu.AddItem("0", "One rocket"); 441 | hMenu.AddItem("1", "Two rockets"); 442 | hMenu.AddItem("2", "Three rockets"); 443 | hMenu.AddItem("3", "Four rockets"); 444 | hMenu.AddItem("4", "Five rockets"); 445 | 446 | int iTotal; 447 | int[] iClients = new int[MaxClients]; 448 | 449 | for (int iClient = 1; iClient <= MaxClients; iClient++) 450 | { 451 | if (!IsClientInGame(iClient) || IsFakeClient(iClient) || GetClientTeam(iClient) <= 1) 452 | { 453 | continue; 454 | } 455 | 456 | iClients[iTotal++] = iClient; 457 | } 458 | 459 | hMenu.DisplayVote(iClients, iTotal, g_hCvarVoteCountDuration.IntValue); 460 | } 461 | 462 | public void VoteCountResultHandler(Menu hMenu, 463 | int iNumVotes, 464 | int iNumClients, 465 | const int[][] iClientInfo, 466 | int iNumItems, 467 | const int[][] iItemInfo) 468 | { 469 | int iWinnerIndex = 0; 470 | int iVotesCount = 5; 471 | 472 | if (g_iRocketsCount != -1) iVotesCount++; 473 | 474 | bool bEqual = AreVotesEqual(iItemInfo, iVotesCount); 475 | 476 | if (bEqual) iWinnerIndex = GetRandomInt(0, (iVotesCount - 1)); 477 | 478 | char strWinner[8]; hMenu.GetItem(iItemInfo[iWinnerIndex][VOTEINFO_ITEM_INDEX], strWinner, sizeof(strWinner)); 479 | 480 | g_iRocketsCount = StringToInt(strWinner); 481 | 482 | for (int iIndex = 0; iIndex < TFDB_GetSpawnersCount(); iIndex++) 483 | { 484 | TFDB_SetSpawnersMaxRockets(iIndex, g_iRocketsCount == -1 ? g_iSavedMaxRockets[iIndex] : (g_iRocketsCount + 1)); 485 | } 486 | 487 | if (g_iRocketsCount == -1) 488 | { 489 | CPrintToChatAll("%t", "Dodgeball_CountVote_Reset"); 490 | } 491 | else 492 | { 493 | CPrintToChatAll("%t", "Dodgeball_CountVote_Changed", (g_iRocketsCount + 1)); 494 | } 495 | } 496 | 497 | public Action VoteBounceTimeoutCallback(Handle hTimer) 498 | { 499 | g_bVoteBounceAllowed = true; 500 | 501 | return Plugin_Continue; 502 | } 503 | 504 | public Action VoteClassTimeoutCallback(Handle hTimer) 505 | { 506 | g_bVoteClassAllowed = true; 507 | 508 | return Plugin_Continue; 509 | } 510 | 511 | public Action VoteCountTimeoutCallback(Handle hTimer) 512 | { 513 | g_bVoteCountAllowed = true; 514 | 515 | return Plugin_Continue; 516 | } 517 | 518 | public Action TFDB_OnRocketCreatedPre(int iIndex, int &iClass, RocketFlags &iFlags) 519 | { 520 | if (g_iMainRocketClass == -1) return Plugin_Continue; 521 | 522 | iClass = g_iMainRocketClass; 523 | iFlags = TFDB_GetRocketClassFlags(g_iMainRocketClass); 524 | 525 | return Plugin_Changed; 526 | } 527 | 528 | public void TFDB_OnRocketCreated(int iIndex) 529 | { 530 | if (!g_bBounceEnabled) return; 531 | 532 | TFDB_SetRocketBounces(iIndex, TFDB_GetRocketClassMaxBounces(TFDB_GetRocketClass(iIndex))); 533 | } 534 | 535 | void ParseConfigurations(const char[] strConfigFile) 536 | { 537 | char strPath[PLATFORM_MAX_PATH]; 538 | char strFileName[PLATFORM_MAX_PATH]; 539 | FormatEx(strFileName, sizeof(strFileName), "configs/dodgeball/%s", strConfigFile); 540 | BuildPath(Path_SM, strPath, sizeof(strPath), strFileName); 541 | 542 | if (!FileExists(strPath, true)) return; 543 | 544 | KeyValues kvConfig = new KeyValues("TF2_Dodgeball"); 545 | 546 | if (kvConfig.ImportFromFile(strPath) == false) SetFailState("Error while parsing the configuration file."); 547 | 548 | kvConfig.GotoFirstSubKey(); 549 | 550 | do 551 | { 552 | char strSection[64]; kvConfig.GetSectionName(strSection, sizeof(strSection)); 553 | 554 | if (StrEqual(strSection, "spawners")) ParseSpawners(kvConfig); 555 | } 556 | while (kvConfig.GotoNextKey()); 557 | 558 | delete kvConfig; 559 | } 560 | 561 | void ParseSpawners(KeyValues kvConfig) 562 | { 563 | kvConfig.GotoFirstSubKey(); 564 | 565 | do 566 | { 567 | int iIndex = g_iSpawnersCount; 568 | 569 | g_iSavedMaxRockets[iIndex] = kvConfig.GetNum("max rockets", 1); 570 | 571 | g_iSpawnersCount++; 572 | } 573 | while (kvConfig.GotoNextKey()); 574 | 575 | kvConfig.GoBack(); 576 | } 577 | 578 | bool AreVotesEqual(const int[][] iVoteItems, int iSize) 579 | { 580 | int iFirst = iVoteItems[0][VOTEINFO_ITEM_VOTES]; 581 | 582 | for (int iIndex = 1; iIndex < iSize; iIndex++) 583 | { 584 | if (iVoteItems[iIndex][VOTEINFO_ITEM_VOTES] != iFirst) return false; 585 | } 586 | 587 | return true; 588 | } 589 | -------------------------------------------------------------------------------- /TF2Dodgeball/addons/sourcemod/configs/dodgeball/general.cfg: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------- 2 | // Events 3 | // ------------------------------------------------------- 4 | // 5 | // In order to further customize the rocket types, you can 6 | // set a command to be executed when a certain event happens 7 | // with a dodgeball rocket. 8 | // 9 | // The events that are right now implemented are the following : 10 | // 11 | // on spawn - When a rocket spawns. 12 | // on deflect - A client has deflected a rocket. 13 | // on kill - One of the rockets has killed the client. 14 | // on explode - Same as on kill, only triggered once. 15 | // on no target - When a rocket has an invalid target. 16 | // - The target parameter "@target" will be the new target of the rocket. 17 | // on destroyed - When a rocket explodes and does not kill anyone. 18 | // - As a result, the rocket entity parameter "@rocket" will always be -1. 19 | // - The target parameter "@target" will be the player who touched the rocket. 20 | // - Requires the extra events plugin. 21 | // 22 | // The possible parameters passed for the commands are the following : 23 | // 24 | // @name - [String] : Name of the projectile type 25 | // @rocket - [Integer] : Rocket entity index 26 | // @owner - [Integer] : Owner client index 27 | // @target - [Integer] : Target client index 28 | // @dead - [Integer] : Last dead client index 29 | // @deflections - [Integer] : Number of rocket deflections 30 | // @speed - [Float] : Speed of the rocket with limit 31 | // @mphspeed - [Integer] : Speed of the rocket in MpH without limit 32 | // @capmphspeed - [Integer] : Speed of the rocket in Mph with limit 33 | // @nocapspeed - [Float] : Speed of the rocket without limit (conversion from MpH) 34 | // @2dspeed - [Float] : Speed of the rocket with limit that has only 2 decimal numbers 35 | // @2dnocapspeed - [Float] : Speed of the rocket without limit that has only 2 decimal numbers 36 | // 37 | // ------------------------------------------------------- 38 | // Commands 39 | // ------------------------------------------------------- 40 | // 41 | // For using with the events system, the plugin has some useful 42 | // commands if you want to make kickass explosion blasts. 43 | // 44 | // tf_dodgeball_explosion 45 | // Shows a huge explosion at the location of the specified client. 46 | // 47 | // tf_dodgeball_shockwave 48 | // Applies a huge shockwave at the location of the client. 49 | // 50 | // If you are able to write plugins, you can include your custom 51 | // commands too! 52 | // 53 | // ------------------------------------------------------- 54 | // Extra information 55 | // ------------------------------------------------------- 56 | // 57 | // It is possible to have map specific configuration files by 58 | // creating a config with the name of the map. Keep in mind that 59 | // no previous values are deleted. 60 | // 61 | // If a keyvalue / parameter has a default value and you do not want 62 | // to change it, you can leave the value empty or ignore the parameter 63 | // altogether. 64 | // 65 | // Neutral rockets cannot damage teammates unless "mp_friendlyfire" 66 | // is set to 1. 67 | // ------------------------------------------------------- 68 | 69 | "tf2_dodgeball" 70 | { 71 | 72 | "general" 73 | { 74 | "music" "0" // Play music on Dodgeball gamemode? 75 | 76 | "round start" "" // Music to play on round start (before gameplay start) 77 | "round end (win)" "" // Music to play for the winner team 78 | "round end (lose)" "" // Music to play for the loser team 79 | "gameplay" "" // Music to play when the gameplay starts. This one stops 80 | // at round end. 81 | 82 | "use web player" "0" // If the use of web player is enabled, these will be 83 | "web player url" "" // used instead of the gameplay music 84 | } 85 | 86 | "classes" 87 | { 88 | "common" 89 | { 90 | // >>> Basic parameters <<< 91 | "name" "Homing Rocket" // Full name of the rocket type 92 | "behaviour" "homing" // "homing" for smooth, per-frame updates. 93 | // "legacy homing" for classic, 20Hz timer updates. 94 | 95 | "model" "" // Default: Common rocket model 96 | "is animated" "0" // Only works when using a custom model (Default : 0) 97 | 98 | // Trails section. Only usable if the trails plugin is installed. 99 | // Remove the comments (//) before the keys (ex. "trail particle") if you want to use this section. 100 | 101 | //"trail particle" "" // Particle for particle trail (Default : no custom particle trail) 102 | // Not all particles are going to work 103 | 104 | //"trail sprite" "" // Sprite path for sprite trail (Default : no custom sprite trail) 105 | //"custom color" "" // Custom color for the sprite trail (Default : [255 255 255]) 106 | //"sprite lifetime" "" // Custom lifetime for sprite trail (Default : 1.0 seconds) 107 | //"sprite start width" "" // Custom start width for sprite trail (Default : 6.0 units) 108 | //"sprite end width" "" // Custom end width for sprite trail (Default : 15.0 units) 109 | //"texture resolution" "" // Custom texture resolution (Default : 0.05) 110 | 111 | // You can also insert custom keyvalue pairs for the "env_spritetrail" entity in this section 112 | //"entity keyvalues" 113 | //{ 114 | // For example, this replaces the sprite set in the "trail sprite" key with "materials/sprites/laser.vmt" 115 | // "spritename" "materials/sprites/laser.vmt" 116 | 117 | // Check https://developer.valvesoftware.com/wiki/Env_spritetrail for more info. 118 | //} 119 | 120 | //"remove particles" "" // Remove the default rocket particles? (Default : 0) 121 | //"replace particles" "" // Replace the default rocket particles? Works only if they have been removed (Default : 0) 122 | // Creates a clone of the rocket and adds crit glows 123 | 124 | // Trails section end. 125 | 126 | "play spawn sound" "1" // Does the rocket emit a sound when spawning? (Default : 0) 127 | "play beep sound" "1" // Does the rocket emit a beeping sound? (Default : 0) 128 | "play alert sound" "1" // Does the rocket emit an alert sound to the client when being targetted? (Default : 0) 129 | "spawn sound" "" // Default: Sentry rocket sound 130 | "beep sound" "" // Default: Sentry searching sound 131 | "alert sound" "" // Default: Sentry client spotted sound 132 | "beep interval" "0" // Emit sound every x time (Default : 0.5 seconds) 133 | 134 | // >>> Specific behaviour modificators <<< 135 | "elevate on deflect" "0" // Does the rocket elevate after a deflection? (Default : 0) 136 | "neutral rocket" "0" // Does the rocket have no team based targets? (Default : 0) 137 | "keep direction" "1" // Does the rocket keep its direction after touching a surface? (Default : 0) 138 | "teamless deflects" "0" // Can this rocket be deflected by anyone? Same as neutral but targeting is not affected. (Default : 0) 139 | "reset bounces" "1" // Does this rocket reset its internal bounces count on deflect? (Default : 0) 140 | "no bounce drags" "0" // Can you drag this rocket after it touched a surface? Does not affect "legacy homing" rockets. (Default : 0) 141 | "can be stolen" "0" // Can you steal this rocket from its target? (Default : 0) 142 | "steal team check" "1" // Checks if the stealer and the target are on the same team. (Default : 0) 143 | // Useful for neutral rockets. 144 | 145 | // >>> Movement parameters <<< 146 | "damage" "50" // Base damage done by the rocket. 147 | "damage increment" "25" // Increment per reflection. 148 | // Damage is multiplied by 3 if the rocket is critical. 149 | 150 | "speed" "875" // Base speed for the rocket. 151 | "speed increment" "160" // Speed increment per reflection. 152 | "speed limit" "0" // Speed limit for the rocket (0 to disable speed limiting) 153 | 154 | "turn rate" "0.260" // Turn rate / tick for this rocket. 155 | "turn rate increment" "0.0180" // Increment per reflection. 156 | "turn rate limit" "0" // Maximum turn rate when deflected (0 to disable turn rate limiting) 157 | // Cannot exceed 1.0 regardless of the actual limit value 158 | 159 | "elevation rate" "0" // Elevation rate when deflected (if enabled) 160 | "elevation limit" "0" // Maximum elevation when deflected (if enabled) 161 | 162 | "control delay" "0" // Delay until the rocket starts tracking the target after a deflection. 163 | 164 | // "drag time min": After a deflect, this is the delay (in seconds) before the player's aim starts guiding the rocket. 165 | // "drag time max": This is the total duration (in seconds) the player can guide the rocket after the initial min_time delay. 166 | // Example: min 0.1, max 0.5 means dragging starts 0.1s after deflect and lasts for 0.5s, ending at 0.6s after deflect. 167 | // This does not affect "legacy homing" rockets. 168 | "drag time min" "0.05" 169 | "drag time max" "0.05" 170 | 171 | "max bounces" "1000" // How many times can this rocket bounce? 172 | "bounce scale" "1.0" // How hard should the rocket bounce? (Default : 1.0 multiplier) 173 | "bounce force scale" "1.5" // Multiplier for how much stronger a player-forced bounce is. 174 | "bounce force angle" "45.0" // Minimum downward angle a player must look to trigger a stronger bounce. 175 | 176 | "critical chance" "100" // Percentage of chance for a critical rocket. 177 | 178 | "no. players modifier" "0" // Increment based upon the number of players in the server. 179 | "no. rockets modifier" "0" // Increment based upon the number of rockets fired since the start of the round. 180 | "direction to target weight" "100" // Weight modifier for target selection, based upon the direction of the rocket 181 | // to the client. 182 | 183 | // >>> Events <<< 184 | "on spawn" "" // Actions to execute on rocket spawn. 185 | "on deflect" "" // Actions to execute when a rocket is deflected. 186 | "on kill" "" // Actions to execute when a rocket kills a client. 187 | "on explode" "" // Actions to execute when a rocket kills a client (triggered once). 188 | "on no target" "" // Actions to execute when a rocket has an invalid target. 189 | "on destroyed" "" // Actions to execute when a rocket explodes (will not trigger if the player is killed by the rocket). 190 | } 191 | 192 | "nuke" 193 | { 194 | // >>> Basic parameters <<< 195 | "name" "Nuke!" 196 | "behaviour" "homing" 197 | "model" "models/custom/dodgeball/nuke/nuke.mdl" 198 | "is animated" "1" 199 | "trail particle" "" 200 | "trail sprite" "" 201 | "custom color" "" 202 | "remove particles" "" 203 | "replace particles" "" 204 | "play spawn sound" "1" 205 | "play beep sound" "1" 206 | "play alert sound" "1" 207 | "spawn sound" "" 208 | "beep sound" "" 209 | "alert sound" "" 210 | "beep interval" "0.2" 211 | 212 | // >>> Specific behaviour modificators <<< 213 | "elevate on deflect" "0" 214 | "neutral rocket" "0" 215 | "keep direction" "1" 216 | "teamless deflects" "0" 217 | "reset bounces" "0" 218 | "no bounce drags" "0" 219 | 220 | // >>> Movement parameters <<< 221 | "damage" "200" 222 | "damage increment" "200" 223 | "speed" "550" 224 | "speed increment" "100" 225 | "speed limit" "0" 226 | "turn rate" "0.233" 227 | "turn rate increment" "0.0275" 228 | "turn rate limit" "0" 229 | "elevation rate" "0.1237" 230 | "elevation limit" "0.1237" 231 | "control delay" "0" 232 | "drag time min" "0.03" 233 | "drag time max" "0.03" 234 | "max bounces" "0" 235 | "bounce scale" "1.0" 236 | "bounce force scale" "1.5" 237 | "bounce force angle" "45.0" 238 | "critical chance" "100" 239 | "no. players modifier" "0" 240 | "no. rockets modifier" "0" 241 | "direction to target weight" "25" 242 | 243 | // >>> Events <<< 244 | "on spawn" "" 245 | "on deflect" "" 246 | "on kill" "" 247 | "on explode" "tf_dodgeball_explosion @dead ; tf_dodgeball_shockwave @dead 200 1000 1000 600" 248 | "on no target" "" 249 | } 250 | } 251 | 252 | "spawners" 253 | { 254 | // >>> Default RED spawner <<< 255 | "red" 256 | { 257 | // >>> Basic parameters <<< 258 | "max rockets" "1" // Max no. of rockets before the spawner can fire another. (Default : 1) 259 | "interval" "2.0" // Minimum time between rocket fires. (Default : 2.0 seconds) 260 | 261 | // >>> Chances table <<< 262 | "common%" "90" // Chance to spawn a common rocket 263 | "nuke%" "10" // Chance to spawn a nuke rocket 264 | } 265 | 266 | // >>> Default BLU spawner <<< 267 | "blu" 268 | { 269 | // >>> Basic parameters <<< 270 | "max rockets" "1" // Max no. of rockets before the spawner can fire another. 271 | "interval" "2.0" // Minimum time between rocket fires. 272 | 273 | // >>> Chances table <<< 274 | "common%" "90" // Chance to spawn a common rocket 275 | "nuke%" "10" // Chance to spawn a nuke rocket 276 | } 277 | } 278 | } 279 | -------------------------------------------------------------------------------- /Subplugins/FFA/scripting/TF2DodgeballFFA.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #define PLUGIN_NAME "[TFDB] Free-for-All" 11 | #define PLUGIN_AUTHOR "x07x08" 12 | #define PLUGIN_DESCRIPTION "Makes all rockets neutral" 13 | #define PLUGIN_VERSION "1.1.3" 14 | #define PLUGIN_URL "https://github.com/x07x08/TF2-Dodgeball-Modified" 15 | 16 | bool g_bLoaded; 17 | bool g_bFFAEnabled; 18 | int g_iBotCount; 19 | bool g_bVoteAllowed; 20 | float g_fLastVoteTime; 21 | int g_iOldTeam[MAXPLAYERS + 1]; 22 | 23 | Address g_pMyWearables; 24 | 25 | ConVar g_hCvarDisableOnBot; 26 | ConVar g_hCvarVoteTimeout; 27 | ConVar g_hCvarVoteDuration; 28 | ConVar g_hCvarToggleMode; 29 | ConVar g_hCvarAllowStealing; 30 | ConVar g_hCvarDisableConfig; 31 | ConVar g_hCvarEnableConfig; 32 | ConVar g_hCvarSwitchTeams; 33 | ConVar g_hCvarFriendlyFire; 34 | 35 | public Plugin myinfo = 36 | { 37 | name = PLUGIN_NAME, 38 | author = PLUGIN_AUTHOR, 39 | description = PLUGIN_DESCRIPTION, 40 | version = PLUGIN_VERSION, 41 | url = PLUGIN_URL 42 | }; 43 | 44 | public void OnPluginStart() 45 | { 46 | LoadTranslations("tfdb.phrases.txt"); 47 | 48 | g_pMyWearables = view_as
(FindSendPropInfo("CTFPlayer", "m_hMyWearables")); 49 | 50 | g_hCvarDisableOnBot = CreateConVar("tf_dodgeball_ffa_bot", "1", "Disable FFA when a bot joins?", _, true, 0.0, true, 1.0); 51 | g_hCvarVoteTimeout = CreateConVar("tf_dodgeball_ffa_timeout", "150", "Vote timeout (in seconds)", _, true, 0.0); 52 | g_hCvarVoteDuration = CreateConVar("tf_dodgeball_ffa_duration", "20", "Vote duration (in seconds)", _, true, 0.0); 53 | g_hCvarToggleMode = CreateConVar("tf_dodgeball_ffa_mode", "1", "How does changing FFA affect the rockets?\n 0 - No effect, wait for the next spawn\n 1 - Destroy all active rockets\n 2 - Immediately change the rockets to be neutral", _, true, 0.0); 54 | g_hCvarAllowStealing = CreateConVar("tf_dodgeball_ffa_stealing", "1", "Allow stealing in FFA mode?", _, true, 0.0, true, 1.0); 55 | g_hCvarDisableConfig = CreateConVar("tf_dodgeball_ffa_disablecfg", "sourcemod/dodgeball_ffa_disable.cfg", "Config file to execute when disabling FFA mode"); 56 | g_hCvarEnableConfig = CreateConVar("tf_dodgeball_ffa_enablecfg", "sourcemod/dodgeball_ffa_enable.cfg", "Config file to execute when enabling FFA mode"); 57 | g_hCvarSwitchTeams = CreateConVar("tf_dodgeball_ffa_teams", "1", "Automatically swap players when a team is empty in FFA mode?", _, true, 0.0, true, 1.0); 58 | g_hCvarFriendlyFire = FindConVar("mp_friendlyfire"); 59 | 60 | RegAdminCmd("sm_ffa", CmdToggleFFA, ADMFLAG_CONFIG, "Forcefully toggle FFA"); 61 | RegConsoleCmd("sm_voteffa", CmdVoteFFA, "Start a vote to toggle FFA"); 62 | 63 | if (!TFDB_IsDodgeballEnabled()) return; 64 | 65 | TFDB_OnRocketsConfigExecuted(); 66 | } 67 | 68 | public void TFDB_OnRocketsConfigExecuted() 69 | { 70 | if (g_bLoaded) return; 71 | 72 | int iTeam; 73 | 74 | g_bVoteAllowed = true; 75 | g_bFFAEnabled = false; 76 | g_iBotCount = 0; 77 | g_fLastVoteTime = 0.0; 78 | 79 | for (int iClient = 1; iClient <= MaxClients; iClient++) 80 | { 81 | if (!IsClientInGame(iClient)) continue; 82 | 83 | iTeam = GetClientTeam(iClient); 84 | 85 | if (!(iTeam >= 2)) continue; 86 | 87 | g_iOldTeam[iClient] = iTeam; 88 | 89 | if (IsFakeClient(iClient)) g_iBotCount++; 90 | } 91 | 92 | g_hCvarDisableOnBot.AddChangeHook(DisableOnBotCallback); 93 | 94 | HookEvent("player_team", OnPlayerTeam); 95 | HookEvent("player_death", OnPlayerDeath); 96 | HookEvent("teamplay_round_start", OnRoundStart); 97 | 98 | g_bLoaded = true; 99 | } 100 | 101 | public void OnMapEnd() 102 | { 103 | if (!g_bLoaded) return; 104 | 105 | UnhookEvent("player_team", OnPlayerTeam); 106 | UnhookEvent("player_death", OnPlayerDeath); 107 | UnhookEvent("teamplay_round_start", OnRoundStart); 108 | 109 | g_hCvarDisableOnBot.RemoveChangeHook(DisableOnBotCallback); 110 | 111 | g_bVoteAllowed = false; 112 | g_bFFAEnabled = false; 113 | g_iBotCount = 0; 114 | g_fLastVoteTime = 0.0; 115 | 116 | g_hCvarFriendlyFire.RestoreDefault(); 117 | ExecuteDisableConfig(); 118 | 119 | g_bLoaded = false; 120 | } 121 | 122 | public void OnClientDisconnect(int iClient) 123 | { 124 | g_iOldTeam[iClient] = 0; 125 | 126 | if (!g_bFFAEnabled || 127 | !g_hCvarSwitchTeams.BoolValue || 128 | (g_hCvarDisableOnBot.BoolValue && g_iBotCount) || 129 | !TFDB_GetRoundStarted()) 130 | { 131 | return; 132 | } 133 | 134 | int iTeam = GetClientTeam(iClient); 135 | 136 | if (iTeam <= 1) return; 137 | 138 | int iOtherTeam = GetAnalogueTeam(iTeam); 139 | 140 | if (((GetTeamAliveClientCount(iTeam) - view_as(IsPlayerAlive(iClient))) == 0) && 141 | ((GetTeamAliveClientCount(iOtherTeam) - 1) >= 1)) 142 | { 143 | ChangeAliveClientTeam(GetRandomTeamAliveClient(iOtherTeam), iTeam); 144 | } 145 | } 146 | 147 | public void OnClientConnected(int iClient) 148 | { 149 | g_iOldTeam[iClient] = 0; 150 | } 151 | 152 | public void OnPlayerTeam(Event hEvent, char[] strEventName, bool bDontBroadcast) 153 | { 154 | int iClient = GetClientOfUserId(hEvent.GetInt("userid")); 155 | int iTeam = hEvent.GetInt("team"); 156 | int iOldTeam = hEvent.GetInt("oldteam"); 157 | 158 | if (!g_bFFAEnabled || 159 | !g_hCvarSwitchTeams.BoolValue || 160 | (g_hCvarDisableOnBot.BoolValue && g_iBotCount) || 161 | !TFDB_GetRoundStarted()) 162 | { 163 | g_iOldTeam[iClient] = iTeam; 164 | } 165 | else 166 | { 167 | // If you swap between RED and BLU, this event gets fired first instead of player_death. 168 | // This makes GetClientTeam report the new team instead of the old one when used inside a player_death callback. 169 | 170 | if (iTeam <= 1) 171 | { 172 | g_iOldTeam[iClient] = iTeam; 173 | } 174 | else if ((iOldTeam >= 2) && 175 | ((GetTeamAliveClientCount(iOldTeam) - view_as(IsPlayerAlive(iClient))) == 0) && 176 | ((GetTeamAliveClientCount(iTeam) - 1) >= 1)) 177 | { 178 | ChangeAliveClientTeam(GetRandomTeamAliveClient(iTeam), iOldTeam); 179 | } 180 | } 181 | 182 | if (!IsFakeClient(iClient)) return; 183 | 184 | if ((iOldTeam <= 1) && (iTeam >= 2)) 185 | { 186 | g_iBotCount++; 187 | 188 | if (g_bFFAEnabled && (g_iBotCount == 1) && g_hCvarDisableOnBot.BoolValue) 189 | { 190 | CPrintToChatAll("%t", "Dodgeball_FFABot_Joined"); 191 | g_hCvarFriendlyFire.RestoreDefault(); 192 | ExecuteDisableConfig(); 193 | } 194 | } 195 | else if ((iOldTeam >= 2) && (iTeam <= 1)) 196 | { 197 | g_iBotCount--; 198 | 199 | if (g_bFFAEnabled && (g_iBotCount == 0) && g_hCvarDisableOnBot.BoolValue) 200 | { 201 | CPrintToChatAll("%t", "Dodgeball_FFABot_Left"); 202 | g_hCvarFriendlyFire.SetBool(true); 203 | ExecuteEnableConfig(); 204 | } 205 | } 206 | } 207 | 208 | public void OnPlayerDeath(Event hEvent, char[] strEventName, bool bDontBroadcast) 209 | { 210 | if (!g_bFFAEnabled || 211 | !g_hCvarSwitchTeams.BoolValue || 212 | (g_hCvarDisableOnBot.BoolValue && g_iBotCount) || 213 | !TFDB_GetRoundStarted()) 214 | { 215 | return; 216 | } 217 | 218 | int iVictim = GetClientOfUserId(hEvent.GetInt("userid")); 219 | 220 | int iTeam = GetClientTeam(iVictim); 221 | 222 | if (iTeam <= 1) return; // ... 223 | 224 | int iOtherTeam = GetAnalogueTeam(iTeam); 225 | 226 | // Checking the alive players count in here doesn't exclude the player that has just died. 227 | // Doing this check in a SDKHook_OnTakeDamagePost callback excludes him for some reason... 228 | 229 | if (((GetTeamAliveClientCount(iTeam) - 1) == 0) && ((GetTeamAliveClientCount(iOtherTeam) - 1) >= 1)) 230 | { 231 | ChangeAliveClientTeam(GetRandomTeamAliveClient(iOtherTeam), iTeam); 232 | } 233 | } 234 | 235 | public void OnRoundStart(Event hEvent, char[] strEventName, bool bDontBroadcast) 236 | { 237 | if (!g_bFFAEnabled || 238 | !g_hCvarSwitchTeams.BoolValue || 239 | (g_hCvarDisableOnBot.BoolValue && g_iBotCount)) 240 | { 241 | return; 242 | } 243 | 244 | int iTeam; 245 | 246 | for (int iClient = 1; iClient <= MaxClients; iClient++) 247 | { 248 | if (!IsClientInGame(iClient) || ((iTeam = GetClientTeam(iClient)) <= 1)) continue; 249 | 250 | if ((g_iOldTeam[iClient] >= 2) && 251 | (g_iOldTeam[iClient] != iTeam) && 252 | ((GetTeamAliveClientCount(iTeam) - view_as(IsPlayerAlive(iClient))) >= 1)) 253 | { 254 | ChangeClientTeam(iClient, g_iOldTeam[iClient]); 255 | } 256 | 257 | if (g_iOldTeam[iClient] <= 1) g_iOldTeam[iClient] = iTeam; 258 | } 259 | } 260 | 261 | public Action CmdToggleFFA(int iClient, int iArgs) 262 | { 263 | if (!TFDB_IsDodgeballEnabled()) 264 | { 265 | CReplyToCommand(iClient, "%t", "Command_Disabled"); 266 | 267 | return Plugin_Handled; 268 | } 269 | 270 | ToggleFFA(); 271 | 272 | return Plugin_Handled; 273 | } 274 | 275 | public Action CmdVoteFFA(int iClient, int iArgs) 276 | { 277 | if (iClient == 0) 278 | { 279 | // CReplyToCommand prints the message twice... 280 | ReplyToCommand(iClient, "Command is in-game only."); 281 | 282 | return Plugin_Handled; 283 | } 284 | 285 | if (!TFDB_IsDodgeballEnabled()) 286 | { 287 | CReplyToCommand(iClient, "%t", "Command_Disabled"); 288 | 289 | return Plugin_Handled; 290 | } 291 | 292 | if (IsVoteInProgress()) 293 | { 294 | CReplyToCommand(iClient, "%t", "Dodgeball_FFAVote_Conflict"); 295 | 296 | return Plugin_Handled; 297 | } 298 | 299 | if (g_bVoteAllowed) 300 | { 301 | g_bVoteAllowed = false; 302 | g_fLastVoteTime = GetGameTime(); 303 | 304 | StartFFAVote(); 305 | CreateTimer(g_hCvarVoteTimeout.FloatValue, VoteTimeoutCallback, _, TIMER_FLAG_NO_MAPCHANGE); 306 | } 307 | else 308 | { 309 | CReplyToCommand(iClient, "%t", "Dodgeball_FFAVote_Cooldown", 310 | RoundToCeil((g_fLastVoteTime + g_hCvarVoteTimeout.FloatValue) - GetGameTime())); 311 | } 312 | 313 | return Plugin_Handled; 314 | } 315 | 316 | public void DisableOnBotCallback(ConVar hConvar, const char[] strOldValue, const char[] strNewValue) 317 | { 318 | if (!g_bFFAEnabled || !g_iBotCount) return; 319 | 320 | if (hConvar.BoolValue) 321 | { 322 | g_hCvarFriendlyFire.RestoreDefault(); 323 | ExecuteDisableConfig(); 324 | } 325 | else 326 | { 327 | g_hCvarFriendlyFire.SetBool(true); 328 | ExecuteEnableConfig(); 329 | } 330 | } 331 | 332 | void StartFFAVote() 333 | { 334 | char strMode[16]; 335 | strMode = !g_bFFAEnabled ? "Enable" : "Disable"; 336 | 337 | Menu hMenu = new Menu(VoteMenuHandler); 338 | hMenu.VoteResultCallback = VoteResultHandler; 339 | 340 | hMenu.SetTitle("%s FFA mode?", strMode); 341 | 342 | hMenu.AddItem("0", "Yes"); 343 | hMenu.AddItem("1", "No"); 344 | 345 | int iTotal; 346 | int[] iClients = new int[MaxClients]; 347 | 348 | for (int iClient = 1; iClient <= MaxClients; iClient++) 349 | { 350 | if (!IsClientInGame(iClient) || IsFakeClient(iClient) || GetClientTeam(iClient) <= 1) 351 | { 352 | continue; 353 | } 354 | 355 | iClients[iTotal++] = iClient; 356 | } 357 | 358 | hMenu.DisplayVote(iClients, iTotal, g_hCvarVoteDuration.IntValue); 359 | } 360 | 361 | public int VoteMenuHandler(Menu hMenu, MenuAction iMenuActions, int iParam1, int iParam2) 362 | { 363 | switch (iMenuActions) 364 | { 365 | case MenuAction_End : 366 | { 367 | delete hMenu; 368 | } 369 | } 370 | 371 | return 0; 372 | } 373 | 374 | public void VoteResultHandler(Menu hMenu, 375 | int iNumVotes, 376 | int iNumClients, 377 | const int[][] iClientInfo, 378 | int iNumItems, 379 | const int[][] iItemInfo) 380 | { 381 | int iWinnerIndex = 0; 382 | 383 | if (iNumItems > 1 && 384 | (iItemInfo[0][VOTEINFO_ITEM_VOTES] == iItemInfo[1][VOTEINFO_ITEM_VOTES])) 385 | { 386 | iWinnerIndex = GetRandomInt(0, 1); 387 | } 388 | 389 | char strWinner[8]; hMenu.GetItem(iItemInfo[iWinnerIndex][VOTEINFO_ITEM_INDEX], strWinner, sizeof(strWinner)); 390 | 391 | if (StrEqual(strWinner, "0")) 392 | { 393 | ToggleFFA(); 394 | } 395 | else 396 | { 397 | CPrintToChatAll("%t", "Dodgeball_FFAVote_Failed"); 398 | } 399 | } 400 | 401 | void EnableFFA() 402 | { 403 | g_bFFAEnabled = true; 404 | 405 | if (g_hCvarDisableOnBot.BoolValue && g_iBotCount) 406 | { 407 | CPrintToChatAll("%t", "Dodgeball_FFAVote_LateEnabled"); 408 | } 409 | else 410 | { 411 | g_hCvarFriendlyFire.SetBool(true); 412 | ExecuteEnableConfig(); 413 | 414 | switch (g_hCvarToggleMode.IntValue) 415 | { 416 | case 1 : 417 | { 418 | TFDB_DestroyRockets(); 419 | } 420 | 421 | case 2 : 422 | { 423 | ChangeRockets(); 424 | } 425 | } 426 | 427 | CPrintToChatAll("%t", "Dodgeball_FFAVote_Enabled"); 428 | } 429 | } 430 | 431 | void DisableFFA() 432 | { 433 | g_bFFAEnabled = false; 434 | g_hCvarFriendlyFire.RestoreDefault(); 435 | ExecuteDisableConfig(); 436 | 437 | switch (g_hCvarToggleMode.IntValue) 438 | { 439 | case 1 : 440 | { 441 | TFDB_DestroyRockets(); 442 | } 443 | 444 | case 2 : 445 | { 446 | ChangeRockets(); 447 | } 448 | } 449 | 450 | CPrintToChatAll("%t", "Dodgeball_FFAVote_Disabled"); 451 | } 452 | 453 | void ToggleFFA() 454 | { 455 | if (!g_bFFAEnabled) 456 | { 457 | EnableFFA(); 458 | } 459 | else 460 | { 461 | DisableFFA(); 462 | } 463 | } 464 | 465 | void ChangeRockets() 466 | { 467 | RocketFlags iFlags, iClassFlags; 468 | int iEntity; 469 | 470 | for (int iIndex = 0; iIndex < MAX_ROCKETS; iIndex++) 471 | { 472 | if (!TFDB_IsValidRocket(iIndex)) continue; 473 | 474 | iFlags = TFDB_GetRocketFlags(iIndex); 475 | iClassFlags = TFDB_GetRocketClassFlags(TFDB_GetRocketClass(iIndex)); 476 | iEntity = EntRefToEntIndex(TFDB_GetRocketEntity(iIndex)); 477 | 478 | if (g_bFFAEnabled) 479 | { 480 | iFlags |= RocketFlag_IsNeutral; 481 | 482 | if (g_hCvarAllowStealing.BoolValue) iFlags |= RocketFlag_CanBeStolen; 483 | 484 | SetEntProp(iEntity, Prop_Send, "m_iTeamNum", 1, 1); 485 | 486 | TFDB_SetRocketFlags(iIndex, iFlags); 487 | } 488 | else 489 | { 490 | if (!(iClassFlags & RocketFlag_IsNeutral)) iFlags &= ~RocketFlag_IsNeutral; 491 | 492 | if (g_hCvarAllowStealing.BoolValue && !(iClassFlags & RocketFlag_CanBeStolen)) iFlags &= ~RocketFlag_CanBeStolen; 493 | 494 | int iOwner = GetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity"); 495 | SetEntProp(iEntity, Prop_Send, "m_iTeamNum", GetClientTeam(iOwner), 1); 496 | 497 | TFDB_SetRocketFlags(iIndex, iFlags); 498 | } 499 | } 500 | } 501 | 502 | public Action VoteTimeoutCallback(Handle hTimer) 503 | { 504 | g_bVoteAllowed = true; 505 | 506 | return Plugin_Continue; 507 | } 508 | 509 | public Action TFDB_OnRocketCreatedPre(int iIndex, int &iClass, RocketFlags &iFlags) 510 | { 511 | if (g_bFFAEnabled && (!g_hCvarDisableOnBot.BoolValue || !g_iBotCount)) 512 | { 513 | iFlags |= RocketFlag_IsNeutral; 514 | 515 | if (g_hCvarAllowStealing.BoolValue) iFlags |= RocketFlag_CanBeStolen; 516 | 517 | return Plugin_Changed; 518 | } 519 | 520 | return Plugin_Continue; 521 | } 522 | 523 | void ExecuteDisableConfig() 524 | { 525 | char strConfigPath[64]; g_hCvarDisableConfig.GetString(strConfigPath, sizeof(strConfigPath)); 526 | ServerCommand("exec \"%s\"", strConfigPath); 527 | } 528 | 529 | void ExecuteEnableConfig() 530 | { 531 | char strConfigPath[64]; g_hCvarEnableConfig.GetString(strConfigPath, sizeof(strConfigPath)); 532 | ServerCommand("exec \"%s\"", strConfigPath); 533 | } 534 | 535 | int GetTeamAliveClientCount(int iTeam) 536 | { 537 | int iCount; 538 | 539 | for (int iClient = 1; iClient <= MaxClients; iClient++) 540 | { 541 | if (!IsClientInGame(iClient)) continue; 542 | 543 | if ((GetClientTeam(iClient) == iTeam) && IsPlayerAlive(iClient)) iCount++; 544 | } 545 | 546 | return iCount; 547 | } 548 | 549 | stock int GetAnalogueTeam(int iTeam) 550 | { 551 | if (iTeam == view_as(TFTeam_Red)) return view_as(TFTeam_Blue); 552 | 553 | return view_as(TFTeam_Red); 554 | } 555 | 556 | // https://forums.alliedmods.net/showthread.php?t=286924 557 | 558 | int GetRandomTeamAliveClient(int iTeam) 559 | { 560 | int[] iClients = new int[MaxClients]; 561 | int iCount; 562 | 563 | for (int iClient = 1; iClient <= MaxClients; iClient++) 564 | { 565 | if (!IsClientInGame(iClient)) continue; 566 | 567 | if ((GetClientTeam(iClient) == iTeam) && IsPlayerAlive(iClient)) iClients[iCount++] = iClient; 568 | } 569 | 570 | return iCount == 0 ? -1 : iClients[GetRandomInt(0, iCount - 1)]; 571 | } 572 | 573 | // https://forums.alliedmods.net/showthread.php?t=314271 574 | 575 | void ChangeAliveClientTeam(int iClient, int iTeam) 576 | { 577 | int iLifeState = GetEntProp(iClient, Prop_Send, "m_lifeState"); 578 | SetEntProp(iClient, Prop_Send, "m_lifeState", 2); 579 | 580 | ChangeClientTeam(iClient, iTeam); 581 | SetEntProp(iClient, Prop_Send, "m_lifeState", iLifeState); 582 | 583 | int iWearable; 584 | int iWearablesCount = GetPlayerWearablesCount(iClient); 585 | Address pData = DereferencePointer(GetEntityAddress(iClient) + g_pMyWearables); 586 | 587 | for (int iIndex = 0; iIndex < iWearablesCount; iIndex++) 588 | { 589 | iWearable = LoadEntityHandleFromAddress(pData + view_as
(0x04 * iIndex)); 590 | 591 | SetEntProp(iWearable, Prop_Send, "m_nSkin", (iTeam == view_as(TFTeam_Blue)) ? 1 : 0); 592 | SetEntProp(iWearable, Prop_Send, "m_iTeamNum", iTeam); 593 | } 594 | } 595 | 596 | /* 597 | https://github.com/nosoop/SM-TFUtils/blob/master/scripting/tf2utils.sp 598 | https://github.com/nosoop/stocksoup/blob/master/memory.inc 599 | */ 600 | 601 | stock int LoadEntityHandleFromAddress(Address pAddress) 602 | { 603 | return EntRefToEntIndex(LoadFromAddress(pAddress, NumberType_Int32) | (1 << 31)); 604 | } 605 | 606 | stock Address DereferencePointer(Address pAddress) 607 | { 608 | // maybe someday we'll do 64-bit addresses 609 | return view_as
(LoadFromAddress(pAddress, NumberType_Int32)); 610 | } 611 | 612 | int GetPlayerWearablesCount(int iClient) 613 | { 614 | return GetEntData(iClient, view_as(g_pMyWearables) + 0x0C); 615 | } 616 | -------------------------------------------------------------------------------- /TF2Dodgeball/addons/sourcemod/translations/tfdb.phrases.txt: -------------------------------------------------------------------------------- 1 | "Phrases" 2 | { 3 | "Command_Disabled" 4 | { 5 | "en" "[{olive}TFDB{default}] This command is disabled." 6 | } 7 | 8 | "Command_DBExplosion_Usage" 9 | { 10 | "en" "Usage : tf_dodgeball_explosion " 11 | } 12 | 13 | "Command_DBShockwave_Usage" 14 | { 15 | "en" "Usage : tf_dodgeball_shockwave " 16 | } 17 | 18 | "Command_DBRefresh_Done" 19 | { 20 | "#format" "{1:N}" 21 | "en" "[{olive}TFDB{default}] {darkorange}{1}{default} refreshed the {steelblue}dodgeball configs{default}." 22 | } 23 | 24 | "Command_DBHideParticles_Hidden" 25 | { 26 | "en" "[{olive}TFDB{default}] Custom rocket {darkorange}particle{default} trails are now {steelblue}hidden{default}." 27 | } 28 | 29 | "Command_DBHideParticles_Visible" 30 | { 31 | "en" "[{olive}TFDB{default}] Custom rocket {darkorange}particle{default} trails are now {steelblue}visible{default}." 32 | } 33 | 34 | "Command_DBHideSprites_Hidden" 35 | { 36 | "en" "[{olive}TFDB{default}] Custom rocket {darkorange}sprite{default} trails are now {steelblue}hidden{default}." 37 | } 38 | 39 | "Command_DBHideSprites_Visible" 40 | { 41 | "en" "[{olive}TFDB{default}] Custom rocket {darkorange}sprite{default} trails are now {steelblue}visible{default}." 42 | } 43 | 44 | "DBSteal_Warning_Client" 45 | { 46 | "#format" "{1:i},{2:i}" 47 | "en" "[{olive}TFDB{default}] Do not steal rockets. [Warning {darkorange}{1}{default} / {darkorange}{2}{default}]" 48 | } 49 | 50 | "DBSteal_Announce_All" 51 | { 52 | "#format" "{1:N},{2:N}" 53 | "en" "[{olive}TFDB{default}] {darkorange}{1}{default} stole {steelblue}{2}{default}'s rocket!" 54 | } 55 | 56 | "DBSteal_Slay_Client" 57 | { 58 | "en" "[{olive}TFDB{default}] You have been slain for stealing rockets." 59 | } 60 | 61 | "DBSteal_Announce_Slay_All" 62 | { 63 | "#format" "{1:N}" 64 | "en" "[{olive}TFDB{default}] {darkorange}{1}{default} was slain for stealing rockets." 65 | } 66 | 67 | "DBDelay_Announce_All" 68 | { 69 | "#format" "{1:N}" 70 | "en" "[{olive}TFDB{default}] {darkorange}{1}{default} is delaying, the rocket will now speed up." 71 | } 72 | 73 | // Starting from here, the translations are used by other plugins 74 | // Add your own custom phrases here to maintain the order 75 | 76 | "Dodgeball_AirblastPreventionCmd_Enabled" 77 | { 78 | "en" "[{olive}TFDB{default}] {community}Enabled{default} airblast push prevention." 79 | } 80 | 81 | "Dodgeball_AirblastPreventionCmd_Disabled" 82 | { 83 | "en" "[{olive}TFDB{default}] {red}Disabled{default} airblast push prevention." 84 | } 85 | 86 | "Dodgeball_FFAVote_Conflict" 87 | { 88 | "en" "[{olive}TFDB{default}] There is another vote currently in progress." 89 | } 90 | 91 | "Dodgeball_FFAVote_Cooldown" 92 | { 93 | "#format" "{1:i}" 94 | "en" "[{olive}TFDB{default}] Voting for {darkmagenta}FFA{default} is in cooldown for {darkorange}{1}{default} seconds." 95 | } 96 | 97 | "Dodgeball_FFAVote_Failed" 98 | { 99 | "en" "[{olive}TFDB{default}] {darkmagenta}FFA{default} vote {red}failed{default}." 100 | } 101 | 102 | "Dodgeball_FFAVote_Enabled" 103 | { 104 | "en" "[{olive}TFDB{default}] {darkmagenta}FFA{default} is now {community}enabled{default}." 105 | } 106 | 107 | "Dodgeball_FFAVote_LateEnabled" 108 | { 109 | "en" "[{olive}TFDB{default}] {darkmagenta}FFA{default} will be {community}enabled{default} once the bot leaves." 110 | } 111 | 112 | "Dodgeball_FFAVote_Disabled" 113 | { 114 | "en" "[{olive}TFDB{default}] {darkmagenta}FFA{default} is now {red}disabled{default}." 115 | } 116 | 117 | "Dodgeball_FFABot_Joined" 118 | { 119 | "en" "[{olive}TFDB{default}] A bot has joined. {darkmagenta}FFA{default} is now {red}disabled{default}." 120 | } 121 | 122 | "Dodgeball_FFABot_Left" 123 | { 124 | "en" "[{olive}TFDB{default}] The bot(s) left. {darkmagenta}FFA{default} is now {community}enabled{default}." 125 | } 126 | 127 | "Dodgeball_Death_Message" 128 | { 129 | "#format" "{1:N},{2:i}" 130 | "en" "[{olive}TFDB{default}] {burlywood}{1}{default} died to a rocket travelling {red}{2}{default} MpH" 131 | } 132 | 133 | "Dodgeball_Disabled" 134 | { 135 | "en" "[{olive}TFDB{default}] Dodgeball is disabled." 136 | } 137 | 138 | "Hud_Enabled" 139 | { 140 | "en" "[{olive}TFDB{default}] Rocket speedometer is now {darkorange}enabled{default}." 141 | } 142 | 143 | "Hud_Disabled" 144 | { 145 | "en" "[{olive}TFDB{default}] Rocket speedometer is now {darkorange}disabled{default}." 146 | } 147 | 148 | // {1} - MpH speed (Miles per Hour) 149 | // {2} - HU speed (Hammer Units) 150 | // {3} - Deflections 151 | // {4} - Index 152 | // {5} - Rocket class long name 153 | 154 | "Hud_Speedometer" 155 | { 156 | "#format" "{1:.0f},{2:.0f},{3:i},{4:i},{5:s}" 157 | "en" "Speed : {1} MpH" 158 | } 159 | 160 | // {1} - MpH speed (Miles per Hour) 161 | // {2} - HU speed (Hammer Units) 162 | // {3} - Deflections 163 | // {4} - Index 164 | // {5} - Rocket class long name 165 | 166 | // This one is for displaying multiple rockets 167 | 168 | "Hud_SpeedometerEx" 169 | { 170 | "#format" "{1:.0f},{2:.0f},{3:i},{4:i},{5:s}" 171 | "en" "{4}. {5} : {1} MpH" 172 | } 173 | 174 | "Menu_NoRockets" 175 | { 176 | "en" "[{olive}TFDB{default}] There are {red}no active{default} rockets." 177 | } 178 | 179 | "Menu_InvalidRocket" 180 | { 181 | "en" "[{olive}TFDB{default}] This rocket is {red}not valid{default} anymore." 182 | } 183 | 184 | "Menu_InvalidClient" 185 | { 186 | "en" "[{olive}TFDB{default}] Client is dead or has disconnected from the server." 187 | } 188 | 189 | "Menu_CannotTarget" 190 | { 191 | "en" "[{olive}TFDB{default}] Can't change target to this client." 192 | } 193 | 194 | "Menu_SameTarget" 195 | { 196 | "en" "[{olive}TFDB{default}] Can't change to the same target." 197 | } 198 | 199 | "Menu_ChangedTarget" 200 | { 201 | "#format" "{1:N}" 202 | "en" "[{olive}TFDB{default}] Changed the target of a rocket to {darkorange}{1}{default}." 203 | } 204 | 205 | "Menu_SameRocketClass" 206 | { 207 | "en" "[{olive}TFDB{default}] Can't change to the same class." 208 | } 209 | 210 | "Menu_ChangedRocketClass" 211 | { 212 | "#format" "{1:s},{2:s}" 213 | "en" "[{olive}TFDB{default}] Changed the class of a rocket from {darkorange}{1}{default} to {steelblue}{2}{default}." 214 | } 215 | 216 | "Menu_Reset" 217 | { 218 | "en" "[{olive}TFDB{default}] Type -1 to reset it." 219 | } 220 | 221 | "Menu_ResetBeepInterval" 222 | { 223 | "en" "[{olive}TFDB{default}] Type -1 to reset it, 0 to disable beeping." 224 | } 225 | 226 | "Menu_ResetSpeedLimit" 227 | { 228 | "en" "[{olive}TFDB{default}] Type -1 to reset it, 0 to disable the speed limit." 229 | } 230 | 231 | "Menu_ResetTurnRateLimit" 232 | { 233 | "en" "[{olive}TFDB{default}] Type -1 to reset it, 0 to disable the turn rate limit." 234 | } 235 | 236 | "Menu_SpriteColor" 237 | { 238 | "#format" "{1:i}" 239 | "en" "[{olive}TFDB{default}] Type in chat the new sprite trail color (HEX or RGB) within {darkorange}{1}{default} seconds." 240 | } 241 | 242 | "Menu_SpriteLifetime" 243 | { 244 | "#format" "{1:i}" 245 | "en" "[{olive}TFDB{default}] Type in chat the new sprite trail duration within {darkorange}{1}{default} seconds." 246 | } 247 | 248 | "Menu_SpriteStartWidth" 249 | { 250 | "#format" "{1:i}" 251 | "en" "[{olive}TFDB{default}] Type in chat the new sprite trail start width within {darkorange}{1}{default} seconds." 252 | } 253 | 254 | "Menu_SpriteEndWidth" 255 | { 256 | "#format" "{1:i}" 257 | "en" "[{olive}TFDB{default}] Type in chat the new sprite trail end width within {darkorange}{1}{default} seconds." 258 | } 259 | 260 | "Menu_BeepInterval" 261 | { 262 | "#format" "{1:i}" 263 | "en" "[{olive}TFDB{default}] Type in chat the new beep interval within {darkorange}{1}{default} seconds." 264 | } 265 | 266 | "Menu_CritChance" 267 | { 268 | "#format" "{1:i}" 269 | "en" "[{olive}TFDB{default}] Type in chat the new critical rocket chance within {darkorange}{1}{default} seconds." 270 | } 271 | 272 | "Menu_Damage" 273 | { 274 | "#format" "{1:i}" 275 | "en" "[{olive}TFDB{default}] Type in chat the new damage within {darkorange}{1}{default} seconds." 276 | } 277 | 278 | "Menu_DamageIncrement" 279 | { 280 | "#format" "{1:i}" 281 | "en" "[{olive}TFDB{default}] Type in chat the new damage increment within {darkorange}{1}{default} seconds." 282 | } 283 | 284 | "Menu_Speed" 285 | { 286 | "#format" "{1:i}" 287 | "en" "[{olive}TFDB{default}] Type in chat the new speed within {darkorange}{1}{default} seconds." 288 | } 289 | 290 | "Menu_SpeedIncrement" 291 | { 292 | "#format" "{1:i}" 293 | "en" "[{olive}TFDB{default}] Type in chat the new speed increment within {darkorange}{1}{default} seconds." 294 | } 295 | 296 | "Menu_SpeedLimit" 297 | { 298 | "#format" "{1:i}" 299 | "en" "[{olive}TFDB{default}] Type in chat the new speed limit within {darkorange}{1}{default} seconds." 300 | } 301 | 302 | "Menu_TurnRate" 303 | { 304 | "#format" "{1:i}" 305 | "en" "[{olive}TFDB{default}] Type in chat the new turn rate within {darkorange}{1}{default} seconds." 306 | } 307 | 308 | "Menu_TurnRateIncrement" 309 | { 310 | "#format" "{1:i}" 311 | "en" "[{olive}TFDB{default}] Type in chat the new turn rate increment within {darkorange}{1}{default} seconds." 312 | } 313 | 314 | "Menu_TurnRateLimit" 315 | { 316 | "#format" "{1:i}" 317 | "en" "[{olive}TFDB{default}] Type in chat the new turn rate limit within {darkorange}{1}{default} seconds." 318 | } 319 | 320 | "Menu_ElevationRate" 321 | { 322 | "#format" "{1:i}" 323 | "en" "[{olive}TFDB{default}] Type in chat the new elevation rate within {darkorange}{1}{default} seconds." 324 | } 325 | 326 | "Menu_ElevationLimit" 327 | { 328 | "#format" "{1:i}" 329 | "en" "[{olive}TFDB{default}] Type in chat the new elevation limit within {darkorange}{1}{default} seconds." 330 | } 331 | 332 | "Menu_RocketsModifier" 333 | { 334 | "#format" "{1:i}" 335 | "en" "[{olive}TFDB{default}] Type in chat the new fired rockets modifier within {darkorange}{1}{default} seconds." 336 | } 337 | 338 | "Menu_PlayerModifier" 339 | { 340 | "#format" "{1:i}" 341 | "en" "[{olive}TFDB{default}] Type in chat the new player count modifier within {darkorange}{1}{default} seconds." 342 | } 343 | 344 | "Menu_ControlDelay" 345 | { 346 | "#format" "{1:i}" 347 | "en" "[{olive}TFDB{default}] Type in chat the new control delay within {darkorange}{1}{default} seconds." 348 | } 349 | 350 | "Menu_DragTimeMin" 351 | { 352 | "#format" "{1:i}" 353 | "en" "[{olive}TFDB{default}] Type in chat the new drag time start within {darkorange}{1}{default} seconds." 354 | } 355 | 356 | "Menu_DragTimeMax" 357 | { 358 | "#format" "{1:i}" 359 | "en" "[{olive}TFDB{default}] Type in chat the new drag time end within {darkorange}{1}{default} seconds." 360 | } 361 | 362 | "Menu_TargetWeight" 363 | { 364 | "#format" "{1:i}" 365 | "en" "[{olive}TFDB{default}] Type in chat the new target weight within {darkorange}{1}{default} seconds." 366 | } 367 | 368 | "Menu_MaxBounces" 369 | { 370 | "#format" "{1:i}" 371 | "en" "[{olive}TFDB{default}] Type in chat the new maximum bounces within {darkorange}{1}{default} seconds." 372 | } 373 | 374 | "Menu_BounceScale" 375 | { 376 | "#format" "{1:i}" 377 | "en" "[{olive}TFDB{default}] Type in chat the new bounce scale within {darkorange}{1}{default} seconds." 378 | } 379 | 380 | "Menu_MaxRockets" 381 | { 382 | "#format" "{1:i}" 383 | "en" "[{olive}TFDB{default}] Type in chat the new maximum rockets count within {darkorange}{1}{default} seconds." 384 | } 385 | 386 | "Menu_Interval" 387 | { 388 | "#format" "{1:i}" 389 | "en" "[{olive}TFDB{default}] Type in chat the new rocket spawn interval within {darkorange}{1}{default} seconds." 390 | } 391 | 392 | "Menu_ChancesTable" 393 | { 394 | "#format" "{1:i}" 395 | "en" "[{olive}TFDB{default}] Type in chat the new rocket class spawn chances within {darkorange}{1}{default} seconds." 396 | } 397 | 398 | // Escaping x07 doesn't work. Parsing it as an argument does the job. 399 | 400 | "Menu_ChangedSpriteColor" 401 | { 402 | "#format" "{1:c},{2:s},{3:s}" 403 | "en" "[{olive}TFDB{default}] Changed rocket class sprite trail color to {1}{2}#{3}." 404 | } 405 | 406 | "Menu_ResetSpriteColor" 407 | { 408 | "#format" "{1:c},{2:s},{3:s}" 409 | "en" "[{olive}TFDB{default}] Reset rocket class sprite trail color to {1}{2}#{3}." 410 | } 411 | 412 | "Menu_ChangedSpriteLifetime" 413 | { 414 | "#format" "{1:.2f}" 415 | "en" "[{olive}TFDB{default}] Changed rocket class sprite trail duration to {darkorange}{1}{default}." 416 | } 417 | 418 | "Menu_ChangedSpriteStartWidth" 419 | { 420 | "#format" "{1:.2f}" 421 | "en" "[{olive}TFDB{default}] Changed rocket class sprite trail start width to {darkorange}{1}{default}." 422 | } 423 | 424 | "Menu_ChangedSpriteEndWidth" 425 | { 426 | "#format" "{1:.2f}" 427 | "en" "[{olive}TFDB{default}] Changed rocket class sprite trail end width to {darkorange}{1}{default}." 428 | } 429 | 430 | "Menu_ChangedBeepInterval" 431 | { 432 | "#format" "{1:.2f}" 433 | "en" "[{olive}TFDB{default}] Changed rocket class beep interval to {darkorange}{1}{default}." 434 | } 435 | 436 | "Menu_ChangedCritChance" 437 | { 438 | "#format" "{1:.2f}" 439 | "en" "[{olive}TFDB{default}] Changed rocket class critical chance to {darkorange}{1}{default}." 440 | } 441 | 442 | "Menu_ChangedDamage" 443 | { 444 | "#format" "{1:.2f}" 445 | "en" "[{olive}TFDB{default}] Changed rocket class damage to {darkorange}{1}{default}." 446 | } 447 | 448 | "Menu_ChangedDamageIncrement" 449 | { 450 | "#format" "{1:.2f}" 451 | "en" "[{olive}TFDB{default}] Changed rocket class damage increment to {darkorange}{1}{default}." 452 | } 453 | 454 | "Menu_ChangedSpeed" 455 | { 456 | "#format" "{1:.2f}" 457 | "en" "[{olive}TFDB{default}] Changed rocket class speed to {darkorange}{1}{default}." 458 | } 459 | 460 | "Menu_ChangedSpeedIncrement" 461 | { 462 | "#format" "{1:.2f}" 463 | "en" "[{olive}TFDB{default}] Changed rocket class speed increment to {darkorange}{1}{default}." 464 | } 465 | 466 | "Menu_ChangedSpeedLimit" 467 | { 468 | "#format" "{1:.2f}" 469 | "en" "[{olive}TFDB{default}] Changed rocket class speed limit to {darkorange}{1}{default}." 470 | } 471 | 472 | "Menu_ChangedTurnRate" 473 | { 474 | "#format" "{1:.2f}" 475 | "en" "[{olive}TFDB{default}] Changed rocket class turn rate to {darkorange}{1}{default}." 476 | } 477 | 478 | "Menu_ChangedTurnRateIncrement" 479 | { 480 | "#format" "{1:.2f}" 481 | "en" "[{olive}TFDB{default}] Changed rocket class turn rate increment to {darkorange}{1}{default}." 482 | } 483 | 484 | "Menu_ChangedTurnRateLimit" 485 | { 486 | "#format" "{1:.2f}" 487 | "en" "[{olive}TFDB{default}] Changed rocket class turn rate limit to {darkorange}{1}{default}." 488 | } 489 | 490 | "Menu_ChangedElevationRate" 491 | { 492 | "#format" "{1:.2f}" 493 | "en" "[{olive}TFDB{default}] Changed rocket class elevation rate to {darkorange}{1}{default}." 494 | } 495 | 496 | "Menu_ChangedElevationLimit" 497 | { 498 | "#format" "{1:.2f}" 499 | "en" "[{olive}TFDB{default}] Changed rocket class elevation limit to {darkorange}{1}{default}." 500 | } 501 | 502 | "Menu_ChangedRocketsModifier" 503 | { 504 | "#format" "{1:.2f}" 505 | "en" "[{olive}TFDB{default}] Changed rocket class fired rockets modifier to {darkorange}{1}{default}." 506 | } 507 | 508 | "Menu_ChangedPlayerModifier" 509 | { 510 | "#format" "{1:.2f}" 511 | "en" "[{olive}TFDB{default}] Changed rocket class player count modifier to {darkorange}{1}{default}." 512 | } 513 | 514 | "Menu_ChangedControlDelay" 515 | { 516 | "#format" "{1:.2f}" 517 | "en" "[{olive}TFDB{default}] Changed rocket class control delay to {darkorange}{1}{default}." 518 | } 519 | 520 | "Menu_ChangedDragTimeMin" 521 | { 522 | "#format" "{1:.2f}" 523 | "en" "[{olive}TFDB{default}] Changed rocket class drag time start to {darkorange}{1}{default}." 524 | } 525 | 526 | "Menu_ChangedDragTimeMax" 527 | { 528 | "#format" "{1:.2f}" 529 | "en" "[{olive}TFDB{default}] Changed rocket class drag time end to {darkorange}{1}{default}." 530 | } 531 | 532 | "Menu_ChangedTargetWeight" 533 | { 534 | "#format" "{1:.2f}" 535 | "en" "[{olive}TFDB{default}] Changed rocket class target weight to {darkorange}{1}{default}." 536 | } 537 | 538 | "Menu_ChangedMaxBounces" 539 | { 540 | "#format" "{1:i}" 541 | "en" "[{olive}TFDB{default}] Changed rocket class maximum bounces to {darkorange}{1}{default}." 542 | } 543 | 544 | "Menu_ChangedBounceScale" 545 | { 546 | "#format" "{1:.2f}" 547 | "en" "[{olive}TFDB{default}] Changed rocket class bounce scale to {darkorange}{1}{default}." 548 | } 549 | 550 | "Menu_ChangedMaxRockets" 551 | { 552 | "#format" "{1:i}" 553 | "en" "[{olive}TFDB{default}] Changed spawners maximum rockets to {darkorange}{1}{default}." 554 | } 555 | 556 | "Menu_ChangedInterval" 557 | { 558 | "#format" "{1:.2f}" 559 | "en" "[{olive}TFDB{default}] Changed spawners rocket spawn interval to {darkorange}{1}{default}." 560 | } 561 | 562 | "Menu_ChangedChancesTable" 563 | { 564 | "#format" "{1:i}" 565 | "en" "[{olive}TFDB{default}] Changed spawners rocket class chances to {darkorange}{1}{default}." 566 | } 567 | 568 | "Dodgeball_BounceVote_Cooldown" 569 | { 570 | "#format" "{1:i}" 571 | "en" "[{olive}TFDB{default}] Voting for bounce toggling is in cooldown for {darkorange}{1}{default} seconds." 572 | } 573 | 574 | "Dodgeball_BounceVote_Failed" 575 | { 576 | "en" "[{olive}TFDB{default}] Bounce toggle vote {red}failed{default}." 577 | } 578 | 579 | "Dodgeball_BounceVote_Enabled" 580 | { 581 | "en" "[{olive}TFDB{default}] No bounce mode is now {community}enabled{default}." 582 | } 583 | 584 | "Dodgeball_BounceVote_Disabled" 585 | { 586 | "en" "[{olive}TFDB{default}] No bounce mode is now {red}disabled{default}." 587 | } 588 | 589 | "Dodgeball_ClassVote_Cooldown" 590 | { 591 | "#format" "{1:i}" 592 | "en" "[{olive}TFDB{default}] Voting for a main rocket class is in cooldown for {darkorange}{1}{default} seconds." 593 | } 594 | 595 | "Dodgeball_ClassVote_Reset" 596 | { 597 | "en" "[{olive}TFDB{default}] The main rocket class has been {red}reset{default}." 598 | } 599 | 600 | "Dodgeball_ClassVote_Changed" 601 | { 602 | "#format" "{1:s}" 603 | "en" "[{olive}TFDB{default}] The main rocket class has been changed to \"{community}{1}{default}\"." 604 | } 605 | 606 | "Dodgeball_CountVote_Cooldown" 607 | { 608 | "#format" "{1:i}" 609 | "en" "[{olive}TFDB{default}] Voting for rockets count is in cooldown for {darkorange}{1}{default} seconds." 610 | } 611 | 612 | "Dodgeball_CountVote_Reset" 613 | { 614 | "en" "[{olive}TFDB{default}] The rockets count has been {red}reset{default}." 615 | } 616 | 617 | "Dodgeball_CountVote_Changed" 618 | { 619 | "#format" "{1:i}" 620 | "en" "[{olive}TFDB{default}] The rockets count has been changed to {community}{1}{default}." 621 | } 622 | } 623 | -------------------------------------------------------------------------------- /Subplugins/Trails/scripting/TF2DodgeballTrails.sp: -------------------------------------------------------------------------------- 1 | #pragma semicolon 1 2 | #pragma newdecls required 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | #define PLUGIN_NAME "[TFDB] Rocket trails" 13 | #define PLUGIN_AUTHOR "x07x08" 14 | #define PLUGIN_DESCRIPTION "Customizable rocket trails" 15 | #define PLUGIN_VERSION "1.0.1" 16 | #define PLUGIN_URL "https://github.com/x07x08/TF2-Dodgeball-Modified" 17 | 18 | enum ParticleAttachmentType 19 | { 20 | PATTACH_ABSORIGIN = 0, // Create at absorigin, but don't follow 21 | PATTACH_ABSORIGIN_FOLLOW, // Create at absorigin, and update to follow the entity 22 | PATTACH_CUSTOMORIGIN, // Create at a custom origin, but don't follow 23 | PATTACH_POINT, // Create on attachment point, but don't follow 24 | PATTACH_POINT_FOLLOW, // Create on attachment point, and update to follow the entity 25 | PATTACH_WORLDORIGIN, // Used for control points that don't attach to an entity 26 | PATTACH_ROOTBONE_FOLLOW // Create at the root bone of the entity, and update to follow 27 | }; 28 | 29 | int g_iRocketClassCount; 30 | 31 | int g_iEmptyModel; 32 | bool g_bClientHideTrails [MAXPLAYERS + 1]; 33 | bool g_bClientHideSprites[MAXPLAYERS + 1]; 34 | bool g_bClientShouldSee [MAXPLAYERS + 1]; 35 | bool g_bLoaded; 36 | 37 | int g_iRocketFakeEntity [MAX_ROCKETS] = {-1, ...}; 38 | int g_iRocketRedCriticalEntity[MAX_ROCKETS] = {-1, ...}; 39 | int g_iRocketBluCriticalEntity[MAX_ROCKETS] = {-1, ...}; 40 | 41 | char g_strRocketClassTrail [MAX_ROCKET_CLASSES][PLATFORM_MAX_PATH]; 42 | char g_strRocketClassSprite [MAX_ROCKET_CLASSES][PLATFORM_MAX_PATH]; 43 | char g_strRocketClassSpriteColor [MAX_ROCKET_CLASSES][16]; 44 | float g_fRocketClassSpriteLifetime [MAX_ROCKET_CLASSES]; 45 | float g_fRocketClassSpriteStartWidth[MAX_ROCKET_CLASSES]; 46 | float g_fRocketClassSpriteEndWidth [MAX_ROCKET_CLASSES]; 47 | float g_fRocketClassTextureRes [MAX_ROCKET_CLASSES]; 48 | TrailFlags g_iRocketClassTrailFlags [MAX_ROCKET_CLASSES]; 49 | 50 | StringMap g_hRocketClassSpriteTrie[MAX_ROCKET_CLASSES]; 51 | 52 | public Plugin myinfo = 53 | { 54 | name = PLUGIN_NAME, 55 | author = PLUGIN_AUTHOR, 56 | description = PLUGIN_DESCRIPTION, 57 | version = PLUGIN_VERSION, 58 | url = PLUGIN_URL 59 | }; 60 | 61 | public void OnPluginStart() 62 | { 63 | LoadTranslations("tfdb.phrases.txt"); 64 | 65 | RegConsoleCmd("sm_rockettrails", CmdHideTrails); 66 | RegConsoleCmd("sm_rocketsprites", CmdHideSprites); 67 | RegConsoleCmd("sm_hidetrails", CmdHideTrails); 68 | RegConsoleCmd("sm_hidesprites", CmdHideSprites); 69 | RegConsoleCmd("sm_toggletrails", CmdHideTrails); 70 | RegConsoleCmd("sm_togglesprites", CmdHideSprites); 71 | 72 | RegConsoleCmd("sm_rocketspritetrails", CmdHideSprites); 73 | 74 | if (!TFDB_IsDodgeballEnabled()) return; 75 | 76 | TFDB_OnRocketsConfigExecuted("general.cfg"); 77 | } 78 | 79 | public APLRes AskPluginLoad2(Handle hMyself, bool bLate, char[] strError, int iErrMax) 80 | { 81 | CreateNative("TFDB_GetRocketFakeEntity", Native_GetRocketFakeEntity); 82 | CreateNative("TFDB_SetRocketFakeEntity", Native_SetRocketFakeEntity); 83 | 84 | CreateNative("TFDB_GetRocketClassTrail", Native_GetRocketClassTrail); 85 | CreateNative("TFDB_SetRocketClassTrail", Native_SetRocketClassTrail); 86 | 87 | CreateNative("TFDB_GetRocketClassSprite", Native_GetRocketClassSprite); 88 | CreateNative("TFDB_SetRocketClassSprite", Native_SetRocketClassSprite); 89 | 90 | CreateNative("TFDB_GetRocketClassSpriteColor", Native_GetRocketClassSpriteColor); 91 | CreateNative("TFDB_SetRocketClassSpriteColor", Native_SetRocketClassSpriteColor); 92 | 93 | CreateNative("TFDB_GetRocketClassSpriteLifetime", Native_GetRocketClassSpriteLifetime); 94 | CreateNative("TFDB_SetRocketClassSpriteLifetime", Native_SetRocketClassSpriteLifetime); 95 | 96 | CreateNative("TFDB_GetRocketClassSpriteStartWidth", Native_GetRocketClassSpriteStartWidth); 97 | CreateNative("TFDB_SetRocketClassSpriteStartWidth", Native_SetRocketClassSpriteStartWidth); 98 | 99 | CreateNative("TFDB_GetRocketClassSpriteEndWidth", Native_GetRocketClassSpriteEndWidth); 100 | CreateNative("TFDB_SetRocketClassSpriteEndWidth", Native_SetRocketClassSpriteEndWidth); 101 | 102 | CreateNative("TFDB_GetRocketClassTextureRes", Native_GetRocketClassTextureRes); 103 | CreateNative("TFDB_SetRocketClassTextureRes", Native_SetRocketClassTextureRes); 104 | 105 | CreateNative("TFDB_GetRocketClassTrailFlags", Native_GetRocketClassTrailFlags); 106 | CreateNative("TFDB_SetRocketClassTrailFlags", Native_SetRocketClassTrailFlags); 107 | 108 | RegPluginLibrary("tfdbtrails"); 109 | 110 | return APLRes_Success; 111 | } 112 | 113 | public void TFDB_OnRocketsConfigExecuted(const char[] strConfigFile) 114 | { 115 | if (!g_bLoaded) 116 | { 117 | HookEvent("object_deflected", OnObjectDeflected); 118 | HookEvent("player_team", OnPlayerTeam); 119 | 120 | g_bLoaded = true; 121 | } 122 | 123 | if (strcmp(strConfigFile, "general.cfg") == 0) 124 | { 125 | for (int iIndex = 0; iIndex < g_iRocketClassCount; iIndex++) 126 | { 127 | delete g_hRocketClassSpriteTrie[iIndex]; 128 | } 129 | 130 | g_iRocketClassCount = 0; 131 | 132 | ParseConfigurations(strConfigFile); 133 | } 134 | 135 | g_iEmptyModel = GetPrecachedModel(EMPTY_MODEL); 136 | 137 | GetPrecachedParticle(ROCKET_TRAIL_FIRE); 138 | 139 | for (int iIndex = 0; iIndex < g_iRocketClassCount; iIndex++) 140 | { 141 | TrailFlags iFlags = g_iRocketClassTrailFlags[iIndex]; 142 | 143 | if (TestFlags(iFlags, TrailFlag_CustomTrail)) GetPrecachedParticle(g_strRocketClassTrail[iIndex]); 144 | if (TestFlags(iFlags, TrailFlag_CustomSprite)) GetPrecachedGeneric(g_strRocketClassSprite[iIndex]); 145 | } 146 | } 147 | 148 | public void OnMapEnd() 149 | { 150 | if (!g_bLoaded) return; 151 | 152 | UnhookEvent("object_deflected", OnObjectDeflected); 153 | UnhookEvent("player_team", OnPlayerTeam); 154 | 155 | for (int iIndex = 0; iIndex < g_iRocketClassCount; iIndex++) 156 | { 157 | delete g_hRocketClassSpriteTrie[iIndex]; 158 | } 159 | 160 | g_iRocketClassCount = 0; 161 | 162 | g_bLoaded = false; 163 | } 164 | 165 | public void OnClientDisconnect(int iClient) 166 | { 167 | g_bClientHideTrails [iClient] = false; 168 | g_bClientHideSprites[iClient] = false; 169 | g_bClientShouldSee [iClient] = false; 170 | } 171 | 172 | public void OnObjectDeflected(Event hEvent, char[] strEventName, bool bDontBroadcast) 173 | { 174 | int iEntity = hEvent.GetInt("object_entindex"); 175 | int iIndex = TFDB_FindRocketByEntity(iEntity); 176 | 177 | if (iIndex == -1) return; 178 | 179 | int iClass = TFDB_GetRocketClass(iIndex); 180 | 181 | if (!(g_iRocketClassTrailFlags[iClass] & TrailFlag_ReplaceParticles)) return; 182 | 183 | bool bCritical = !!GetEntProp(iEntity, Prop_Send, "m_bCritical"); 184 | int iTeam = GetEntProp(iEntity, Prop_Send, "m_iTeamNum", 1); 185 | 186 | if (bCritical) 187 | { 188 | int iRedCriticalEntity = EntRefToEntIndex(g_iRocketRedCriticalEntity[iIndex]); 189 | int iBluCriticalEntity = EntRefToEntIndex(g_iRocketBluCriticalEntity[iIndex]); 190 | 191 | if (iRedCriticalEntity != -1 && iBluCriticalEntity != -1) 192 | { 193 | if (iTeam == view_as(TFTeam_Red)) 194 | { 195 | AcceptEntityInput(iBluCriticalEntity, "Stop"); 196 | AcceptEntityInput(iRedCriticalEntity, "Start"); 197 | } 198 | else if (iTeam == view_as(TFTeam_Blue)) 199 | { 200 | AcceptEntityInput(iBluCriticalEntity, "Start"); 201 | AcceptEntityInput(iRedCriticalEntity, "Stop"); 202 | } 203 | } 204 | } 205 | 206 | int iOtherEntity = EntRefToEntIndex(g_iRocketFakeEntity[iIndex]); 207 | 208 | if (iOtherEntity == -1) return; 209 | 210 | UpdateRocketSkin(iOtherEntity, iTeam, TestFlags(TFDB_GetRocketFlags(iIndex), RocketFlag_IsNeutral)); 211 | } 212 | 213 | public void OnPlayerTeam(Event hEvent, char[] strEventName, bool bDontBroadcast) 214 | { 215 | int iClient = GetClientOfUserId(hEvent.GetInt("userid")); 216 | int iOtherEntity = -1; 217 | int iAttachPoint; 218 | float fPosition[3]; 219 | ParticleAttachmentType iAttachType; 220 | 221 | if (hEvent.GetInt("oldteam") == 0 && !g_bClientShouldSee[iClient]) 222 | { 223 | for (int iRocket = 0; iRocket < MAX_ROCKETS; iRocket++) 224 | { 225 | if (!(TFDB_IsValidRocket(iRocket) && 226 | (g_iRocketClassTrailFlags[TFDB_GetRocketClass(iRocket)] & TrailFlag_ReplaceParticles))) continue; 227 | 228 | iOtherEntity = EntRefToEntIndex(g_iRocketFakeEntity[iRocket]); 229 | 230 | if (iOtherEntity == -1) continue; 231 | 232 | GetEntPropVector(iOtherEntity, Prop_Send, "m_vecOrigin", fPosition); 233 | 234 | iAttachType = PATTACH_POINT_FOLLOW; 235 | iAttachPoint = 1; 236 | 237 | if ((TFDB_GetRocketFlags(iRocket) & RocketFlag_CustomModel) && 238 | ((iAttachPoint = LookupEntityAttachment(iOtherEntity, "trail")) == 0)) 239 | { 240 | iAttachPoint = -1; 241 | iAttachType = PATTACH_ABSORIGIN_FOLLOW; 242 | } 243 | 244 | CreateTempParticle(ROCKET_TRAIL_FIRE, fPosition, _, _, iOtherEntity, iAttachType, iAttachPoint); 245 | TE_SendToClient(iClient); 246 | } 247 | 248 | g_bClientShouldSee[iClient] = true; 249 | } 250 | } 251 | 252 | public void TFDB_OnRocketCreated(int iIndex, int iEntity) 253 | { 254 | int iClass = TFDB_GetRocketClass(iIndex); 255 | int iTeam = GetAnalogueTeam(GetClientTeam(EntRefToEntIndex(TFDB_GetRocketTarget(iIndex)))); 256 | TrailFlags iFlags = g_iRocketClassTrailFlags[iClass]; 257 | 258 | float fPosition[3], fAngles[3], fDirection[3]; 259 | GetEntPropVector(iEntity, Prop_Send, "m_vecOrigin", fPosition); 260 | GetEntPropVector(iEntity, Prop_Send, "m_angRotation", fAngles); 261 | GetAngleVectors(fAngles, fDirection, NULL_VECTOR, NULL_VECTOR); 262 | 263 | if (TestFlags(iFlags, TrailFlag_RemoveParticles)) 264 | { 265 | int iOtherEntity = CreateEntityByName("prop_dynamic"); 266 | 267 | if (iOtherEntity != -1) 268 | { 269 | SetEntProp(iEntity, Prop_Send, "m_nModelIndexOverrides", g_iEmptyModel); 270 | 271 | SetEntityModel(iOtherEntity, ROCKET_MODEL); 272 | SetEntProp(iOtherEntity, Prop_Send, "m_CollisionGroup", 0); // COLLISION_GROUP_NONE 273 | SetEntProp(iOtherEntity, Prop_Send, "m_usSolidFlags", 0x0004); // FSOLID_NOT_SOLID 274 | SetEntProp(iOtherEntity, Prop_Send, "m_nSolidType", 0); // SOLID_NONE 275 | TeleportEntity(iOtherEntity, fPosition, fAngles, view_as({0.0, 0.0, 0.0})); 276 | g_iRocketFakeEntity[iIndex] = EntIndexToEntRef(iOtherEntity); 277 | DispatchSpawn(iOtherEntity); 278 | 279 | SetVariantString("!activator"); 280 | AcceptEntityInput(iOtherEntity, "SetParent", iEntity, iOtherEntity); 281 | 282 | if (TestFlags(iFlags, TrailFlag_ReplaceParticles)) 283 | { 284 | // If the rocket gets instantly destroyed, the temp ent still gets sent. Why? 285 | CreateTempParticle(ROCKET_TRAIL_FIRE, fPosition, _, _, iOtherEntity, PATTACH_POINT_FOLLOW, 1); 286 | TE_SendToAll(); 287 | 288 | bool bCritical = !!GetEntProp(iEntity, Prop_Send, "m_bCritical"); 289 | 290 | if (bCritical) 291 | { 292 | int iRedCriticalEntity = CreateEntityByName("info_particle_system"); 293 | int iBluCriticalEntity = CreateEntityByName("info_particle_system"); 294 | 295 | if ((iRedCriticalEntity != -1) && (iBluCriticalEntity != -1)) 296 | { 297 | TeleportEntity(iRedCriticalEntity, fPosition, fAngles, view_as({0.0, 0.0, 0.0})); 298 | TeleportEntity(iBluCriticalEntity, fPosition, fAngles, view_as({0.0, 0.0, 0.0})); 299 | 300 | DispatchKeyValue(iRedCriticalEntity, "effect_name", ROCKET_CRIT_RED); 301 | DispatchKeyValue(iBluCriticalEntity, "effect_name", ROCKET_CRIT_BLU); 302 | 303 | g_iRocketRedCriticalEntity[iIndex] = EntIndexToEntRef(iRedCriticalEntity); 304 | g_iRocketBluCriticalEntity[iIndex] = EntIndexToEntRef(iBluCriticalEntity); 305 | 306 | DispatchSpawn(iRedCriticalEntity); 307 | DispatchSpawn(iBluCriticalEntity); 308 | 309 | ActivateEntity(iRedCriticalEntity); 310 | ActivateEntity(iBluCriticalEntity); 311 | 312 | SetVariantString("!activator"); 313 | AcceptEntityInput(iRedCriticalEntity, "SetParent", iOtherEntity, iRedCriticalEntity); 314 | 315 | SetVariantString("!activator"); 316 | AcceptEntityInput(iBluCriticalEntity, "SetParent", iOtherEntity, iBluCriticalEntity); 317 | 318 | SetVariantString("trail"); 319 | AcceptEntityInput(iRedCriticalEntity, "SetParentAttachment", iOtherEntity, iRedCriticalEntity); 320 | 321 | SetVariantString("trail"); 322 | AcceptEntityInput(iBluCriticalEntity, "SetParentAttachment", iOtherEntity, iBluCriticalEntity); 323 | 324 | if (iTeam == view_as(TFTeam_Red)) 325 | { 326 | AcceptEntityInput(iRedCriticalEntity, "Start"); 327 | } 328 | else if (iTeam == view_as(TFTeam_Blue)) 329 | { 330 | AcceptEntityInput(iBluCriticalEntity, "Start"); 331 | } 332 | } 333 | } 334 | } 335 | } 336 | } 337 | 338 | if (TestFlags(iFlags, TrailFlag_CustomTrail)) 339 | { 340 | int iTrailEntity = CreateEntityByName("info_particle_system"); 341 | 342 | if (iTrailEntity != -1) 343 | { 344 | TeleportEntity(iTrailEntity, fPosition, fAngles, view_as({0.0, 0.0, 0.0})); 345 | DispatchKeyValue(iTrailEntity, "effect_name", g_strRocketClassTrail[iClass]); 346 | DispatchSpawn(iTrailEntity); 347 | ActivateEntity(iTrailEntity); 348 | 349 | if (TestFlags(iFlags, TrailFlag_RemoveParticles)) 350 | { 351 | int iOtherEntity = EntRefToEntIndex(g_iRocketFakeEntity[iIndex]); 352 | 353 | if (iOtherEntity != -1) 354 | { 355 | SetVariantString("!activator"); 356 | AcceptEntityInput(iTrailEntity, "SetParent", iOtherEntity, iTrailEntity); 357 | 358 | SetVariantString("trail"); 359 | AcceptEntityInput(iTrailEntity, "SetParentAttachment", iOtherEntity, iTrailEntity); 360 | 361 | AcceptEntityInput(iTrailEntity, "Start"); 362 | } 363 | } 364 | else 365 | { 366 | SetVariantString("!activator"); 367 | AcceptEntityInput(iTrailEntity, "SetParent", iEntity, iTrailEntity); 368 | 369 | SetVariantString("trail"); 370 | AcceptEntityInput(iTrailEntity, "SetParentAttachment", iEntity, iTrailEntity); 371 | 372 | AcceptEntityInput(iTrailEntity, "Start"); 373 | } 374 | 375 | // This allows SetTransmit to work on info_particle_system 376 | SetEdictFlags(iTrailEntity, (GetEdictFlags(iTrailEntity) & ~FL_EDICT_ALWAYS)); 377 | SDKHook(iTrailEntity, SDKHook_SetTransmit, TrailSetTransmit); 378 | } 379 | } 380 | 381 | if (TestFlags(iFlags, TrailFlag_CustomSprite)) 382 | { 383 | int iSpriteEntity = CreateEntityByName("env_spritetrail"); 384 | 385 | if (iSpriteEntity != -1) 386 | { 387 | TeleportEntity(iSpriteEntity, fPosition, fAngles, view_as({0.0, 0.0, 0.0})); 388 | 389 | DispatchKeyValue(iSpriteEntity, "spritename", g_strRocketClassSprite[iClass]); 390 | DispatchKeyValueFloat(iSpriteEntity, "lifetime", g_fRocketClassSpriteLifetime[iClass] != 0 ? g_fRocketClassSpriteLifetime[iClass] : 1.0); 391 | DispatchKeyValueFloat(iSpriteEntity, "endwidth", g_fRocketClassSpriteEndWidth[iClass] != 0 ? g_fRocketClassSpriteEndWidth[iClass] : 15.0); 392 | DispatchKeyValueFloat(iSpriteEntity, "startwidth", g_fRocketClassSpriteStartWidth[iClass] != 0 ? g_fRocketClassSpriteStartWidth[iClass] : 6.0); 393 | DispatchKeyValue(iSpriteEntity, "rendercolor", strlen(g_strRocketClassSpriteColor[iClass]) != 0 ? g_strRocketClassSpriteColor[iClass] : "255 255 255"); 394 | DispatchKeyValue(iSpriteEntity, "renderamt", "255"); 395 | DispatchKeyValue(iSpriteEntity, "rendermode", "3"); 396 | SetEntPropFloat(iSpriteEntity, Prop_Send, "m_flTextureRes", g_fRocketClassTextureRes[iClass]); 397 | 398 | if (g_hRocketClassSpriteTrie[iClass] != null) 399 | { 400 | StringMapSnapshot hSpriteEntitySnap = g_hRocketClassSpriteTrie[iClass].Snapshot(); 401 | 402 | int iSnapSize = hSpriteEntitySnap.Length; 403 | char strKey[256]; 404 | char strValue[256]; 405 | 406 | for (int iEntry = 0; iEntry < iSnapSize; iEntry++) 407 | { 408 | hSpriteEntitySnap.GetKey(iEntry, strKey, sizeof(strKey)); 409 | g_hRocketClassSpriteTrie[iClass].GetString(strKey, strValue, sizeof(strValue)); 410 | DispatchKeyValue(iSpriteEntity, strKey, strValue); 411 | } 412 | 413 | delete hSpriteEntitySnap; 414 | } 415 | 416 | if (TestFlags(iFlags, TrailFlag_RemoveParticles)) 417 | { 418 | int iOtherEntity = EntRefToEntIndex(g_iRocketFakeEntity[iIndex]); 419 | 420 | if (iOtherEntity != -1) 421 | { 422 | SetVariantString("!activator"); 423 | AcceptEntityInput(iSpriteEntity, "SetParent", iOtherEntity, iSpriteEntity); 424 | 425 | SetVariantString("trail"); 426 | AcceptEntityInput(iSpriteEntity, "SetParentAttachment", iOtherEntity, iSpriteEntity); 427 | } 428 | } 429 | else 430 | { 431 | SetVariantString("!activator"); 432 | AcceptEntityInput(iSpriteEntity, "SetParent", iEntity, iSpriteEntity); 433 | 434 | SetVariantString("trail"); 435 | AcceptEntityInput(iSpriteEntity, "SetParentAttachment", iEntity, iSpriteEntity); 436 | } 437 | 438 | DispatchSpawn(iSpriteEntity); 439 | SDKHook(iSpriteEntity, SDKHook_SetTransmit, SpriteSetTransmit); 440 | } 441 | } 442 | 443 | RocketFlags iRocketFlags = TFDB_GetRocketFlags(iIndex); 444 | 445 | if (TestFlags(iFlags, TrailFlag_RemoveParticles) && TestFlags(iRocketFlags, RocketFlag_CustomModel)) 446 | { 447 | char strCustomModel[PLATFORM_MAX_PATH]; TFDB_GetRocketClassModel(iClass, strCustomModel, sizeof(strCustomModel)); 448 | int iOtherEntity = EntRefToEntIndex(g_iRocketFakeEntity[iIndex]); 449 | 450 | SetEntityModel(iOtherEntity, strCustomModel); 451 | UpdateRocketSkin(iOtherEntity, iTeam, TestFlags(iRocketFlags, RocketFlag_IsNeutral)); 452 | } 453 | } 454 | 455 | public Action TrailSetTransmit(int iEntity, int iClient) 456 | { 457 | if (GetEdictFlags(iEntity) & FL_EDICT_ALWAYS) 458 | { 459 | // Stops the game from setting back the flag 460 | SetEdictFlags(iEntity, (GetEdictFlags(iEntity) ^ FL_EDICT_ALWAYS)); 461 | } 462 | 463 | return g_bClientHideTrails[iClient] ? Plugin_Handled : Plugin_Continue; 464 | } 465 | 466 | public Action SpriteSetTransmit(int iEntity, int iClient) 467 | { 468 | return g_bClientHideSprites[iClient] ? Plugin_Handled : Plugin_Continue; 469 | } 470 | 471 | public Action CmdHideTrails(int iClient, int iArgs) 472 | { 473 | if (iClient == 0) 474 | { 475 | ReplyToCommand(iClient, "Command is in-game only."); 476 | 477 | return Plugin_Handled; 478 | } 479 | 480 | if (!TFDB_IsDodgeballEnabled()) 481 | { 482 | CReplyToCommand(iClient, "%t", "Command_Disabled"); 483 | 484 | return Plugin_Handled; 485 | } 486 | 487 | if (iArgs) 488 | { 489 | CReplyToCommand(iClient, "%t", "Command_DBHideParticles_Usage"); 490 | 491 | return Plugin_Handled; 492 | } 493 | 494 | g_bClientHideTrails[iClient] = !g_bClientHideTrails[iClient]; 495 | 496 | CPrintToChat(iClient, "%t", g_bClientHideTrails[iClient] ? "Command_DBHideParticles_Hidden" : "Command_DBHideParticles_Visible"); 497 | 498 | return Plugin_Handled; 499 | } 500 | 501 | public Action CmdHideSprites(int iClient, int iArgs) 502 | { 503 | if (iClient == 0) 504 | { 505 | ReplyToCommand(iClient, "Command is in-game only."); 506 | 507 | return Plugin_Handled; 508 | } 509 | 510 | if (!TFDB_IsDodgeballEnabled()) 511 | { 512 | CReplyToCommand(iClient, "%t", "Command_Disabled"); 513 | 514 | return Plugin_Handled; 515 | } 516 | 517 | if (iArgs) 518 | { 519 | CReplyToCommand(iClient, "%t", "Command_DBHideSprites_Usage"); 520 | 521 | return Plugin_Handled; 522 | } 523 | 524 | g_bClientHideSprites[iClient] = !g_bClientHideSprites[iClient]; 525 | 526 | CPrintToChat(iClient, "%t", g_bClientHideSprites[iClient] ? "Command_DBHideSprites_Hidden" : "Command_DBHideSprites_Visible"); 527 | 528 | return Plugin_Handled; 529 | } 530 | 531 | void ParseConfigurations(const char[] strConfigFile) 532 | { 533 | char strPath[PLATFORM_MAX_PATH]; 534 | char strFileName[PLATFORM_MAX_PATH]; 535 | FormatEx(strFileName, sizeof(strFileName), "configs/dodgeball/%s", strConfigFile); 536 | BuildPath(Path_SM, strPath, sizeof(strPath), strFileName); 537 | 538 | if (!FileExists(strPath, true)) return; 539 | 540 | KeyValues kvConfig = new KeyValues("TF2_Dodgeball"); 541 | 542 | if (kvConfig.ImportFromFile(strPath) == false) SetFailState("Error while parsing the configuration file."); 543 | 544 | kvConfig.GotoFirstSubKey(); 545 | 546 | do 547 | { 548 | char strSection[64]; kvConfig.GetSectionName(strSection, sizeof(strSection)); 549 | 550 | if (StrEqual(strSection, "classes")) ParseClasses(kvConfig); 551 | } 552 | while (kvConfig.GotoNextKey()); 553 | 554 | delete kvConfig; 555 | } 556 | 557 | void ParseClasses(KeyValues kvConfig) 558 | { 559 | kvConfig.GotoFirstSubKey(); 560 | do 561 | { 562 | int iIndex = g_iRocketClassCount; 563 | TrailFlags iFlags; 564 | 565 | kvConfig.GetString("trail particle", g_strRocketClassTrail[iIndex], sizeof(g_strRocketClassTrail[])); 566 | 567 | if (g_strRocketClassTrail[iIndex][0]) iFlags |= TrailFlag_CustomTrail; 568 | 569 | kvConfig.GetString("trail sprite", g_strRocketClassSprite[iIndex], sizeof(g_strRocketClassSprite[])); 570 | 571 | if (g_strRocketClassSprite[iIndex][0]) 572 | { 573 | iFlags |= TrailFlag_CustomSprite; 574 | 575 | kvConfig.GetString("custom color", g_strRocketClassSpriteColor[iIndex], sizeof(g_strRocketClassSpriteColor[])); 576 | 577 | g_fRocketClassSpriteLifetime[iIndex] = kvConfig.GetFloat("sprite lifetime"); 578 | g_fRocketClassSpriteStartWidth[iIndex] = kvConfig.GetFloat("sprite start width"); 579 | g_fRocketClassSpriteEndWidth[iIndex] = kvConfig.GetFloat("sprite end width"); 580 | g_fRocketClassTextureRes[iIndex] = kvConfig.GetFloat("texture resolution", 0.05); 581 | 582 | if (kvConfig.JumpToKey("entity keyvalues")) 583 | { 584 | g_hRocketClassSpriteTrie[iIndex] = ParseSpriteEntity(kvConfig); 585 | 586 | kvConfig.GoBack(); 587 | } 588 | } 589 | 590 | if (kvConfig.GetNum("remove particles", 0)) 591 | { 592 | iFlags |= TrailFlag_RemoveParticles; 593 | 594 | if (kvConfig.GetNum("replace particles", 0)) iFlags |= TrailFlag_ReplaceParticles; 595 | } 596 | 597 | g_iRocketClassTrailFlags[iIndex] = iFlags; 598 | g_iRocketClassCount++; 599 | } 600 | while (kvConfig.GotoNextKey()); 601 | 602 | kvConfig.GoBack(); 603 | } 604 | 605 | StringMap ParseSpriteEntity(KeyValues kvConfig) 606 | { 607 | char strBuffer[256], strValue[256]; 608 | StringMap hBufferMap = new StringMap(); 609 | 610 | kvConfig.GotoFirstSubKey(false); 611 | do 612 | { 613 | kvConfig.GetSectionName(strBuffer, sizeof(strBuffer)); 614 | kvConfig.GetString(NULL_STRING, strValue, sizeof(strValue)); 615 | 616 | hBufferMap.SetString(strBuffer, strValue); 617 | } 618 | while (kvConfig.GotoNextKey(false)); 619 | 620 | kvConfig.GoBack(); 621 | 622 | return hBufferMap; 623 | } 624 | 625 | void UpdateRocketSkin(int iEntity, int iTeam, bool bNeutral) 626 | { 627 | if (bNeutral) SetEntProp(iEntity, Prop_Send, "m_nSkin", 2); 628 | else SetEntProp(iEntity, Prop_Send, "m_nSkin", (iTeam == view_as(TFTeam_Blue)) ? 0 : 1); 629 | } 630 | 631 | stock int GetAnalogueTeam(int iTeam) 632 | { 633 | if (iTeam == view_as(TFTeam_Red)) return view_as(TFTeam_Blue); 634 | 635 | return view_as(TFTeam_Red); 636 | } 637 | 638 | stock int GetPrecachedModel(const char[] strModel) 639 | { 640 | static int iModelPrecache = INVALID_STRING_TABLE; 641 | 642 | if ((iModelPrecache == INVALID_STRING_TABLE) && 643 | ((iModelPrecache = FindStringTable("modelprecache")) == INVALID_STRING_TABLE)) 644 | { 645 | return INVALID_STRING_INDEX; 646 | } 647 | 648 | int iModelIndex = FindStringIndex(iModelPrecache, strModel); 649 | 650 | if (iModelIndex == INVALID_STRING_INDEX) 651 | { 652 | iModelIndex = PrecacheModel(strModel, true); 653 | } 654 | 655 | return iModelIndex; 656 | } 657 | 658 | stock int GetPrecachedParticle(const char[] strParticleSystem) 659 | { 660 | static int iParticleEffectNames = INVALID_STRING_TABLE; 661 | 662 | if ((iParticleEffectNames == INVALID_STRING_TABLE) && 663 | ((iParticleEffectNames = FindStringTable("ParticleEffectNames")) == INVALID_STRING_TABLE)) 664 | { 665 | return INVALID_STRING_INDEX; 666 | } 667 | 668 | int iParticleIndex = FindStringIndex(iParticleEffectNames, strParticleSystem); 669 | 670 | if (iParticleIndex == INVALID_STRING_INDEX) 671 | { 672 | int iNumStrings = GetStringTableNumStrings(iParticleEffectNames); 673 | 674 | if (iNumStrings >= GetStringTableMaxStrings(iParticleEffectNames)) 675 | { 676 | return INVALID_STRING_INDEX; 677 | } 678 | 679 | AddToStringTable(iParticleEffectNames, strParticleSystem); 680 | iParticleIndex = iNumStrings; 681 | } 682 | 683 | return iParticleIndex; 684 | } 685 | 686 | stock int GetPrecachedGeneric(const char[] strGeneric) 687 | { 688 | static int iGenericPrecache = INVALID_STRING_TABLE; 689 | 690 | if ((iGenericPrecache == INVALID_STRING_TABLE) && 691 | ((iGenericPrecache = FindStringTable("genericprecache")) == INVALID_STRING_TABLE)) 692 | { 693 | return INVALID_STRING_INDEX; 694 | } 695 | 696 | int iGenericIndex = FindStringIndex(iGenericPrecache, strGeneric); 697 | 698 | if (iGenericIndex == INVALID_STRING_INDEX) 699 | { 700 | iGenericIndex = PrecacheGeneric(strGeneric, true); 701 | } 702 | 703 | return iGenericIndex; 704 | } 705 | 706 | // https://forums.alliedmods.net/showthread.php?t=75102 707 | 708 | stock void CreateTempParticle(const char[] strParticle, 709 | const float vecOrigin[3] = NULL_VECTOR, 710 | const float vecStart[3] = NULL_VECTOR, 711 | const float vecAngles[3] = NULL_VECTOR, 712 | int iEntity = -1, 713 | ParticleAttachmentType AttachmentType = PATTACH_ABSORIGIN, 714 | int iAttachmentPoint = -1, 715 | bool bResetParticles = false) 716 | { 717 | int iParticleIndex = GetPrecachedParticle(strParticle); 718 | if (iParticleIndex == INVALID_STRING_INDEX) 719 | { 720 | ThrowError("Could not find particle index: %s", strParticle); 721 | } 722 | 723 | TE_Start("TFParticleEffect"); 724 | TE_WriteFloat("m_vecOrigin[0]", vecOrigin[0]); 725 | TE_WriteFloat("m_vecOrigin[1]", vecOrigin[1]); 726 | TE_WriteFloat("m_vecOrigin[2]", vecOrigin[2]); 727 | TE_WriteFloat("m_vecStart[0]", vecStart[0]); 728 | TE_WriteFloat("m_vecStart[1]", vecStart[1]); 729 | TE_WriteFloat("m_vecStart[2]", vecStart[2]); 730 | TE_WriteVector("m_vecAngles", vecAngles); 731 | TE_WriteNum("m_iParticleSystemIndex", iParticleIndex); 732 | 733 | if (iEntity != -1) 734 | { 735 | TE_WriteNum("entindex", iEntity); 736 | } 737 | 738 | if (AttachmentType != PATTACH_ABSORIGIN) 739 | { 740 | TE_WriteNum("m_iAttachType", view_as(AttachmentType)); 741 | } 742 | 743 | if (iAttachmentPoint != -1) 744 | { 745 | TE_WriteNum("m_iAttachmentPointIndex", iAttachmentPoint); 746 | } 747 | 748 | TE_WriteNum("m_bResetParticles", bResetParticles ? 1 : 0); 749 | } 750 | 751 | public any Native_GetRocketFakeEntity(Handle hPlugin, int iNumParams) 752 | { 753 | int iIndex = GetNativeCell(1); 754 | 755 | return g_iRocketFakeEntity[iIndex]; 756 | } 757 | 758 | public any Native_SetRocketFakeEntity(Handle hPlugin, int iNumParams) 759 | { 760 | int iIndex = GetNativeCell(1); 761 | 762 | int iFakeEntity = GetNativeCell(2); 763 | 764 | g_iRocketFakeEntity[iIndex] = iFakeEntity; 765 | 766 | return 0; 767 | } 768 | 769 | public any Native_GetRocketClassTrail(Handle hPlugin, int iNumParams) 770 | { 771 | int iClass = GetNativeCell(1); 772 | 773 | int iMaxLen = GetNativeCell(3); 774 | 775 | SetNativeString(2, g_strRocketClassTrail[iClass], iMaxLen); 776 | 777 | return 0; 778 | } 779 | 780 | public any Native_SetRocketClassTrail(Handle hPlugin, int iNumParams) 781 | { 782 | int iClass = GetNativeCell(1); 783 | 784 | int iMaxLen; GetNativeStringLength(2, iMaxLen); 785 | 786 | char[] strBuffer = new char[iMaxLen + 1]; GetNativeString(2, strBuffer, iMaxLen + 1); 787 | 788 | strcopy(g_strRocketClassTrail[iClass], sizeof(g_strRocketClassTrail[]), strBuffer); 789 | 790 | return 0; 791 | } 792 | 793 | public any Native_GetRocketClassSprite(Handle hPlugin, int iNumParams) 794 | { 795 | int iClass = GetNativeCell(1); 796 | 797 | int iMaxLen = GetNativeCell(3); 798 | 799 | SetNativeString(2, g_strRocketClassSprite[iClass], iMaxLen); 800 | 801 | return 0; 802 | } 803 | 804 | public any Native_SetRocketClassSprite(Handle hPlugin, int iNumParams) 805 | { 806 | int iClass = GetNativeCell(1); 807 | 808 | int iMaxLen; GetNativeStringLength(2, iMaxLen); 809 | 810 | char[] strBuffer = new char[iMaxLen + 1]; GetNativeString(2, strBuffer, iMaxLen + 1); 811 | 812 | strcopy(g_strRocketClassSprite[iClass], sizeof(g_strRocketClassSprite[]), strBuffer); 813 | 814 | return 0; 815 | } 816 | 817 | public any Native_GetRocketClassSpriteColor(Handle hPlugin, int iNumParams) 818 | { 819 | int iClass = GetNativeCell(1); 820 | 821 | int iMaxLen = GetNativeCell(3); 822 | 823 | SetNativeString(2, g_strRocketClassSpriteColor[iClass], iMaxLen); 824 | 825 | return 0; 826 | } 827 | 828 | public any Native_SetRocketClassSpriteColor(Handle hPlugin, int iNumParams) 829 | { 830 | int iClass = GetNativeCell(1); 831 | 832 | int iMaxLen; GetNativeStringLength(2, iMaxLen); 833 | 834 | char[] strBuffer = new char[iMaxLen + 1]; GetNativeString(2, strBuffer, iMaxLen + 1); 835 | 836 | strcopy(g_strRocketClassSpriteColor[iClass], sizeof(g_strRocketClassSpriteColor[]), strBuffer); 837 | 838 | return 0; 839 | } 840 | 841 | public any Native_GetRocketClassSpriteLifetime(Handle hPlugin, int iNumParams) 842 | { 843 | int iClass = GetNativeCell(1); 844 | 845 | return g_fRocketClassSpriteLifetime[iClass]; 846 | } 847 | 848 | public any Native_SetRocketClassSpriteLifetime(Handle hPlugin, int iNumParams) 849 | { 850 | int iClass = GetNativeCell(1); 851 | 852 | float fLifetime = GetNativeCell(2); 853 | 854 | g_fRocketClassSpriteLifetime[iClass] = fLifetime; 855 | 856 | return 0; 857 | } 858 | 859 | public any Native_GetRocketClassSpriteStartWidth(Handle hPlugin, int iNumParams) 860 | { 861 | int iClass = GetNativeCell(1); 862 | 863 | return g_fRocketClassSpriteStartWidth[iClass]; 864 | } 865 | 866 | public any Native_SetRocketClassSpriteStartWidth(Handle hPlugin, int iNumParams) 867 | { 868 | int iClass = GetNativeCell(1); 869 | 870 | float fWidth = GetNativeCell(2); 871 | 872 | g_fRocketClassSpriteStartWidth[iClass] = fWidth; 873 | 874 | return 0; 875 | } 876 | 877 | public any Native_GetRocketClassSpriteEndWidth(Handle hPlugin, int iNumParams) 878 | { 879 | int iClass = GetNativeCell(1); 880 | 881 | return g_fRocketClassSpriteEndWidth[iClass]; 882 | } 883 | 884 | public any Native_SetRocketClassSpriteEndWidth(Handle hPlugin, int iNumParams) 885 | { 886 | int iClass = GetNativeCell(1); 887 | 888 | float fWidth = GetNativeCell(2); 889 | 890 | g_fRocketClassSpriteEndWidth[iClass] = fWidth; 891 | 892 | return 0; 893 | } 894 | 895 | public any Native_GetRocketClassTextureRes(Handle hPlugin, int iNumParams) 896 | { 897 | int iClass = GetNativeCell(1); 898 | 899 | return g_fRocketClassTextureRes[iClass]; 900 | } 901 | 902 | public any Native_SetRocketClassTextureRes(Handle hPlugin, int iNumParams) 903 | { 904 | int iClass = GetNativeCell(1); 905 | 906 | float fResolution = GetNativeCell(2); 907 | 908 | g_fRocketClassTextureRes[iClass] = fResolution; 909 | 910 | return 0; 911 | } 912 | 913 | public any Native_GetRocketClassTrailFlags(Handle hPlugin, int iNumParams) 914 | { 915 | int iClass = GetNativeCell(1); 916 | 917 | return g_iRocketClassTrailFlags[iClass]; 918 | } 919 | 920 | public any Native_SetRocketClassTrailFlags(Handle hPlugin, int iNumParams) 921 | { 922 | int iClass = GetNativeCell(1); 923 | 924 | TrailFlags iFlags = GetNativeCell(2); 925 | 926 | g_iRocketClassTrailFlags[iClass] = iFlags; 927 | 928 | return 0; 929 | } 930 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------