Halftime teamswitch (1.0.11)
5 Attachment(s)
Description:
Simple plugin the switch all players to the opposite team when half of the map time has passed and the round ended. Background: Some maps people find to be unbalanced. This plugin tries to make it equal for everyone. All get to play both sides of the map. Change log: 1.0 - First Version 1.0.1 - Using bool values (Thanks pRED) 1.0.2 - Added reset of halftime flag to false in OnMapStart just for safety 1.0.3 - Cleaned up code. Added logging to logfile due to some reported problems. Works fine in the last tests. 1.0.4 - Adding sounds 1.0.5 - Switching the score when teams switch 1.0.6 - Now switch of scores stays 1.0.7 - Added variable to reset money and weapons at switch Added possibility to disable the halftime sound Added global forward "gemHalftime" if other scripts want to do something in halftime 1.0.8 - Added possibility to switch teams based on rounds as well. Either maxrounds or winlimit. 1.0.9 - Removed unnecessary logmessages, less spam in logs. 1.0.10 - Fixed bug where nopt all grenades and def kit were removed 1.1.11 - Fix so it works with new CSS update Note: 1.0.5 switch did not work due to what I think is a bug in sourcemod. Reported the bug, https://bugs.alliedmods.net/show_bug.cgi?id=3722. We'll see what happens. In the mean time, version 1.0.6 takes care of displaying the correct scores. Thanks to [MKBI]Relle for pointing out the simple work around Install instructions: Put the plugin in the standard plugin dir Unzip gem_sounds under cstrike/sound Alter your pure_server_whitelist.txt (if you are running pure server) and add Code:
sound\gem_sounds\*.* allow_from_disksm_halftime_sound - The sound that should be played in halftime, gem_sounds/teamswitch.mp3 is default. If set to "" in the config, halftime sound is disabled and no download occurs. sm_halftime_money_reset - Can be 0 or 1. 0 means no reset of money or weapons. You keep what you have. 1 means, all wepons and armour are removed, starting with standard pistol and mp_startmoney to by for. sm_halftime_teamswitch_type - It can have the following values ... timelimit - switch will be done at the end of the round when more than half of mp_timelimit has passed. maxrounds - switch will be done at then end of the round when playedRounds >= mp_maxrounds winlimit- switch will be done at then end of the round when playedRounds >= mp_winlimit |
Re: Halftime teamswitch
And what if the map time is extended after the swich, so that the "half time" is moved away a few rounds?
There will be another switch? |
Re: Halftime teamswitch
Good question, and I havn't tried it myself ...
The way the script works now is: If timeleft increases above maptime/2 the halftime flag will reset so a switch will occur next time timeleft falls below maptime/2 But I don't know if both maptime and timeleft is changed on extension or if it's only timeleft ... Guess I will have to try this a well ... And things will depend on when the map is extended ... So I guess the switch cant really be 100% fair depending on when you decide to extend the map. |
Re: Halftime teamswitch
Ok ... Just checked the extend map thingie ...
The extention time is added to both mapTime and timeleft Scenario 1: maptime is the standard 900 secons and timeleft is 600 (300 secs passed) - No teamswitch has occured extending the map by 15 minutes maptime is now 1800 and timeleft is 1500, finishing the map with no more extension - Teamswitch will occur when time left is 900 Result: one team will play CT 300+600 and the other one 900 secs = Fair Scenario 2: maptime is the standard 900 secons and timeleft is 200 (700 secs passed) - Teamswitch was done after 450 seconds extending the map by 15 minutes maptime is now 1800 and timeleft is 1100, finishing the map with no more extension - Teamswitch will occur again when time left is 900 Result: one team will play CT 450+900 = 1350 and the other one 250+300 secs = 550 secs ... Might not seem fair ... but what is a good solution?! And what if the map is replaced by another map after 400 secons ... then no teamswitch will occur at all! I dont think this can be 100% fair ... but it will give some fairness if maps are played the standard time which they are 95% of the times on our server ... guess most servers have the same ... Leaving the plugin as it is ... unless someone comes up with a better suggestion ... But to start to calculate something else than timeleft<=maptime/2 for trigger for mapchange will just be akward in my opinion ... the fairness can always be set aside with another map vote ... Thanks for raising the question though ... Conclusion Plugin will not crash when extending the map ... some extra switching might be done if extension is done after halftime. Works as designed ;) We sure will be using it on our servers even if it might not get approved for not handling this in more detail ;) |
Re: Halftime teamswitch
For readability you could try changing 'new halftime' to 'new bool:halftime' and then using 'true' and 'false' instead of 1 and 0. This has no effect on how the code gets executed, just makes it clearer to read imo. Definitely not required for approval.
You said in one of your comments that you tried the event 'game_newmap', you can just use the public forward 'public OnMapStart()' (in the same way as OnPluginStart) if you want to initialize halftime to 0 then. Other than that looks pretty solid. |
Re: Halftime teamswitch
Sticking with the way I'm handling initializing of halftime ... since it aids in the map extension case explained above ...
Thanks for the input regarding bool values ... updated the script ;) |
Re: Halftime teamswitch
I would like to understand how the players team models know how to switch as well, is this a new internal command?
TechKnow |
Re: Halftime teamswitch
Seems to me that it's integrated ... at least T looks like T and CT looks like CT ...
Documentation doesn'm mention if someone who picked model 2 as CT gets model 2 as T ... Or if they always default to model 1 ;) |
Re: Halftime teamswitch
1.0.2 - Added reset of halftime flag to false in OnMapStart just for safety
|
Re: Halftime teamswitch
Regarding approval. Any special request need to be done to get approval?
|
| All times are GMT -4. The time now is 21:37. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.