@@ -623,18 +623,16 @@ end
623
623
-----------------------------------------------------------]]
624
624
function GM :PlayerRequestTeam ( ply , teamid )
625
625
626
- -- No changing teams if not teambased!
627
626
if ( !GAMEMODE .TeamBased ) then return end
628
627
629
- -- This team isn't joinable
630
628
if ( !team .Joinable ( teamid ) ) then
631
629
ply :ChatPrint ( " You can't join that team" )
632
- return end
630
+ return
631
+ end
633
632
634
- -- This team isn't joinable
635
- if ( !GAMEMODE :PlayerCanJoinTeam ( ply , teamid ) ) then
636
- -- Messages here should be outputted by this function
637
- return end
633
+ if ( !hook .Call (' PlayerCanJoinTeam' , self , ply , teamid ) ) then
634
+ return
635
+ end
638
636
639
637
GAMEMODE :PlayerJoinTeam ( ply , teamid )
640
638
820
818
function GM :PlayerButtonDown ( ply , btn ) end
821
819
function GM :PlayerButtonUp ( ply , btn ) end
822
820
823
- concommand .Add ( " changeteam" , function ( pl , cmd , args ) hook .Call ( " PlayerRequestTeam" , GAMEMODE , pl , tonumber ( args [ 1 ] ) ) end )
821
+ concommand .Add ( " changeteam" , function ( pl , cmd , args )
822
+ local teamid = tonumber ( args [ 1 ] )
823
+
824
+ if ( teamid == nil ) then
825
+ return
826
+ end
827
+
828
+ hook .Call ( " PlayerRequestTeam" , GAMEMODE , pl , teamid )
829
+ end )
824
830
825
831
--[[ ---------------------------------------------------------
826
832
Name: gamemode:HandlePlayerArmorReduction()
0 commit comments