-
Notifications
You must be signed in to change notification settings - Fork 5
/
custom-chatcolors-csgo-sb.sp
636 lines (577 loc) · 19.9 KB
/
custom-chatcolors-csgo-sb.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
#pragma semicolon 1
#include <sourcemod>
#include <scp>
#undef REQUIRE_EXTENSIONS
#include <skillbot>
#define PLUGIN_VERSION "3.1.2-CSGO-SB"
public Plugin:myinfo = {
name = "[Source 2013] Custom Chat Colors",
author = "Dr. McKay | Mitchell | AntiTeal",
description = "Processes chat and provides colors for Source 2013 games",
version = PLUGIN_VERSION,
url = "http://www.doctormckay.com"
};
new Handle:colorForward;
new Handle:nameForward;
new Handle:tagForward;
new Handle:applicationForward;
new Handle:messageForward;
new Handle:preLoadedForward;
new Handle:loadedForward;
new Handle:configReloadedForward;
new String:tag[MAXPLAYERS + 1][64];
new String:tagColor[MAXPLAYERS + 1][12];
new String:usernameColor[MAXPLAYERS + 1][12];
new String:chatColor[MAXPLAYERS + 1][12];
new String:defaultTag[MAXPLAYERS + 1][32];
new String:defaultTagColor[MAXPLAYERS + 1][12];
new String:defaultUsernameColor[MAXPLAYERS + 1][12];
new String:defaultChatColor[MAXPLAYERS + 1][12];
new Handle:configFile;
enum CCC_ColorType {
CCC_TagColor,
CCC_NameColor,
CCC_ChatColor
};
#define COLOR_NONE -1
#define COLOR_GREEN -2
#define COLOR_OLIVE -3
#define COLOR_TEAM -4
#define UPDATE_FILE "chatcolors.txt"
#define CONVAR_PREFIX "custom_chat_colors"
#tryinclude "mckayupdater.sp"
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) {
MarkNativeAsOptional("Updater_AddPlugin");
CreateNative("CCC_GetColor", Native_GetColor);
CreateNative("CCC_SetColor", Native_SetColor);
CreateNative("CCC_GetTag", Native_GetTag);
CreateNative("CCC_SetTag", Native_SetTag);
CreateNative("CCC_ResetColor", Native_ResetColor);
CreateNative("CCC_ResetTag", Native_ResetTag);
MarkNativeAsOptional("SB_GetChatRank");
RegPluginLibrary("ccc");
return APLRes_Success;
}
bool skillbot = false;
public void OnAllPluginsLoaded()
{
skillbot = LibraryExists("skillbot");
}
public void OnLibraryRemoved(const char[] name)
{
if (StrEqual(name, "skillbot"))
{
skillbot = false;
}
}
public void OnLibraryAdded(const char[] name)
{
if (StrEqual(name, "skillbot"))
{
skillbot = true;
}
}
public OnPluginStart() {
RegAdminCmd("sm_reloadccc", Command_ReloadConfig, ADMFLAG_CONFIG, "Reloads Custom Chat Colors config file");
colorForward = CreateGlobalForward("CCC_OnChatColor", ET_Event, Param_Cell);
nameForward = CreateGlobalForward("CCC_OnNameColor", ET_Event, Param_Cell);
tagForward = CreateGlobalForward("CCC_OnTagApplied", ET_Event, Param_Cell);
applicationForward = CreateGlobalForward("CCC_OnColor", ET_Event, Param_Cell, Param_String, Param_Cell);
messageForward = CreateGlobalForward("CCC_OnChatMessage", ET_Ignore, Param_Cell, Param_String, Param_Cell);
preLoadedForward = CreateGlobalForward("CCC_OnUserConfigPreLoaded", ET_Event, Param_Cell);
loadedForward = CreateGlobalForward("CCC_OnUserConfigLoaded", ET_Ignore, Param_Cell);
configReloadedForward = CreateGlobalForward("CCC_OnConfigReloaded", ET_Ignore);
LoadConfig();
skillbot = LibraryExists("skillbot");
}
new String:CTag[][] = {
"{01}", //White
"{02}",
"{03}",
"{04}",
"{05}",
"{06}",
"{07}",
"{08}",
"{09}",
"{0A}",
"{0B}",
"{0C}",
"{0D}",
"{0E}",
"{0F}",
"{10}"
};
new String:CTagCode[][] = {
"\x01",
"\x02",
"\x03",
"\x04",
"\x05",
"\x06",
"\x07",
"\x08",
"\x09",
"\x0A",
"\x0B",
"\x0C",
"\x0D",
"\x0E",
"\x0F",
"\x10"
};
stock CFormat(String:szMessage[], maxlength) {
for(new c = 0; c < sizeof(CTagCode); c++) {
ReplaceString(szMessage, maxlength, CTag[c], CTagCode[c]);
}
}
stock CStrip(String:szMessage[], maxlength) {
new String:tempString[6];
for(new c = 1; c <= sizeof(CTagCode); c++) {
Format(tempString, sizeof(tempString), "%c", c);
ReplaceString(szMessage, maxlength, tempString, "");
}
}
LoadConfig() {
if(configFile != INVALID_HANDLE) {
CloseHandle(configFile);
}
configFile = CreateKeyValues("admin_colors");
decl String:path[64];
BuildPath(Path_SM, path, sizeof(path), "configs/custom-chatcolors.cfg");
if(!FileToKeyValues(configFile, path)) {
SetFailState("Config file missing");
}
for(new i = 1; i <= MaxClients; i++) {
if(!IsClientInGame(i) || IsFakeClient(i)) {
continue;
}
ClearValues(i);
OnClientPostAdminCheck(i);
}
}
public Action:Command_ReloadConfig(client, args) {
LoadConfig();
LogAction(client, -1, "Reloaded Custom Chat Colors config file");
ReplyToCommand(client, "[CCC] Reloaded config file.");
Call_StartForward(configReloadedForward);
Call_Finish();
return Plugin_Handled;
}
ClearValues(client) {
Format(tag[client], sizeof(tag[]), "");
Format(tagColor[client], sizeof(tagColor[]), "");
Format(usernameColor[client], sizeof(usernameColor[]), "");
Format(chatColor[client], sizeof(chatColor[]), "");
Format(defaultTag[client], sizeof(defaultTag[]), "");
Format(defaultTagColor[client], sizeof(defaultTagColor[]), "");
Format(defaultUsernameColor[client], sizeof(defaultUsernameColor[]), "");
Format(defaultChatColor[client], sizeof(defaultChatColor[]), "");
}
public OnClientConnected(client) {
ClearValues(client);
}
public OnClientDisconnect(client) {
ClearValues(client); // On connect and on disconnect, just to be safe
}
public OnClientPostAdminCheck(client) {
if(!ConfigForward(client)) {
return; // Another plugin wants to block this
}
// check the Steam ID first
decl String:auth[32];
if(!GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth))) {
return; // Another plugin wants to block this
}
KvRewind(configFile);
if(!KvJumpToKey(configFile, auth)) {
KvRewind(configFile);
KvGotoFirstSubKey(configFile);
new AdminId:admin = GetUserAdmin(client);
new AdminFlag:flag;
decl String:configFlag[2];
decl String:section[32];
new bool:found = false;
do {
KvGetSectionName(configFile, section, sizeof(section));
KvGetString(configFile, "flag", configFlag, sizeof(configFlag));
if(strlen(configFlag) > 1) {
LogError("Multiple flags given in section \"%s\", which is not allowed. Using first character.", section);
}
if(strlen(configFlag) == 0 && StrContains(section, "STEAM_", false) == -1 && StrContains(section, "[U:1:", false) == -1) {
found = true;
break;
}
if(!FindFlagByChar(configFlag[0], flag)) {
if(strlen(configFlag) > 0) {
LogError("Invalid flag given for section \"%s\", skipping", section);
}
continue;
}
if(GetAdminFlag(admin, flag)) {
found = true;
break;
}
} while(KvGotoNextKey(configFile));
if(!found) {
return;
}
}
decl String:clientTagColor[12];
decl String:clientNameColor[12];
decl String:clientChatColor[12];
KvGetString(configFile, "tag", tag[client], sizeof(tag[]));
KvGetString(configFile, "tagcolor", clientTagColor, sizeof(clientTagColor));
KvGetString(configFile, "namecolor", clientNameColor, sizeof(clientNameColor));
KvGetString(configFile, "textcolor", clientChatColor, sizeof(clientChatColor));
ReplaceString(clientTagColor, sizeof(clientTagColor), "#", "");
ReplaceString(clientNameColor, sizeof(clientNameColor), "#", "");
ReplaceString(clientChatColor, sizeof(clientChatColor), "#", "");
new tagLen = strlen(clientTagColor);
new nameLen = strlen(clientNameColor);
new chatLen = strlen(clientChatColor);
if(tagLen == 6 || tagLen == 8 || tagLen == 4 || StrEqual(clientTagColor, "T", false) || StrEqual(clientTagColor, "G", false) || StrEqual(clientTagColor, "O", false)) {
strcopy(tagColor[client], sizeof(tagColor[]), clientTagColor);
}
if(nameLen == 6 || nameLen == 8 || nameLen == 4 || StrEqual(clientNameColor, "G", false) || StrEqual(clientNameColor, "O", false)) {
strcopy(usernameColor[client], sizeof(usernameColor[]), clientNameColor);
}
if(chatLen == 6 || chatLen == 8 || chatLen == 4 || StrEqual(clientChatColor, "T", false) || StrEqual(clientChatColor, "G", false) || StrEqual(clientChatColor, "O", false)) {
strcopy(chatColor[client], sizeof(chatColor[]), clientChatColor);
}
strcopy(defaultTag[client], sizeof(defaultTag[]), tag[client]);
strcopy(defaultTagColor[client], sizeof(defaultTagColor[]), tagColor[client]);
strcopy(defaultUsernameColor[client], sizeof(defaultUsernameColor[]), usernameColor[client]);
strcopy(defaultChatColor[client], sizeof(defaultChatColor[]), chatColor[client]);
Call_StartForward(loadedForward);
Call_PushCell(client);
Call_Finish();
}
public Action:OnChatMessage(&author, Handle:recipients, String:name[], String:message[]) {
new String:tempString[12];
new String:tagtemp[64];
new tempAuthor = author;
//new String:name[MAXLENGTH_NAME];
//Format(name, sizeof(name), "%s", iname);
//strcopy(name, MAXLENGTH_NAME, iname);
CStrip(name, MAXLENGTH_INPUT);
//new String:message[MAXLENGTH_MESSAGE];
//Format(message, sizeof(message), "%s", imessage);
CStrip(message, MAXLENGTH_MESSAGE);
if(CheckForward(author, message, CCC_NameColor)) {
if(StrEqual(usernameColor[author], "G", false)) {
Format(name, MAXLENGTH_INPUT, "\x04%s", name);
} else if(StrEqual(usernameColor[author], "O", false)) {
Format(name, MAXLENGTH_INPUT, "\x05%s", name);
} else if(strlen(usernameColor[author]) == 6) {
Format(name, MAXLENGTH_INPUT, "\x07%s%s", usernameColor[author], name);
} else if(strlen(usernameColor[author]) == 8) {
Format(name, MAXLENGTH_INPUT, "\x08%s%s", usernameColor[author], name);
} else if(strlen(usernameColor[author]) == 4) {
strcopy(tempString, sizeof(tempString), usernameColor[author]);
if(StrEqual(tempString, "{03}")) {
tempAuthor = -1;
}
CFormat(tempString, sizeof(tempString));
Format(name, MAXLENGTH_INPUT, "%s%s", tempString, name);
} else {
Format(name, MAXLENGTH_INPUT, "\x03%s", name); // team color by default!
}
} else {
Format(name, MAXLENGTH_INPUT, "\x03%s", name); // team color by default!
}
if(CheckForward(author, message, CCC_TagColor)) {
if(strlen(tag[author]) > 0) {
if(StrEqual(tagColor[author], "T", false)) {
Format(name, MAXLENGTH_INPUT, "\x03%s%s", tag[author], name);
} else if(StrEqual(tagColor[author], "G", false)) {
Format(name, MAXLENGTH_INPUT, "\x04%s%s", tag[author], name);
} else if(StrEqual(tagColor[author], "O", false)) {
Format(name, MAXLENGTH_INPUT, "\x05%s%s", tag[author], name);
} else if(strlen(tagColor[author]) == 6) {
Format(name, MAXLENGTH_INPUT, "\x07%s%s%s", tagColor[author], tag[author], name);
} else if(strlen(tagColor[author]) == 8) {
Format(name, MAXLENGTH_INPUT, "\x08%s%s%s", tagColor[author], tag[author], name);
} else if(strlen(tagColor[author]) == 4) {
strcopy(tempString, sizeof(tempString), tagColor[author]);
strcopy(tagtemp, sizeof(tagtemp), tag[author]);
CFormat(tagtemp, sizeof(tagtemp));
if(StrEqual(tempString, "{03}")) {
tempAuthor = -1;
}
CFormat(tempString, sizeof(tempString));
Format(name, MAXLENGTH_INPUT, "%s%s%s", tempString, tagtemp, name);
} else {
Format(name, MAXLENGTH_INPUT, "\x01%s%s", tag[author], name);
}
}
}
if(skillbot) {
new String:rank[64];
SB_GetChatRank(author, rank, sizeof(rank));
if(strlen(rank) != 0)
{
CFormat(rank, sizeof(rank));
Format(name, MAXLENGTH_INPUT, "%s %s", rank, name);
}
}
new MaxMessageLength = MAXLENGTH_MESSAGE - strlen(name) - 5; // MAXLENGTH_MESSAGE = maximum characters in a chat message, including name. Subtract the characters in the name, and 5 to account for the colon, spaces, and null terminator
if(strlen(chatColor[author]) > 0 && CheckForward(author, message, CCC_ChatColor)) {
if(StrEqual(chatColor[author], "T", false)) {
Format(message, MaxMessageLength, "\x03%s", message);
} else if(StrEqual(chatColor[author], "G", false)) {
Format(message, MaxMessageLength, "\x04%s", message);
} else if(StrEqual(chatColor[author], "O", false)) {
Format(message, MaxMessageLength, "\x05%s", message);
} else if(strlen(chatColor[author]) == 6) {
Format(message, MaxMessageLength, "\x07%s%s", chatColor[author], message);
} else if(strlen(chatColor[author]) == 8) {
Format(message, MaxMessageLength, "\x08%s%s", chatColor[author], message);
} else if(strlen(chatColor[author]) == 4) {
strcopy(tempString, sizeof(tempString), chatColor[author]);
if(StrEqual(tempString, "{03}")) {
tempAuthor = -1;
}
CFormat(tempString, sizeof(tempString));
Format(message, MaxMessageLength, "%s%s", tempString, message);
}
}
decl String:game[64];
GetGameFolderName(game, sizeof(game));
if(StrEqual(game, "csgo")) {
Format(name, MAXLENGTH_NAME, "\x01\x0B %s", name);
}
Call_StartForward(messageForward);
Call_PushCell(author);
Call_PushStringEx(message, MaxMessageLength, SM_PARAM_STRING_UTF8|SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
Call_PushCell(MaxMessageLength);
Call_Finish();
author = tempAuthor;
return Plugin_Changed;
}
bool:CheckForward(author, const String:message[], CCC_ColorType:type) {
new Action:result = Plugin_Continue;
Call_StartForward(applicationForward);
Call_PushCell(author);
Call_PushString(message);
Call_PushCell(type);
Call_Finish(result);
if(result >= Plugin_Handled) {
return false;
}
// Compatibility
switch(type) {
case CCC_TagColor: return TagForward(author);
case CCC_NameColor: return NameForward(author);
case CCC_ChatColor: return ColorForward(author);
}
return true;
}
bool:ColorForward(author) {
new Action:result = Plugin_Continue;
Call_StartForward(colorForward);
Call_PushCell(author);
Call_Finish(result);
if(result >= Plugin_Handled) {
return false;
}
return true;
}
bool:NameForward(author) {
new Action:result = Plugin_Continue;
Call_StartForward(nameForward);
Call_PushCell(author);
Call_Finish(result);
if(result >= Plugin_Handled) {
return false;
}
return true;
}
bool:TagForward(author) {
new Action:result = Plugin_Continue;
Call_StartForward(tagForward);
Call_PushCell(author);
Call_Finish(result);
if(result >= Plugin_Handled) {
return false;
}
return true;
}
bool:ConfigForward(client) {
new Action:result = Plugin_Continue;
Call_StartForward(preLoadedForward);
Call_PushCell(client);
Call_Finish(result);
if(result >= Plugin_Handled) {
return false;
}
return true;
}
public Native_GetColor(Handle:plugin, numParams) {
new client = GetNativeCell(1);
if(client < 1 || client > MaxClients || !IsClientInGame(client)) {
ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
return COLOR_NONE;
}
new String:tempClr[3];
switch(GetNativeCell(2)) {
case CCC_TagColor: {
if(StrEqual(tagColor[client], "T", false)) {
SetNativeCellRef(3, false);
return COLOR_TEAM;
} else if(StrEqual(tagColor[client], "G", false)) {
SetNativeCellRef(3, false);
return COLOR_GREEN;
} else if(StrEqual(tagColor[client], "O", false)) {
SetNativeCellRef(3, false);
return COLOR_OLIVE;
} else if(strlen(tagColor[client]) == 6 || strlen(tagColor[client]) == 8) {
SetNativeCellRef(3, strlen(tagColor[client]) == 8);
return StringToInt(tagColor[client], 16);
} else if(strlen(tagColor[client]) == 4) {
SetNativeCellRef(3, false);
tempClr[0] = tagColor[client][1];
tempClr[1] = tagColor[client][2];
return StringToInt(tempClr, 16);
} else {
SetNativeCellRef(3, false);
return COLOR_NONE;
}
}
case CCC_NameColor: {
if(StrEqual(usernameColor[client], "G", false)) {
SetNativeCellRef(3, false);
return COLOR_GREEN;
} else if(StrEqual(usernameColor[client], "O", false)) {
SetNativeCellRef(3, false);
return COLOR_OLIVE;
} else if(strlen(usernameColor[client]) == 6 || strlen(usernameColor[client]) == 8) {
SetNativeCellRef(3, strlen(usernameColor[client]) == 8);
return StringToInt(usernameColor[client], 16);
} else if(strlen(usernameColor[client]) == 4) {
SetNativeCellRef(3, false);
tempClr[0] = usernameColor[client][1];
tempClr[1] = usernameColor[client][2];
return StringToInt(tempClr, 16);
} else {
SetNativeCellRef(3, false);
return COLOR_TEAM;
}
}
case CCC_ChatColor: {
if(StrEqual(chatColor[client], "T", false)) {
SetNativeCellRef(3, false);
return COLOR_TEAM;
} else if(StrEqual(chatColor[client], "G", false)) {
SetNativeCellRef(3, false);
return COLOR_GREEN;
} else if(StrEqual(chatColor[client], "O", false)) {
SetNativeCellRef(3, false);
return COLOR_OLIVE;
} else if(strlen(chatColor[client]) == 6 || strlen(chatColor[client]) == 8) {
SetNativeCellRef(3, strlen(chatColor[client]) == 8);
return StringToInt(chatColor[client], 16);
} else if(strlen(chatColor[client]) == 4) {
SetNativeCellRef(3, false);
tempClr[0] = chatColor[client][1];
tempClr[1] = chatColor[client][2];
return StringToInt(tempClr, 16);
} else {
SetNativeCellRef(3, false);
return COLOR_NONE;
}
}
}
return COLOR_NONE;
}
public Native_SetColor(Handle:plugin, numParams) {
new client = GetNativeCell(1);
if(client < 1 || client > MaxClients || !IsClientInGame(client)) {
ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
return false;
}
decl String:color[32];
if(GetNativeCell(3) < 0) {
switch(GetNativeCell(3)) {
case COLOR_GREEN: {
Format(color, sizeof(color), "G");
}
case COLOR_OLIVE: {
Format(color, sizeof(color), "O");
}
case COLOR_TEAM: {
Format(color, sizeof(color), "T");
}
case COLOR_NONE: {
Format(color, sizeof(color), "");
}
}
} else if(GetNativeCell(3) <= 16) {
Format(color, sizeof(color), "{%02X}", GetNativeCell(3));
} else {
if(!GetNativeCell(4)) {
// No alpha
Format(color, sizeof(color), "%06X", GetNativeCell(3));
} else {
// Alpha specified
Format(color, sizeof(color), "%08X", GetNativeCell(3));
}
}
if(strlen(color) != 4 && strlen(color) != 6 && strlen(color) != 8 && !StrEqual(color, "G", false) && !StrEqual(color, "O", false) && !StrEqual(color, "T", false)) {
return false;
}
switch(GetNativeCell(2)) {
case CCC_TagColor: {
strcopy(tagColor[client], sizeof(tagColor[]), color);
}
case CCC_NameColor: {
strcopy(usernameColor[client], sizeof(usernameColor[]), color);
}
case CCC_ChatColor: {
strcopy(chatColor[client], sizeof(chatColor[]), color);
}
}
return true;
}
public Native_GetTag(Handle:plugin, numParams) {
new client = GetNativeCell(1);
if(client < 1 || client > MaxClients || !IsClientInGame(client)) {
ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
return;
}
SetNativeString(2, tag[client], GetNativeCell(3));
}
public Native_SetTag(Handle:plugin, numParams) {
new client = GetNativeCell(1);
if(client < 1 || client > MaxClients || !IsClientInGame(client)) {
ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
return;
}
GetNativeString(2, tag[client], sizeof(tag[]));
}
public Native_ResetColor(Handle:plugin, numParams) {
new client = GetNativeCell(1);
if(client < 1 || client > MaxClients || !IsClientInGame(client)) {
ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
return;
}
switch(GetNativeCell(2)) {
case CCC_TagColor: {
strcopy(tagColor[client], sizeof(tagColor[]), defaultTagColor[client]);
}
case CCC_NameColor: {
strcopy(usernameColor[client], sizeof(usernameColor[]), defaultUsernameColor[client]);
}
case CCC_ChatColor: {
strcopy(chatColor[client], sizeof(chatColor[]), defaultChatColor[client]);
}
}
}
public Native_ResetTag(Handle:plugin, numParams) {
new client = GetNativeCell(1);
if(client < 1 || client > MaxClients || !IsClientInGame(client)) {
ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
return;
}
strcopy(tag[client], sizeof(tag[]), defaultTag[client]);
}