@@ -131,13 +131,18 @@ public Action OnPlayerRunCmd(int iClient, int &iButtons, int &iImpulse, float fV
131
131
return Plugin_Continue ;
132
132
}
133
133
134
+ if (mouse [0 ] || mouse [1 ])
135
+ {
136
+ g_bPostTeamSelect [iClient ] = true ;
137
+ }
138
+
134
139
// Spectator fixes
135
140
// Credit: harper
136
141
137
142
if (IsClientObserver (iClient ))
138
143
{
139
144
// hide bugged ctrl menu
140
- if ( tickcount % 10 == 0 )
145
+ if ( g_bPostTeamSelect [ iClient ] && tickcount % 64 == 0 )
141
146
ShowVGUIPanel (iClient , " specmenu" , _ , false );
142
147
143
148
Obs_Mode iMode = view_as <Obs_Mode > (GetEntProp (iClient , Prop_Send , " m_iObserverMode" ));
@@ -294,11 +299,13 @@ public void Hook_PlayerSpawnPost(int iClient)
294
299
ClientCommand (iClient , " hidepanel team" );
295
300
ClientCommand (iClient , " hidepanel deathmatch" );
296
301
ChangeClientTeam (iClient , TEAM_SCIENTIST );
302
+ g_bPostTeamSelect [iClient ] = true ;
297
303
}
298
304
else
299
305
{
300
- // If this was not here, the specmenu fix in OnPlayerRunCmd would periodically blink the initial team select menu for some reason.
301
- ClientCommand (iClient , " chooseteam" );
306
+ // always show DM variant of team select
307
+ ClientCommand (iClient , " hidepanel team" );
308
+ ClientCommand (iClient , " showpanel deathmatch" );
302
309
}
303
310
}
304
311
}
@@ -330,9 +337,9 @@ public MRESReturn Hook_PlayerKilled(int _this, DHookParam hParams)
330
337
331
338
public MRESReturn Hook_PlayerKilledPost (int _this , DHookParam hParams )
332
339
{
340
+ CBasePlayer pPlayer = CBasePlayer (_this );
333
341
if (g_pNewRagdoll .IsValid ())
334
342
{
335
- CBasePlayer pPlayer = CBasePlayer (_this );
336
343
CBaseEntity pRagdoll = pPlayer .GetRagdoll ();
337
344
CBaseEntity pViewEnt = pPlayer .GetViewEntity ();
338
345
@@ -351,6 +358,9 @@ public MRESReturn Hook_PlayerKilledPost(int _this, DHookParam hParams)
351
358
352
359
g_pNewRagdoll = CBaseEntity (- 1 );
353
360
361
+ }
362
+ if (CoopManager .IsCoopModeEnabled ())
363
+ {
354
364
SurvivalManager .HandlePlayerDeath (pPlayer );
355
365
}
356
366
return MRES_Ignored ;
@@ -398,27 +408,31 @@ public MRESReturn Hook_PlayerChangeTeam(int _this, Handle hParams)
398
408
{
399
409
if (CoopManager .IsCoopModeEnabled ())
400
410
{
411
+ if (! CBM_MP_GameRules .IsTeamplay ())
412
+ return MRES_Ignored ;
413
+
401
414
int iTeamNum = DHookGetParam (hParams , 1 );
402
- if (iTeamNum == TEAM_SCIENTIST || iTeamNum == TEAM_MARINES )
415
+ if (iTeamNum == TEAM_SCIENTIST || iTeamNum == TEAM_MARINES || iTeamNum == TEAM_UNASSIGNED )
403
416
{
404
417
char szTeam [16 ]; g_pConvarCoopTeam .GetString (szTeam , sizeof (szTeam ));
405
418
if (StrEqual (szTeam , " scientist" , false ))
406
419
{
407
- if (iTeamNum == TEAM_MARINES )
408
- {
409
- DHookSetParam (hParams , 1 , TEAM_SCIENTIST );
410
- return MRES_ChangedHandled ;
411
- }
420
+ DHookSetParam (hParams , 1 , TEAM_SCIENTIST );
421
+ return MRES_ChangedHandled ;
412
422
}
413
423
else if (StrEqual (szTeam , " marines" , false ))
414
424
{
415
- if (iTeamNum == TEAM_SCIENTIST )
416
- {
417
- DHookSetParam (hParams , 1 , TEAM_MARINES );
418
- return MRES_ChangedHandled ;
419
- }
425
+ DHookSetParam (hParams , 1 , TEAM_MARINES );
426
+ return MRES_ChangedHandled ;
427
+ }
428
+ if (iTeamNum == TEAM_UNASSIGNED )
429
+ {
430
+ DHookSetParam (hParams , 1 , TEAM_SCIENTIST );
431
+ return MRES_ChangedHandled ;
420
432
}
421
433
}
434
+
435
+
422
436
}
423
437
return MRES_Ignored ;
424
438
}
0 commit comments