Auto Switch Teams Every X Rounds
1 Attachment(s)
Auto Team Switch Every X Rounds
Author: nikhilgupta345 Info: This plugin allows you to switch sides of teams every set number of rounds. Also gives a command to restart the number of rounds played. Cvars: amx_atsrounds - sets the number of rounds before a team switch occurs. Commands: amx_roundrestart - restarts the number of rounds that have been played. say /roundnumber - displays the amount of rounds that have been played. Credits: Nextra - Giving suggestions and making the code more efficient. Tirant - Giving suggestions as well and providing code for the delay. Connormcleod - Final suggestions on optimizing code. Changelog: Code:
v1.0 - Initial release |
Re: Auto Team Switcher in X rounds
Indent your code!!!
|
Re: Auto Team Switcher in X rounds
I do two spaces :/ How many should I make it?
|
Re: Auto Team Switcher in X rounds
I would say 4 at the minimum.
|
Re: Auto Team Switcher in X rounds
Don't listen to them.
The size of the indention does not matter as long as it is consistent. Your plugin has 2 separate indention patterns: PHP Code:
|
Re: Auto Team Switcher in X rounds
Suggestions:
- You unnecessarily make the cvar unchangeable mid-game imho. Why save it in plugin init instead of comparing (>=) the actual cvar value? - Also I believe you should update the roundnumber before and not after you compare it to the cvar. If you set the cvar to 1, your plugin will actually switch the teams after round 2 and not after round 1. - You could use a switch-statement instead of if/elseif when you check for the player teams. - The roundnumber should also be reset on gamerestart/game commencing and similar events. - You should ident your code consistently, but Exolent already told you that ;) |
Re: Auto Team Switcher in X rounds
Updated except for the switch. Just wondering does it optimize it that much with just two if/if else statements?
|
Re: Auto Team Switcher in X rounds
Quote:
Also, you accidentally uploaded the compiled .amxx file. |
Re: Auto Team Switcher in X rounds
Oops, my bad :p
Added the switch. |
Re: Auto Team Switcher in X rounds
New set of suggestions:
- switch( cs_get_user_team( player ) ) directly, no need for a new var. - Why do you not use pcvars anymore? It was correct before. - You should compare the round using >=, so the teams will be correctly switched even when the admin decides to lower the cvar value. - Does the register_event forward work when you just use the reset-command function with it? - Indent the return after if(!cmd_access[..]) |
All times are GMT -4. The time now is 22:10. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.