11/*
2- SourcePawn is Copyright (C) 2006-2015 AlliedModders LLC. All rights reserved.
3- SourceMod is Copyright (C) 2006-2015 AlliedModders LLC. All rights reserved.
4- Pawn and SMALL are Copyright (C) 1997-2015 ITB CompuPhase.
5- Source is Copyright (C) Valve Corporation.
6- All trademarks are property of their respective owners.
7-
8- This program is free software: you can redistribute it and/or modify it
9- under the terms of the GNU General Public License as published by the
10- Free Software Foundation, either version 3 of the License, or (at your
11- option) any later version.
12-
13- This program is distributed in the hope that it will be useful, but
14- WITHOUT ANY WARRANTY; without even the implied warranty of
15- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16- General Public License for more details.
17-
18- You should have received a copy of the GNU General Public License along
19- with this program. If not, see <http://www.gnu.org/licenses/>.
2+ SourcePawn is Copyright (C) 2006-2015 AlliedModders LLC. All rights reserved.
3+ SourceMod is Copyright (C) 2006-2015 AlliedModders LLC. All rights reserved.
4+ Pawn and SMALL are Copyright (C) 1997-2015 ITB CompuPhase.
5+ Source is Copyright (C) Valve Corporation.
6+ All trademarks are property of their respective owners.
7+
8+ This program is free software: you can redistribute it and/or modify it
9+ under the terms of the GNU General Public License as published by the
10+ Free Software Foundation, either version 3 of the License, or (at your
11+ option) any later version.
12+
13+ This program is distributed in the hope that it will be useful, but
14+ WITHOUT ANY WARRANTY; without even the implied warranty of
15+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+ General Public License for more details.
17+
18+ You should have received a copy of the GNU General Public License along
19+ with this program. If not, see <http://www.gnu.org/licenses/>.
2020*/
2121#pragma semicolon 1
2222#pragma newdecls required
@@ -31,19 +31,19 @@ public Plugin myinfo =
3131 name = " Block Trolls" ,
3232 description = " Prevents calling votes while others are loading" ,
3333 author = " ProdigySim, CanadaRox, darkid" ,
34- version = " 2.0.1.1 " ,
34+ version = " 2.0.1.2 " ,
3535 url = " https://github.com/SirPlease/L4D2-Competitive-Rework"
3636};
3737
38- bool g_bBlockCallvote ;
39- int loadedPlayers = 0 ;
38+ bool g_bBlockCallvote = false ;
39+ int loadedPlayers = 0 ;
4040
4141public void OnPluginStart ()
4242{
4343 LoadTranslations (" blocktrolls.phrases" );
4444 AddCommandListener (Vote_Listener , " callvote" );
4545 AddCommandListener (Vote_Listener , " vote" );
46- HookEvent (" player_team" , OnPlayerJoin );
46+ HookEvent (" player_team" , Event_OnPlayerJoin );
4747}
4848
4949public void OnMapStart ()
@@ -53,28 +53,35 @@ public void OnMapStart()
5353 CreateTimer (40.0 , EnableCallvoteTimer );
5454}
5555
56- void OnPlayerJoin ( Handle event , char [] name , bool dontBroadcast )
56+ void Event_OnPlayerJoin ( Event event , char [] name , bool dontBroadcast )
5757{
58- if (GetEventInt ( event , " oldteam" ) == 0 )
58+ if (event . GetInt ( " oldteam" ) == 0 )
5959 {
6060 loadedPlayers ++ ;
61- if (loadedPlayers == 6 ) g_bBlockCallvote = false ;
61+
62+ if (loadedPlayers == 6 )
63+ g_bBlockCallvote = false ;
6264 }
6365}
6466
6567Action Vote_Listener (int client , const char [] command , int argc )
6668{
67- if (g_bBlockCallvote )
69+ if (! client )
6870 {
69- CPrintToChat (client , " %t %t " , " Tag " , " VotingNotEnabled " );
71+ ReplyToCommand (client , " %T " , " NotConsoleVote " , LANG_SERVER );
7072 return Plugin_Handled ;
7173 }
72- else if (client == 0 )
74+
75+ if (! IsClientInGame (client ))
76+ return Plugin_Handled ;
77+
78+ if (g_bBlockCallvote )
7379 {
74- ReplyToCommand (client , " %T " , " NotConsoleVote " , LANG_SERVER );
80+ CPrintToChat (client , " %t %t " , " Tag " , " VotingNotEnabled " );
7581 return Plugin_Handled ;
7682 }
77- else if (IsClientInGame (client ) && GetClientTeam (client ) == L4D_TEAM_SPECTATOR )
83+
84+ if (GetClientTeam (client ) == L4D_TEAM_SPECTATOR )
7885 {
7986 CPrintToChat (client , " %t %t " , " Tag" , " NotSpectatorVote" );
8087 return Plugin_Handled ;
@@ -87,4 +94,4 @@ Action EnableCallvoteTimer(Handle timer)
8794{
8895 g_bBlockCallvote = false ;
8996 return Plugin_Stop ;
90- }
97+ }
0 commit comments