-
Notifications
You must be signed in to change notification settings - Fork 2
/
shavit-tag.sp
749 lines (619 loc) · 18.4 KB
/
shavit-tag.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
#pragma newdecls required
#pragma semicolon 1
#include <sourcemod>
#include <cstrike>
#include <shavit>
#define MAX_TEAMS 12
#define MAX_TEAM_MEMBERS 10
char g_cMapName[PLATFORM_MAX_PATH];
ConVar g_cvMaxPasses;
ConVar g_cvMaxUndos;
// invite system
int g_iInviteStyle[MAXPLAYERS + 1];
bool g_bCreatingTeam[MAXPLAYERS + 1];
ArrayList g_aInvitedPlayers[MAXPLAYERS + 1];
bool g_bInvitedPlayer[MAXPLAYERS + 1][MAXPLAYERS + 1];
int g_nDeclinedPlayers[MAXPLAYERS + 1];
ArrayList g_aAcceptedPlayers[MAXPLAYERS + 1];
// teams system
bool g_bAllowReset[MAXPLAYERS + 1];
bool g_bAllowStyleChange[MAXPLAYERS + 1];
int g_nUndoCount[MAX_TEAMS];
bool g_bDidUndo[MAX_TEAMS];
enum struct cp_cache
{
float fPosition[3];
float fAngles[3];
float fVelocity[3];
float fBaseVelocity[3];
MoveType iMoveType;
float fGravity;
float fSpeed;
float fStamina;
bool bDucked;
bool bDucking;
float fDucktime; // m_flDuckAmount in csgo
float fDuckSpeed; // m_flDuckSpeed in csgo; doesn't exist in css
int iFlags;
timer_snapshot_t aSnapshot;
int iTargetname;
int iClassname;
ArrayList aFrames;
bool bSegmented;
int iSerial;
bool bPractice;
int iGroundEntity;
}
char g_cTeamName[MAX_TEAMS][MAX_NAME_LENGTH];
int g_nPassCount[MAX_TEAMS];
int g_nRelayCount[MAX_TEAMS];
int g_iCurrentPlayer[MAX_TEAMS];
bool g_bTeamTaken[MAX_TEAMS];
int g_nTeamPlayerCount[MAX_TEAMS];
stylesettings_t aSettings;
int g_iTeamIndex[MAXPLAYERS + 1] = { -1, ... };
int g_iNextTeamMember[MAXPLAYERS + 1];
char g_cPlayerTeamName[MAXPLAYERS + 1][MAX_NAME_LENGTH];
// records system
ArrayList g_aCurrentSegmentStartTicks[MAX_TEAMS];
ArrayList g_aCurrentSegmentPlayers[MAX_TEAMS];
public Plugin myinfo =
{
name = "Slidy's Timer - Tagteam relay",
author = "SlidyBat",
description = "Plugin that manages the tagteam relay style",
version = "0.1",
url = ""
}
public APLRes AskPluginLoad2( Handle myself, bool late, char[] error, int err_max )
{
RegPluginLibrary( "timer-tagteam" );
return APLRes_Success;
}
public void OnPluginStart()
{
g_cvMaxPasses = CreateConVar( "sm_timer_tagteam_maxpasses", "-1", "Maximum number of passes a team can make or -1 for unlimited passes", _, true, -1.0, false );
g_cvMaxUndos = CreateConVar( "sm_timer_tagteam_maxundos", "3", "Maximum number of undos a team can make or -1 for unlimited undos", _, true, -1.0, false );
AutoExecConfig( true, "tagteam", "SlidyTimer" );
RegConsoleCmd( "sm_teamname", Command_TeamName );
RegConsoleCmd( "sm_exitteam", Command_ExitTeam );
RegConsoleCmd( "sm_pass", Command_Pass );
RegConsoleCmd( "sm_undo", Command_Undo );
GetCurrentMap( g_cMapName, sizeof(g_cMapName) );
}
public void OnMapStart()
{
GetCurrentMap( g_cMapName, sizeof(g_cMapName) );
}
public void OnClientPutInServer( int client )
{
Format( g_cPlayerTeamName[client], sizeof(g_cPlayerTeamName[]), "Team %N", client );
}
public void OnClientDisconnect( int client )
{
if( !IsFakeClient( client ) && g_iTeamIndex[client] != -1 )
{
ExitTeam( client );
}
}
public void Shavit_OnStyleChanged(int client, int oldstyle, int newstyle, int track, bool manual)
{
char sSpecial[stylestrings_t::sSpecialString];
Shavit_GetStyleStrings(newstyle, sSpecialString, sSpecial, stylestrings_t::sSpecialString);
Shavit_GetStyleSettings(newstyle, aSettings);
if(StrContains(sSpecial, "tagteam", false) != -1)
{
if( g_iTeamIndex[client] == -1 )
{
OpenInviteSelectMenu( client, 0, true, newstyle );
PrintToChat( client, "Created %s! Use !teamname to set your team name.", g_cPlayerTeamName[client] );
}
}
else
{
if( g_iTeamIndex[client] != -1 && !g_bAllowStyleChange[client] )
{
PrintToChat( client, "You cannot change style until you leave the team! Type !exitteam to leave your team" );
}
if( g_bAllowStyleChange[client] )
{
g_bAllowStyleChange[client] = false;
}
}
}
public void Shavit_OnRestart(int client, int track)
{
if( g_iTeamIndex[client] != -1 && !g_bAllowReset[client] && !(g_nRelayCount[g_iTeamIndex[client]] == 0 && g_iCurrentPlayer[g_iTeamIndex[client]] == client) )
{
Shavit_PrintToChat( client, "You cannot reset or teleport until you leave the team! Type !exitteam to leave your team" );
}
if( g_bAllowReset[client] )
{
g_bAllowReset[client] = false;
}
}
void OpenInviteSelectMenu( int client, int firstItem, bool reset = false, int style = 0 )
{
if( reset )
{
for( int i = 1; i <= MaxClients; i++ )
{
g_bInvitedPlayer[client][i] = false;
}
g_bCreatingTeam[client] = true;
g_iInviteStyle[client] = style;
g_nDeclinedPlayers[client] = 0;
delete g_aAcceptedPlayers[client];
g_aAcceptedPlayers[client] = new ArrayList();
delete g_aInvitedPlayers[client];
g_aInvitedPlayers[client] = new ArrayList();
}
Menu menu = new Menu( InviteSelectMenu_Handler );
menu.SetTitle( "Select players to invite:\n \n" );
for( int i = 1; i <= MaxClients; i++ )
{
if( i == client || !IsClientInGame( i ) || IsFakeClient( i ) || g_iTeamIndex[i] != -1 )
{
continue;
}
char name[MAX_NAME_LENGTH + 32];
Format( name, sizeof(name), "[%s] %N", g_bInvitedPlayer[client][i] ? "X" : " ", i );
char userid[8];
IntToString( GetClientUserId( i ), userid, sizeof(userid) );
menu.AddItem( userid, name );
}
menu.AddItem( "send", "Send Invites!", g_aInvitedPlayers[client].Length == 0 ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT );
menu.DisplayAt( client, firstItem, MENU_TIME_FOREVER );
}
public int InviteSelectMenu_Handler( Menu menu, MenuAction action, int param1, int param2 )
{
if( action == MenuAction_Select )
{
char info[8];
menu.GetItem( param2, info, sizeof(info) );
if( StrEqual( info, "send" ) ) // send the invites!
{
int length = g_aInvitedPlayers[param1].Length;
for( int i = 0; i < length; i++ )
{
SendInvite( param1, GetClientOfUserId( g_aInvitedPlayers[param1].Get( i ) ) );
}
Shavit_PrintToChat( param1, "Invites sent!" );
OpenLobbyMenu( param1 );
}
else
{
int userid = StringToInt( info );
int target = GetClientOfUserId( userid );
if( 0 < target <= MaxClients )
{
g_bInvitedPlayer[param1][target] = !g_bInvitedPlayer[param1][target];
if( g_bInvitedPlayer[param1][target] )
{
g_aInvitedPlayers[param1].Push( userid );
}
else
{
int idx = g_aInvitedPlayers[param1].FindValue( userid );
if( idx != -1 )
{
g_aInvitedPlayers[param1].Erase( idx );
}
}
}
OpenInviteSelectMenu( param1, (param2 / 6) * 6 );
}
}
else if( action == MenuAction_End )
{
delete menu;
}
}
void SendInvite( int client, int target )
{
Menu menu = new Menu( InviteMenu_Handler );
char buffer[256];
Format( buffer, sizeof(buffer), "%N has invited you to play tagteam!\nAccept?\n \n", client );
menu.SetTitle( buffer );
char userid[8];
IntToString( GetClientUserId( client ), userid, sizeof(userid) );
menu.AddItem( userid, "Yes" );
menu.AddItem( userid, "No" );
menu.Display( target, 20 );
}
public int InviteMenu_Handler( Menu menu, MenuAction action, int param1, int param2 )
{
if( action == MenuAction_Select )
{
char info[8];
menu.GetItem( param2, info, sizeof(info) );
int client = GetClientOfUserId( StringToInt( info ) );
if( !( 0 < client <= MaxClients ) )
{
return 0;
}
if( param2 == 0 ) // yes
{
if( !g_bCreatingTeam[client] )
{
Shavit_PrintToChat( param1, "The team has been cancelled or has already started the run" );
}
if( g_aAcceptedPlayers[client].Length >= MAX_TEAM_MEMBERS )
{
Shavit_PrintToChat( param1, "The team is now full, cannot join" );
}
else
{
g_aAcceptedPlayers[client].Push( GetClientUserId( param1 ) );
OpenLobbyMenu( client );
}
}
else // no
{
g_nDeclinedPlayers[client]++;
Shavit_PrintToChat( client, "%N has declined your invite", param1 );
}
if( g_aAcceptedPlayers[client].Length + g_nDeclinedPlayers[client] == g_aInvitedPlayers[client].Length ) // everyone responded
{
FinishInvite( client );
}
}
else if( action == MenuAction_End )
{
delete menu;
}
return 0;
}
void OpenLobbyMenu( int client )
{
Menu menu = new Menu( LobbyMenu_Handler );
char buffer[512];
Format( buffer, sizeof(buffer), "%s\n \nMembers:\n%N\n", g_cPlayerTeamName[client], client );
int length = g_aAcceptedPlayers[client].Length;
if( length == 0 )
{
Format( buffer, sizeof(buffer), "%s \n", buffer );
}
for( int i = 0; i < length; i++ )
{
Format( buffer, sizeof(buffer), "%s%N\n", buffer, GetClientOfUserId( g_aAcceptedPlayers[client].Get( i ) ) );
if( i == length - 1 )
{
Format( buffer, sizeof(buffer), "%s \n", buffer );
}
}
menu.SetTitle( buffer );
menu.AddItem( "start", "Start", (length > 0) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED );
menu.AddItem( "cancel", "Cancel" );
menu.ExitButton = false;
menu.Display( client, MENU_TIME_FOREVER );
}
public int LobbyMenu_Handler( Menu menu, MenuAction action, int param1, int param2 )
{
if( action == MenuAction_Select )
{
if( param1 == 0 ) // start
{
FinishInvite( param1 );
}
else if( param1 == 1 ) // cancel
{
CancelInvite( param1 );
}
}
else if( action == MenuAction_End )
{
delete menu;
}
}
void FinishInvite( int client )
{
g_bCreatingTeam[client] = false;
int length = g_aAcceptedPlayers[client].Length;
if( length < 1 )
{
Shavit_PrintToChat( client, "Not enough players to create a team" );
return;
}
int[] members = new int[length + 1];
members[0] = client;
for( int i = 0; i < length; i++ )
{
members[i + 1] = GetClientOfUserId( g_aAcceptedPlayers[client].Get( i ) );
}
CreateTeam( members, length + 1, g_iInviteStyle[client] );
int letters;
char buffer[512];
for( int i = 0; i <= length; i++ )
{
letters += Format( buffer, sizeof(buffer), "%s%N, ", buffer, members[i] );
}
buffer[letters - 3] = '\0';
PrintToTeam( g_iTeamIndex[client], "%s has been assembled! Members: %s", g_cTeamName[g_iTeamIndex[client]], buffer );
}
void CancelInvite( int client )
{
g_bCreatingTeam[client] = false;
}
void CreateTeam( int[] members, int memberCount, int style )
{
int teamindex = -1;
for( int i = 0; i < MAX_TEAMS; i++ )
{
if( !g_bTeamTaken[i] )
{
teamindex = i;
break;
}
}
if( teamindex == -1 )
{
LogError( "Not enough teams" );
return;
}
g_nUndoCount[teamindex] = 0;
g_nPassCount[teamindex] = 0;
g_nRelayCount[teamindex] = 0;
g_bTeamTaken[teamindex] = true;
g_nTeamPlayerCount[teamindex] = memberCount;
strcopy( g_cTeamName[teamindex], sizeof(g_cTeamName[]), g_cPlayerTeamName[members[0]] );
delete g_aCurrentSegmentStartTicks[teamindex];
g_aCurrentSegmentStartTicks[teamindex] = new ArrayList();
delete g_aCurrentSegmentPlayers[teamindex];
g_aCurrentSegmentPlayers[teamindex] = new ArrayList();
g_aCurrentSegmentStartTicks[teamindex].Push( 2 ); // not zero so that it doesnt spam print during first tick freeze time
int next = members[0];
for( int i = memberCount - 1; i >= 0; i-- )
{
g_iNextTeamMember[members[i]] = next;
next = members[i];
g_iTeamIndex[members[i]] = teamindex;
g_bAllowStyleChange[members[i]] = true;
Shavit_ClearCheckpoints( members[i] );
Shavit_ChangeClientStyle( members[i], style );
}
Shavit_RestartTimer(members[0], Track_Main);
Shavit_OpenCheckpointMenu( members[0] );
g_iCurrentPlayer[teamindex] = members[0];
for( int i = 1; i < memberCount; i++ )
{
ChangeClientTeam( members[i], CS_TEAM_SPECTATOR );
SetEntPropEnt( members[i], Prop_Send, "m_hObserverTarget", members[0] );
SetEntProp( members[i], Prop_Send, "m_iObserverMode", 4 );
}
}
bool ExitTeam( int client )
{
if( g_iTeamIndex[client] == -1 )
{
Shavit_ChangeClientStyle( client, 0 );
Shavit_RestartTimer(client, Track_Main);
return false;
}
int teamidx = g_iTeamIndex[client];
g_iTeamIndex[client] = -1;
g_nTeamPlayerCount[teamidx]--;
if( g_nTeamPlayerCount[teamidx] <= 1 )
{
g_bTeamTaken[teamidx] = false;
for( int i = 1; i <= MaxClients; i++ )
{
if( i != client && g_iTeamIndex[i] == teamidx )
{
Shavit_PrintToChat( i, "All your team members have left, your team has been disbanded!" );
ExitTeam( i );
break;
}
}
}
else
{
for( int i = 1; i <= MaxClients; i++ )
{
if( g_iNextTeamMember[i] == client )
{
g_iNextTeamMember[i] = g_iNextTeamMember[client];
}
}
}
g_iNextTeamMember[client] = -1;
Shavit_ChangeClientStyle( client, 0 );
Shavit_RestartTimer(client, Track_Main);
return true;
}
public Action Shavit_OnSave(int client, int idx)
{
if( g_iTeamIndex[client] != -1 )
{
int teamidx = g_iTeamIndex[client];
cp_cache_t cpcache;
if( !g_bDidUndo[teamidx] )
{
delete cpcache.aFrames;
}
g_nRelayCount[teamidx]++;
int next = g_iNextTeamMember[client];
Shavit_GetCheckpoint( client, idx, cpcache );
PassToNext( client, next, cpcache );
g_bDidUndo[teamidx] = false;
}
}
public Action Command_TeamName( int client, int args )
{
GetCmdArgString( g_cPlayerTeamName[client], sizeof(g_cPlayerTeamName[]) );
if( g_iTeamIndex[client] != -1 )
{
strcopy( g_cTeamName[g_iTeamIndex[client]], sizeof(g_cTeamName[]), g_cPlayerTeamName[client] );
}
ReplyToCommand( client, "Team name set to: %s", g_cPlayerTeamName[client] );
return Plugin_Handled;
}
public Action Command_ExitTeam( int client, int args )
{
if( !ExitTeam( client ) )
{
ReplyToCommand( client, "You are not currently in a team" );
}
return Plugin_Handled;
}
public Action Command_Pass( int client, int args )
{
if( g_iTeamIndex[client] == -1 )
{
ReplyToCommand( client, "You are not currently in a team" );
return Plugin_Handled;
}
int teamidx = g_iTeamIndex[client];
int maxPasses = g_cvMaxPasses.IntValue;
if( maxPasses > -1 && g_nPassCount[teamidx] >= maxPasses )
{
ReplyToCommand( client, "Your team has used all %i passes", maxPasses );
return Plugin_Handled;
}
if( g_iCurrentPlayer[teamidx] != client )
{
ReplyToCommand( client, "You cannot pass when it is not your turn" );
return Plugin_Handled;
}
g_nPassCount[teamidx]++;
cp_cache_t cpcache;
bool usecp = Shavit_GetTotalCheckpoints( client ) > 0;
if( usecp )
{
Shavit_GetCheckpoint( client, 0, cpcache );
}
PassToNext( client, g_iNextTeamMember[client], cpcache, usecp );
if( maxPasses > -1 )
{
PrintToTeam( teamidx, "%N has passed! It is now %N's turn. %i/%i passes used.", client, g_iNextTeamMember[client], g_nPassCount[teamidx], maxPasses );
}
else
{
PrintToTeam( teamidx, "%N has passed! It is now %N's turn.", client, g_iNextTeamMember[client] );
}
return Plugin_Handled;
}
public Action Command_Undo( int client, int args )
{
if( g_iTeamIndex[client] == -1 )
{
ReplyToCommand( client, "You are not currently in a team" );
return Plugin_Handled;
}
int teamidx = g_iTeamIndex[client];
int maxUndos = g_cvMaxUndos.IntValue;
if( maxUndos == -1 || g_nUndoCount[teamidx] >= maxUndos )
{
ReplyToCommand( client, "Your team has already used all %i undos", maxUndos );
return Plugin_Handled;
}
if( g_iCurrentPlayer[teamidx] != client )
{
ReplyToCommand( client, "You cannot undo when it is not your turn" );
return Plugin_Handled;
}
if( g_nRelayCount[teamidx] == 0 )
{
ReplyToCommand( client, "Cannot undo when no one has saved!" );
return Plugin_Handled;
}
if( g_bDidUndo[teamidx] )
{
ReplyToCommand( client, "Your team has already undo-ed this turn" );
return Plugin_Handled;
}
int last = -1;
for( int i = 1; i <= MaxClients; i++ )
{
if( g_iNextTeamMember[i] == client )
{
last = i;
break;
}
}
if( last == -1 )
{
LogError( "Failed to find last player" );
return Plugin_Handled;
}
cp_cache_t cpcache;
PassToNext( client, last, cpcache );
g_aCurrentSegmentStartTicks[teamidx].Erase( g_aCurrentSegmentStartTicks[teamidx].Length - 1 );
g_aCurrentSegmentPlayers[teamidx].Erase( g_aCurrentSegmentPlayers[teamidx].Length - 1 );
g_bDidUndo[teamidx] = true;
g_nUndoCount[teamidx]++;
if( maxUndos > -1 )
{
PrintToTeam( teamidx, "%N used an undo! It is now %N's turn again. %i/%i undos used.", client, last, g_nUndoCount[teamidx], maxUndos );
}
else
{
PrintToTeam( teamidx, "%N used an undo! It is now %N's turn again.", client, last );
}
return Plugin_Handled;
}
void PassToNext( int client, int next, cp_cache_t cpcache, bool usecp = true )
{
int length;
length = Shavit_GetTotalCheckpoints( client );
PrintToChatAll("client: %d", length);
for( int i = 0; i < length; i++ )
{
cp_cache_t cp;
Shavit_GetCheckpoint( client, i, cp );
if(cp.aFrames != cpcache.aFrames)
{
delete cp.aFrames;
}
}
length = Shavit_GetTotalCheckpoints( next );
PrintToChatAll("next: %d", length);
for( int i = 0; i < length; i++ )
{
cp_cache_t cp;
Shavit_GetCheckpoint( next, i, cp );
if( cp.aFrames != cpcache.aFrames )
{
delete cp.aFrames;
}
}
Shavit_ClearCheckpoints( client );
Shavit_ClearCheckpoints( next );
if( usecp )
{
Shavit_SetCheckpoint( next, -1, cpcache );
}
ChangeClientTeam( next, CS_TEAM_SPECTATOR );
ChangeClientTeam( next, CS_TEAM_T );
CS_RespawnPlayer( next );
for( int i = 1; i <= MaxClients; i++ )
{
if( IsClientInGame( i ) && !IsFakeClient( i ) && IsClientObserver( i ) && GetEntPropEnt( client, Prop_Send, "m_hObserverTarget" ) == client )
{
SetEntPropEnt( client, Prop_Send, "m_hObserverTarget", next );
SetEntProp( client, Prop_Send, "m_iObserverMode", 4 );
}
}
ChangeClientTeam( client, CS_TEAM_SPECTATOR );
SetEntPropEnt( client, Prop_Send, "m_hObserverTarget", next );
SetEntProp( client, Prop_Send, "m_iObserverMode", 4 );
g_iCurrentPlayer[g_iTeamIndex[client]] = next;
if( usecp )
{
Shavit_TeleportToCheckpoint( next, 0 );
}
Shavit_OpenCheckpointMenu( next );
Shavit_OpenCheckpointMenu( client );
}
void PrintToTeam( int teamidx, char[] message, any ... )
{
char buffer[512];
VFormat( buffer, sizeof(buffer), message, 3 );
for( int i = 1; i <= MaxClients; i++ )
{
if( g_iTeamIndex[i] == teamidx )
{
Shavit_PrintToChat( i, buffer );
}
}
}