diff --git a/includes/admingroups.inc b/AdminGroups/scripting/include/AdminGroups.inc similarity index 100% rename from includes/admingroups.inc rename to AdminGroups/scripting/include/AdminGroups.inc diff --git a/BossHP/scripting/include/basic.inc b/BossHP/scripting/include/basic.inc deleted file mode 120000 index daafdbb..0000000 --- a/BossHP/scripting/include/basic.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/basic.inc \ No newline at end of file diff --git a/BossHP/scripting/include/outputinfo.inc b/BossHP/scripting/include/outputinfo.inc deleted file mode 120000 index 1667222..0000000 --- a/BossHP/scripting/include/outputinfo.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/outputinfo.inc \ No newline at end of file diff --git a/FixGameUI/scripting/include/dhooks.inc b/FixGameUI/scripting/include/dhooks.inc deleted file mode 120000 index 8b56a6f..0000000 --- a/FixGameUI/scripting/include/dhooks.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/dhooks.inc \ No newline at end of file diff --git a/KnifeAlert/scripting/include/morecolors.inc b/KnifeAlert/scripting/include/morecolors.inc deleted file mode 120000 index cd0d80e..0000000 --- a/KnifeAlert/scripting/include/morecolors.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/morecolors.inc \ No newline at end of file diff --git a/NapalmLagFix/scripting/include/dhooks.inc b/NapalmLagFix/scripting/include/dhooks.inc deleted file mode 120000 index 8b56a6f..0000000 --- a/NapalmLagFix/scripting/include/dhooks.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/dhooks.inc \ No newline at end of file diff --git a/NoGrenadeRinging/scripting/include/dhooks.inc b/NoGrenadeRinging/scripting/include/dhooks.inc deleted file mode 120000 index 8b56a6f..0000000 --- a/NoGrenadeRinging/scripting/include/dhooks.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/dhooks.inc \ No newline at end of file diff --git a/PointServerCommandFilter/scripting/include/pscd.inc b/PointServerCommandFilter/scripting/include/pscd.inc deleted file mode 120000 index 9a77849..0000000 --- a/PointServerCommandFilter/scripting/include/pscd.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/pscd.inc \ No newline at end of file diff --git a/ReservedSlot/scripting/include/AFKManager.inc b/ReservedSlot/scripting/include/AFKManager.inc deleted file mode 120000 index 4340bcb..0000000 --- a/ReservedSlot/scripting/include/AFKManager.inc +++ /dev/null @@ -1 +0,0 @@ -../../../AFKManager/scripting/include/AFKManager.inc \ No newline at end of file diff --git a/SaveLevel/scripting/include/outputinfo.inc b/SaveLevel/scripting/include/outputinfo.inc deleted file mode 120000 index 1667222..0000000 --- a/SaveLevel/scripting/include/outputinfo.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/outputinfo.inc \ No newline at end of file diff --git a/SelectiveBhop/scripting/include/CSSFixes.inc b/SelectiveBhop/scripting/include/CSSFixes.inc deleted file mode 120000 index aa0b499..0000000 --- a/SelectiveBhop/scripting/include/CSSFixes.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/CSSFixes.inc \ No newline at end of file diff --git a/SelfMute/scripting/include/AdvancedTargeting.inc b/SelfMute/scripting/include/AdvancedTargeting.inc deleted file mode 120000 index a49e950..0000000 --- a/SelfMute/scripting/include/AdvancedTargeting.inc +++ /dev/null @@ -1 +0,0 @@ -../../../AdvancedTargeting/scripting/include/AdvancedTargeting.inc \ No newline at end of file diff --git a/SelfMute/scripting/include/ccc.inc b/SelfMute/scripting/include/ccc.inc deleted file mode 120000 index bfe7ff4..0000000 --- a/SelfMute/scripting/include/ccc.inc +++ /dev/null @@ -1 +0,0 @@ -../../../custom-chatcolors/scripting/include/ccc.inc \ No newline at end of file diff --git a/SelfMute/scripting/include/voiceannounce_ex.inc b/SelfMute/scripting/include/voiceannounce_ex.inc deleted file mode 120000 index d46c000..0000000 --- a/SelfMute/scripting/include/voiceannounce_ex.inc +++ /dev/null @@ -1 +0,0 @@ -../../../voiceannounce_ex/scripting/include/voiceannounce_ex.inc \ No newline at end of file diff --git a/SelfMute/scripting/include/zombiereloaded.inc b/SelfMute/scripting/include/zombiereloaded.inc deleted file mode 120000 index c9a376e..0000000 --- a/SelfMute/scripting/include/zombiereloaded.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/zombiereloaded.inc \ No newline at end of file diff --git a/StopSound/scripting/include/multicolors.inc b/StopSound/scripting/include/multicolors.inc deleted file mode 100644 index cb69a30..0000000 --- a/StopSound/scripting/include/multicolors.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/multicolors.inc \ No newline at end of file diff --git a/ThirdPerson/scripting/include/FullUpdate.inc b/ThirdPerson/scripting/include/FullUpdate.inc deleted file mode 120000 index 45a4703..0000000 --- a/ThirdPerson/scripting/include/FullUpdate.inc +++ /dev/null @@ -1 +0,0 @@ -../../../FullUpdate/scripting/include/FullUpdate.inc \ No newline at end of file diff --git a/_ChatFilter/scripting/include/ccc.inc b/_ChatFilter/scripting/include/ccc.inc deleted file mode 100644 index e59c653..0000000 --- a/_ChatFilter/scripting/include/ccc.inc +++ /dev/null @@ -1,191 +0,0 @@ -/** - * This is the include file for Custom Chat Colors - * https://forums.alliedmods.net/showthread.php?t=186695 - * To check that Custom Chat Colors is installed and running, verify that the "ccc" library exists - */ - -#if defined _ccc_included - #endinput -#endif -#define _ccc_included - -enum CCC_ColorType { - CCC_TagColor, - CCC_NameColor, - CCC_ChatColor -}; - -#define COLOR_NULL -1 -#define COLOR_NONE -2 -#define COLOR_CGREEN -3 //0x40FF40 -#define COLOR_OLIVE -4 //0x99FF99 -#define COLOR_TEAM -5 - -/** - * Gets a client's color as a hexadecimal integer. - * - * @param client Client index - * @param type Color type to retreive - * @param alpha Pass a boolean variable by reference here and it will be true if the color has alpha specified or false if it doesn't (or is a stock color) - * @return Color as a hexadecimal integer (use %X in formatting to get a hexadecimal string) - * - * On error/errors: Invalid client index or client is not in game - */ -native int CCC_GetColor(int client, CCC_ColorType type, bool &alpha = false); - -/** - * Sets a client's color as a hexadecimal integer. - * - * @param client Client index - * @param type Color type to set - * @param color Integer representation of the color (use StringToInt(input, 16) to convert a hexadecimal string) or one of the color defines - * @param alpha Are you specifying a color with alpha? - * @return True if the color is updated successfully, false otherwise - * - * On error/errors: Invalid client index or client is not in game - */ -native int CCC_SetColor(int client, CCC_ColorType type, int color, bool alpha); - -/** - * Gets a client's tag - * - * @param client Client index - * @param buffer Buffer to store the tag in - * @param maxlen Maximum buffer length - * @noreturn - * - * On error/errors: Invalid client index or client is not in game - */ -native int CCC_GetTag(int client, char[] buffer, int maxlen); - -/** - * Sets a client's tag - * - * @param client Client index - * @param tag String containing the new tag - * @noreturn - * - * On error/errors: Invalid client index or client is not in game - */ -native void CCC_SetTag(int client, const char[] tag); - -/** - * Resets a client's color to the value in the config file. - * - * @param client Client index - * @param type Color type to restore - * @noreturn - * - * On error/errors: Invalid client index or client is not in game - */ -native int CCC_ResetColor(int client, CCC_ColorType type); - -/** - * Resets a client's tag to the value in the config file. - * - * @param client Client index - * @noreturn - * - * On error/errors: Invalid client index or client is not in game - */ -native int CCC_ResetTag(int client); - -/** - * Called when a cilent's name is about to be colored - * DO NOT START A NEW USERMESSAGE (i.e. PrintToChat, PrintToChatAll) WITHIN THIS FORWARD - * - * @param client Client index - * @return Plugin_Handled to prevent coloring, Plugin_Continue to allow coloring - */ -//#pragma deprecated Use CCC_OnColor instead -//forward Action:CCC_OnNameColor(client); - -/** - * Called when a client's chat is about to be colored - * DO NOT START A NEW USERMESSAGE (i.e. PrintToChat, PrintToChatAll) WITHIN THIS FORWARD - * - * @param client Client index - * @return Plugin_Handled to prevent coloring, Plugin_Continue to allow coloring - */ -//#pragma deprecated Use CCC_OnColor instead -//forward Action:CCC_OnChatColor(client); - -/** - * Called when a client's name is about to be tagged - * DO NOT START A NEW USERMESSAGE (i.e. PrintToChat, PrintToChatAll) WITHIN THIS FORWARD - * - * @param client Client index - * @return Plugin_Handled to prevent tagging, Plugin_Continue to allow tagging - */ -//#pragma deprecated Use CCC_OnColor instead -//forward Action:CCC_OnTagApplied(client); - -/** - * Called when a client's name is about to be tagged - * DO NOT START A NEW USERMESSAGE (i.e. PrintToChat, PrintToChatAll) WITHIN THIS FORWARD - * - * @param client Client index - * @param message Chat message that will be printed - * @param type What type of color will be applied. If this is CCC_TagColor, it controls whether the tag will be applied at all, not whether the tag will be colored. - * @return Plugin_Handled to prevent coloring, Plugin_Continue to allow coloring - */ -//forward Action:CCC_OnColor(client, const String:message[], CCC_ColorType:type); - -/** - * Called when a message has been fully colored and will be sent, unless further plugins modify it through Simple Chat Processor - * - * @param client Recieving client index - * @param author Author client index - * @param message Message - * @return Plugin_Handled to block message, Plugin_Continue to allow message - */ -forward Action CCC_OnChatMessage(int client, int author, const char[] message); - -/** - * Called when a client's colors and tag are about to be loaded from the config file - * At this point, the client has NO COLORS - * - * @param client Client index - * @return Plugin_Handled or Plugin_Stop to prevent loading, Plugin_Continue or Plugin_Changed to allow - */ -forward Action CCC_OnUserConfigPreLoaded(int client); - -/** - * Called when a client's colors and tag have been loaded from the config file - * - * @param client Client index - * @noreturn - */ -forward void CCC_OnUserConfigLoaded(int client); - -/** - * Called when the configuration file is reloaded with the sm_reloadccc command - * - * @noreturn - */ -forward void CCC_OnConfigReloaded(); - -native int CCC_UpdateIgnoredArray(bool IgnoredArray[(MAXPLAYERS + 1) * (MAXPLAYERS + 1)]); - -public SharedPlugin __pl_ccc = -{ - name = "ccc", - file = "custom-chatcolors.smx", -#if defined REQUIRE_PLUGIN - required = 1 -#else - required = 0 -#endif -}; - -#if !defined REQUIRE_PLUGIN -public __pl_ccc_SetNTVOptional() { - MarkNativeAsOptional("CCC_GetColor"); - MarkNativeAsOptional("CCC_SetColor"); - MarkNativeAsOptional("CCC_GetTag"); - MarkNativeAsOptional("CCC_ResetTag"); - MarkNativeAsOptional("CCC_ResetColor"); - MarkNativeAsOptional("CCC_ResetTag"); - MarkNativeAsOptional("CCC_UpdateIgnoredArray"); -} -#endif diff --git a/includes/calladmin.inc b/calladmin_restrictions/scripting/include/calladmin.inc similarity index 100% rename from includes/calladmin.inc rename to calladmin_restrictions/scripting/include/calladmin.inc diff --git a/custom-chatcolors/scripting/include/morecolors.inc b/custom-chatcolors/scripting/include/morecolors.inc deleted file mode 120000 index cd0d80e..0000000 --- a/custom-chatcolors/scripting/include/morecolors.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/morecolors.inc \ No newline at end of file diff --git a/hlstatsx/scripting/include/loghelper.inc b/hlstatsx/scripting/include/loghelper.inc index aafe0c5..04f6699 100644 --- a/hlstatsx/scripting/include/loghelper.inc +++ b/hlstatsx/scripting/include/loghelper.inc @@ -1,20 +1,20 @@ -#define LOGHELPER_VERSION 3 +#define LOGHELPER_VERSION 5 #include #include -new String:g_team_list[16][64]; +char g_team_list[16][64]; // Call this on map start to cache team names in g_team_list -stock GetTeams(bool:insmod = false) +stock void GetTeams(bool insmod = false) { if (!insmod) { - new max_teams_count = GetTeamCount(); - for (new team_index = 0; (team_index < max_teams_count); team_index++) + int max_teams_count = GetTeamCount(); + for (int team_index = 0; (team_index < max_teams_count); team_index++) { - decl String: team_name[64]; + char team_name[64]; GetTeamName(team_index, team_name, sizeof(team_name)); if (strcmp(team_name, "") != 0) @@ -26,7 +26,7 @@ stock GetTeams(bool:insmod = false) else { // they really need to get their act together... GetTeamName() would be awesome since they can't even keep their team indexes consistent - decl String:mapname[64]; + char mapname[64]; GetCurrentMap(mapname, sizeof(mapname)); if (strcmp(mapname, "ins_karam") == 0 || strcmp(mapname, "ins_baghdad") == 0) { @@ -43,53 +43,50 @@ stock GetTeams(bool:insmod = false) } } -stock LogPlayerEvent(client, const String:verb[], const String:event[], bool:display_location = false, const String:properties[] = "", iTeam=-1) +stock void LogPlayerEvent(int client, const char[] verb, const char[] event, bool display_location = false, const char[] properties = "") { if (IsValidPlayer(client)) { - decl String:player_authid[32]; - if (!GetClientAuthString(client, player_authid, sizeof(player_authid))) + char player_authid[32]; + if (!GetClientAuthId(client, AuthId_Engine, player_authid, sizeof(player_authid), false)) { strcopy(player_authid, sizeof(player_authid), "UNKNOWN"); } - if(iTeam == -1) - iTeam = GetClientTeam(client); - if (display_location) { - decl Float:player_origin[3]; + float player_origin[3]; GetClientAbsOrigin(client, player_origin); - LogToGame("\"%N<%d><%s><%s>\" %s \"%s\"%s (position \"%d %d %d\")", client, GetClientUserId(client), player_authid, g_team_list[iTeam], verb, event, properties, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2])); + LogToGame("\"%N<%d><%s><%s>\" %s \"%s\"%s (position \"%d %d %d\")", client, GetClientUserId(client), player_authid, g_team_list[GetClientTeam(client)], verb, event, properties, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2])); } else { - LogToGame("\"%N<%d><%s><%s>\" %s \"%s\"%s", client, GetClientUserId(client), player_authid, g_team_list[iTeam], verb, event, properties); + LogToGame("\"%N<%d><%s><%s>\" %s \"%s\"%s", client, GetClientUserId(client), player_authid, g_team_list[GetClientTeam(client)], verb, event, properties); } } } -stock LogPlyrPlyrEvent(client, victim, const String:verb[], const String:event[], bool:display_location = false, const String:properties[] = "") +stock void LogPlyrPlyrEvent(int client, int victim, const char[] verb, const char[] event, bool display_location = false, const char[] properties = "") { if (IsValidPlayer(client) && IsValidPlayer(victim)) { - decl String:player_authid[32]; - if (!GetClientAuthString(client, player_authid, sizeof(player_authid))) + char player_authid[32]; + if (!GetClientAuthId(client, AuthId_Engine, player_authid, sizeof(player_authid), false)) { strcopy(player_authid, sizeof(player_authid), "UNKNOWN"); } - decl String:victim_authid[32]; - if (!GetClientAuthString(victim, victim_authid, sizeof(victim_authid))) + char victim_authid[32]; + if (!GetClientAuthId(victim, AuthId_Engine, victim_authid, sizeof(victim_authid), false)) { strcopy(victim_authid, sizeof(victim_authid), "UNKNOWN"); } if (display_location) { - decl Float:player_origin[3]; + float player_origin[3]; GetClientAbsOrigin(client, player_origin); - decl Float:victim_origin[3]; + float victim_origin[3]; GetClientAbsOrigin(victim, victim_origin); LogToGame("\"%N<%d><%s><%s>\" %s \"%s\" against \"%N<%d><%s><%s>\"%s (position \"%d %d %d\") (victim_position \"%d %d %d\")", client, GetClientUserId(client), player_authid, g_team_list[GetClientTeam(client)], verb, event, victim, GetClientUserId(victim), victim_authid, g_team_list[GetClientTeam(victim)], properties, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); @@ -101,26 +98,26 @@ stock LogPlyrPlyrEvent(client, victim, const String:verb[], const String:event[] } } -stock LogKill(attacker, victim, const String:weapon[], bool:display_location = false, const String:properties[] = "") +stock void LogKill(int attacker, int victim, const char[] weapon, bool display_location = false, const char[] properties = "") { if (IsValidPlayer(attacker) && IsValidPlayer(victim)) { - decl String:attacker_authid[32]; - if (!GetClientAuthString(attacker, attacker_authid, sizeof(attacker_authid))) + char attacker_authid[32]; + if (!GetClientAuthId(attacker, AuthId_Engine, attacker_authid, sizeof(attacker_authid), false)) { strcopy(attacker_authid, sizeof(attacker_authid), "UNKNOWN"); } - decl String:victim_authid[32]; - if (!GetClientAuthString(victim, victim_authid, sizeof(victim_authid))) + char victim_authid[32]; + if (!GetClientAuthId(victim, AuthId_Engine, victim_authid, sizeof(victim_authid), false)) { strcopy(victim_authid, sizeof(victim_authid), "UNKNOWN"); } if (display_location) { - decl Float:attacker_origin[3]; + float attacker_origin[3]; GetClientAbsOrigin(attacker, attacker_origin); - decl Float:victim_origin[3]; + float victim_origin[3]; GetClientAbsOrigin(victim, victim_origin); LogToGame("\"%N<%d><%s><%s>\" killed \"%N<%d><%s><%s>\" with \"%s\"%s (attacker_position \"%d %d %d\") (victim_position \"%d %d %d\")", attacker, GetClientUserId(attacker), attacker_authid, g_team_list[GetClientTeam(attacker)], victim, GetClientUserId(victim), victim_authid, g_team_list[GetClientTeam(victim)], weapon, properties, RoundFloat(attacker_origin[0]), RoundFloat(attacker_origin[1]), RoundFloat(attacker_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); @@ -132,25 +129,49 @@ stock LogKill(attacker, victim, const String:weapon[], bool:display_location = f } } -// For Psychostats "KTRAJ" kill trajectory log lines -stock LogPSKillTraj(attacker, victim, const String:weapon[]) +stock void LogSuicide(int victim, const char[] weapon, bool display_location = false, const char[] properties = "") { - if (IsValidPlayer(attacker) && IsValidPlayer(victim)) + if (IsValidPlayer(victim)) { - decl String:attacker_authid[32]; - if (!GetClientAuthString(attacker, attacker_authid, sizeof(attacker_authid))) - { - strcopy(attacker_authid, sizeof(attacker_authid), "UNKNOWN"); - } - decl String:victim_authid[32]; - if (!GetClientAuthString(victim, victim_authid, sizeof(victim_authid))) + char victim_authid[32]; + if (!GetClientAuthId(victim, AuthId_Engine, victim_authid, sizeof(victim_authid), false)) { strcopy(victim_authid, sizeof(victim_authid), "UNKNOWN"); } - decl Float:attacker_origin[3]; + if (display_location) + { + float victim_origin[3]; + GetClientAbsOrigin(victim, victim_origin); + + LogToGame("\"%N<%d><%s><%s>\" committed suicide with \"%s\"%s (victim_position \"%d %d %d\")", victim, GetClientUserId(victim), victim_authid, g_team_list[GetClientTeam(victim)], weapon, properties, RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); + } + else + { + LogToGame("\"%N<%d><%s><%s>\" committed suicide with \"%s\"%s", victim, GetClientUserId(victim), victim_authid, g_team_list[GetClientTeam(victim)], weapon, properties); + } + } +} + +// For Psychostats "KTRAJ" kill trajectory log lines +stock void LogPSKillTraj(int attacker, int victim, const char[] weapon) +{ + if (IsValidPlayer(attacker) && IsValidPlayer(victim)) + { + char attacker_authid[32]; + if (!GetClientAuthId(attacker, AuthId_Engine, attacker_authid, sizeof(attacker_authid), false)) + { + strcopy(attacker_authid, sizeof(attacker_authid), "UNKNOWN"); + } + char victim_authid[32]; + if (!GetClientAuthId(victim, AuthId_Engine, victim_authid, sizeof(victim_authid), false)) + { + strcopy(victim_authid, sizeof(victim_authid), "UNKNOWN"); + } + + float attacker_origin[3]; GetClientAbsOrigin(attacker, attacker_origin); - decl Float:victim_origin[3]; + float victim_origin[3]; GetClientAbsOrigin(victim, victim_origin); LogToGame("[KTRAJ] \"%N<%d><%s><%s>\" killed \"%N<%d><%s><%s>\" with \"%s\" (attacker_position \"%d %d %d\") (victim_position \"%d %d %d\")", attacker, GetClientUserId(attacker), attacker_authid, g_team_list[GetClientTeam(attacker)], victim, GetClientUserId(victim), victim_authid, g_team_list[GetClientTeam(victim)], weapon, RoundFloat(attacker_origin[0]), RoundFloat(attacker_origin[1]), RoundFloat(attacker_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); @@ -158,7 +179,7 @@ stock LogPSKillTraj(attacker, victim, const String:weapon[]) } // Verb should always be "triggered" for this. -stock LogTeamEvent(team, const String:verb[], const String:event[], const String:properties[] = "") +stock void LogTeamEvent(int team, const char[] verb, const char[] event, const char[] properties = "") { if (team > -1) { @@ -166,32 +187,55 @@ stock LogTeamEvent(team, const String:verb[], const String:event[], const String } } -stock LogKillLoc(attacker, victim) +stock void LogKillLoc(int attacker, int victim) { if (attacker > 0 && victim > 0) { - decl Float:attacker_origin[3]; + float attacker_origin[3]; GetClientAbsOrigin(attacker, attacker_origin); - decl Float:victim_origin[3]; + float victim_origin[3]; GetClientAbsOrigin(victim, victim_origin); LogToGame("World triggered \"killlocation\" (attacker_position \"%d %d %d\") (victim_position \"%d %d %d\")", RoundFloat(attacker_origin[0]), RoundFloat(attacker_origin[1]), RoundFloat(attacker_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); } } -stock LogRoleChange(client, const String:role[], const String:properties[] = "") +stock void LogTeamChange(int client, int newteam, const char[] properties = "") { - LogPlayerEvent( client, "changed role to", role, false, properties ); + if (IsValidPlayer(client)) + { + char player_authid[32]; + if (!GetClientAuthId(client, AuthId_Engine, player_authid, sizeof(player_authid), false)) + { + strcopy(player_authid, sizeof(player_authid), "UNKNOWN"); + } + + LogToGame("\"%N<%d><%s><%s>\" joined team \"%s\"%s", client, GetClientUserId(client), player_authid, g_team_list[GetClientTeam(client)], g_team_list[newteam], properties); + } } -stock LogMapLoad() +stock void LogRoleChange(int client, const char[] role, const char[] properties = "") { - decl String:map[64]; + if (IsValidPlayer(client)) + { + char player_authid[32]; + if (!GetClientAuthId(client, AuthId_Engine, player_authid, sizeof(player_authid), false)) + { + strcopy(player_authid, sizeof(player_authid), "UNKNOWN"); + } + + LogToGame("\"%N<%d><%s><%s>\" changed role to \"%s\"%s", client, GetClientUserId(client), player_authid, g_team_list[GetClientTeam(client)], role, properties); + } +} + +stock void LogMapLoad() +{ + char map[64]; GetCurrentMap(map, sizeof(map)); LogToGame("Loading map \"%s\"", map); } -stock IsValidPlayer(client) +static stock bool IsValidPlayer(int client) { if (client > 0 && client <= MaxClients && IsClientInGame(client)) { diff --git a/includes/AntiBhopCheat.inc b/includes/AntiBhopCheat.inc deleted file mode 100644 index 0b968fb..0000000 --- a/includes/AntiBhopCheat.inc +++ /dev/null @@ -1,6 +0,0 @@ -#if defined _AntiBhopCheat_Included - #endinput -#endif -#define _AntiBhopCheat_Included - -forward void AntiBhopCheat_OnClientDetected(int client, char[] sReason, char[] sStats); \ No newline at end of file diff --git a/includes/entWatch.inc b/includes/entWatch.inc deleted file mode 100644 index 0e6a2f2..0000000 --- a/includes/entWatch.inc +++ /dev/null @@ -1,150 +0,0 @@ -#if defined _entWatch_include - #endinput -#endif -#define _entWatch_include - -/** - * Checks if a client is currently banned, if an integer variable is referenced the time of unban will be assigned to it. - * - * @param client Client index to check for ban - * @param iTimeStamp Pass an integer variable by reference and it will contain the UNIX timestamp when the player will be unbanned - * @return True if user is banned, false otherwise - * - * On error/errors: Invalid client index/client is not in game or client cookies are not yet loaded - */ -native bool:entWatch_IsClientBanned(client, &iTimeStamp); - -/** - * Bans a client from using special items. - * - * @param client Client index to ban - * @param IsTemporary If the ban should be temporary pass true here - * @param iLength Length of ban in minutes, pass 0 here for a permanent ban - * @return True on success, false otherwsie - * - * On error/errors: Invalid client index/client is not in game or client cookies are not yet loaded - */ -native bool:entWatch_BanClient(client, bool:bIsTemporary=false, iLength=0); - -/** - * Unbans a previously ebanned Client. - * - * @param client Client index to unban - * @return True on success, false otherwsie - * - * On error/errors: Invalid client index/client is not in game or client cookies are not yet loaded - */ -native bool:entWatch_UnbanClient(client); - -/** - * Checks if an entity is a special item. - * - * @param entity Entity index to check - * @return True if entity is a special item, false otherwsie - */ -native bool:entWatch_IsSpecialItem(entity); - -/** - * Checks if a client has a special item. - * - * @param client Client index to check - * @return True if client has a special item, false otherwsie - */ -native bool:entWatch_HasSpecialItem(client); - -/** - * Called when a client is e-banned by any means - * - * @param admin Admin index that issued the ban - * @param iLength Length of the ban in UNIX time - * @param client Client index that was banned - * - * @return None - */ -forward entWatch_OnClientBanned(admin, iLenght, client); - -/** - * Called when a client is e-unbanned by any means - * - * @param admin Admin index that removed the ban - * @param client Client index that was unbanned - * @return None - */ -forward entWatch_OnClientUnbanned(admin, client); - -//---------------------------------------------------------------------------------------------------- -// Purpose: SMLib -//---------------------------------------------------------------------------------------------------- -stock Entity_GetTargetName(entity, String:buffer[], size) -{ - return GetEntPropString(entity, Prop_Data, "m_iName", buffer, size); -} - -//---------------------------------------------------------------------------------------------------- -// Purpose: SMLib -//---------------------------------------------------------------------------------------------------- -stock Entity_GetParentName(entity, String:buffer[], size) -{ - return GetEntPropString(entity, Prop_Data, "m_iParent", buffer, size); -} - -//---------------------------------------------------------------------------------------------------- -// Purpose: SMLib -//---------------------------------------------------------------------------------------------------- -stock Entity_GetHammerID(entity) -{ - return GetEntProp(entity, Prop_Data, "m_iHammerID"); -} - -//---------------------------------------------------------------------------------------------------- -// Purpose: SMLib -//---------------------------------------------------------------------------------------------------- -stock Entity_GetClassName(entity, String:buffer[], size) -{ - GetEntPropString(entity, Prop_Data, "m_iClassname", buffer, size); - - if (buffer[0] == '\0') { - return false; - } - - return true; -} - -//---------------------------------------------------------------------------------------------------- -// Purpose: SMLib -//---------------------------------------------------------------------------------------------------- -stock Entity_GetEntityFromHammerID(hammerID) -{ - for (new i = 0; i < 4096; i++) - { - if (IsValidEntity(i) && Entity_GetHammerID(i) == hammerID) - { - if (IsValidEntity(i)) - return i; - } - } - - return -1; -} - -public SharedPlugin:__pl_entWatch = -{ - name = "entWatch", - file = "entWatch.smx", -#if defined REQUIRE_PLUGIN - required = 1 -#else - required = 0 -#endif -}; - -#if !defined REQUIRE_PLUGIN -public __pl_entWatch_SetNTVOptional() -{ - MarkNativeAsOptional("entWatch_IsClientBanned"); - MarkNativeAsOptional("entWatch_BanClient"); - MarkNativeAsOptional("entWatch_UnbanClient"); - MarkNativeAsOptional("entWatch_IsSpecialItem"); - MarkNativeAsOptional("entWatch_HasSpecialItem"); -} -#endif diff --git a/includes/loghelper.inc b/includes/loghelper.inc deleted file mode 100644 index 04f6699..0000000 --- a/includes/loghelper.inc +++ /dev/null @@ -1,245 +0,0 @@ -#define LOGHELPER_VERSION 5 - -#include -#include - -char g_team_list[16][64]; - -// Call this on map start to cache team names in g_team_list - -stock void GetTeams(bool insmod = false) -{ - if (!insmod) - { - int max_teams_count = GetTeamCount(); - for (int team_index = 0; (team_index < max_teams_count); team_index++) - { - char team_name[64]; - GetTeamName(team_index, team_name, sizeof(team_name)); - - if (strcmp(team_name, "") != 0) - { - g_team_list[team_index] = team_name; - } - } - } - else - { - // they really need to get their act together... GetTeamName() would be awesome since they can't even keep their team indexes consistent - char mapname[64]; - GetCurrentMap(mapname, sizeof(mapname)); - if (strcmp(mapname, "ins_karam") == 0 || strcmp(mapname, "ins_baghdad") == 0) - { - g_team_list[1] = "Iraqi Insurgents"; - g_team_list[2] = "U.S. Marines"; - } - else - { - g_team_list[1] = "U.S. Marines"; - g_team_list[2] = "Iraqi Insurgents"; - } - g_team_list[0] = "Unassigned"; - g_team_list[3] = "SPECTATOR"; - } -} - -stock void LogPlayerEvent(int client, const char[] verb, const char[] event, bool display_location = false, const char[] properties = "") -{ - if (IsValidPlayer(client)) - { - char player_authid[32]; - if (!GetClientAuthId(client, AuthId_Engine, player_authid, sizeof(player_authid), false)) - { - strcopy(player_authid, sizeof(player_authid), "UNKNOWN"); - } - - if (display_location) - { - float player_origin[3]; - GetClientAbsOrigin(client, player_origin); - LogToGame("\"%N<%d><%s><%s>\" %s \"%s\"%s (position \"%d %d %d\")", client, GetClientUserId(client), player_authid, g_team_list[GetClientTeam(client)], verb, event, properties, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2])); - } - else - { - LogToGame("\"%N<%d><%s><%s>\" %s \"%s\"%s", client, GetClientUserId(client), player_authid, g_team_list[GetClientTeam(client)], verb, event, properties); - } - } -} - -stock void LogPlyrPlyrEvent(int client, int victim, const char[] verb, const char[] event, bool display_location = false, const char[] properties = "") -{ - if (IsValidPlayer(client) && IsValidPlayer(victim)) - { - char player_authid[32]; - if (!GetClientAuthId(client, AuthId_Engine, player_authid, sizeof(player_authid), false)) - { - strcopy(player_authid, sizeof(player_authid), "UNKNOWN"); - } - char victim_authid[32]; - if (!GetClientAuthId(victim, AuthId_Engine, victim_authid, sizeof(victim_authid), false)) - { - strcopy(victim_authid, sizeof(victim_authid), "UNKNOWN"); - } - - if (display_location) - { - float player_origin[3]; - GetClientAbsOrigin(client, player_origin); - - float victim_origin[3]; - GetClientAbsOrigin(victim, victim_origin); - - LogToGame("\"%N<%d><%s><%s>\" %s \"%s\" against \"%N<%d><%s><%s>\"%s (position \"%d %d %d\") (victim_position \"%d %d %d\")", client, GetClientUserId(client), player_authid, g_team_list[GetClientTeam(client)], verb, event, victim, GetClientUserId(victim), victim_authid, g_team_list[GetClientTeam(victim)], properties, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); - } - else - { - LogToGame("\"%N<%d><%s><%s>\" %s \"%s\" against \"%N<%d><%s><%s>\"%s", client, GetClientUserId(client), player_authid, g_team_list[GetClientTeam(client)], verb, event, victim, GetClientUserId(victim), victim_authid, g_team_list[GetClientTeam(victim)], properties); - } - } -} - -stock void LogKill(int attacker, int victim, const char[] weapon, bool display_location = false, const char[] properties = "") -{ - if (IsValidPlayer(attacker) && IsValidPlayer(victim)) - { - char attacker_authid[32]; - if (!GetClientAuthId(attacker, AuthId_Engine, attacker_authid, sizeof(attacker_authid), false)) - { - strcopy(attacker_authid, sizeof(attacker_authid), "UNKNOWN"); - } - char victim_authid[32]; - if (!GetClientAuthId(victim, AuthId_Engine, victim_authid, sizeof(victim_authid), false)) - { - strcopy(victim_authid, sizeof(victim_authid), "UNKNOWN"); - } - - if (display_location) - { - float attacker_origin[3]; - GetClientAbsOrigin(attacker, attacker_origin); - float victim_origin[3]; - GetClientAbsOrigin(victim, victim_origin); - - LogToGame("\"%N<%d><%s><%s>\" killed \"%N<%d><%s><%s>\" with \"%s\"%s (attacker_position \"%d %d %d\") (victim_position \"%d %d %d\")", attacker, GetClientUserId(attacker), attacker_authid, g_team_list[GetClientTeam(attacker)], victim, GetClientUserId(victim), victim_authid, g_team_list[GetClientTeam(victim)], weapon, properties, RoundFloat(attacker_origin[0]), RoundFloat(attacker_origin[1]), RoundFloat(attacker_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); - } - else - { - LogToGame("\"%N<%d><%s><%s>\" killed \"%N<%d><%s><%s>\" with \"%s\"%s", attacker, GetClientUserId(attacker), attacker_authid, g_team_list[GetClientTeam(attacker)], victim, GetClientUserId(victim), victim_authid, g_team_list[GetClientTeam(victim)], weapon, properties); - } - } -} - -stock void LogSuicide(int victim, const char[] weapon, bool display_location = false, const char[] properties = "") -{ - if (IsValidPlayer(victim)) - { - char victim_authid[32]; - if (!GetClientAuthId(victim, AuthId_Engine, victim_authid, sizeof(victim_authid), false)) - { - strcopy(victim_authid, sizeof(victim_authid), "UNKNOWN"); - } - - if (display_location) - { - float victim_origin[3]; - GetClientAbsOrigin(victim, victim_origin); - - LogToGame("\"%N<%d><%s><%s>\" committed suicide with \"%s\"%s (victim_position \"%d %d %d\")", victim, GetClientUserId(victim), victim_authid, g_team_list[GetClientTeam(victim)], weapon, properties, RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); - } - else - { - LogToGame("\"%N<%d><%s><%s>\" committed suicide with \"%s\"%s", victim, GetClientUserId(victim), victim_authid, g_team_list[GetClientTeam(victim)], weapon, properties); - } - } -} - -// For Psychostats "KTRAJ" kill trajectory log lines -stock void LogPSKillTraj(int attacker, int victim, const char[] weapon) -{ - if (IsValidPlayer(attacker) && IsValidPlayer(victim)) - { - char attacker_authid[32]; - if (!GetClientAuthId(attacker, AuthId_Engine, attacker_authid, sizeof(attacker_authid), false)) - { - strcopy(attacker_authid, sizeof(attacker_authid), "UNKNOWN"); - } - char victim_authid[32]; - if (!GetClientAuthId(victim, AuthId_Engine, victim_authid, sizeof(victim_authid), false)) - { - strcopy(victim_authid, sizeof(victim_authid), "UNKNOWN"); - } - - float attacker_origin[3]; - GetClientAbsOrigin(attacker, attacker_origin); - float victim_origin[3]; - GetClientAbsOrigin(victim, victim_origin); - - LogToGame("[KTRAJ] \"%N<%d><%s><%s>\" killed \"%N<%d><%s><%s>\" with \"%s\" (attacker_position \"%d %d %d\") (victim_position \"%d %d %d\")", attacker, GetClientUserId(attacker), attacker_authid, g_team_list[GetClientTeam(attacker)], victim, GetClientUserId(victim), victim_authid, g_team_list[GetClientTeam(victim)], weapon, RoundFloat(attacker_origin[0]), RoundFloat(attacker_origin[1]), RoundFloat(attacker_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); - } -} - -// Verb should always be "triggered" for this. -stock void LogTeamEvent(int team, const char[] verb, const char[] event, const char[] properties = "") -{ - if (team > -1) - { - LogToGame("Team \"%s\" %s \"%s\"%s", g_team_list[team], verb, event, properties); - } -} - -stock void LogKillLoc(int attacker, int victim) -{ - if (attacker > 0 && victim > 0) - { - float attacker_origin[3]; - GetClientAbsOrigin(attacker, attacker_origin); - float victim_origin[3]; - GetClientAbsOrigin(victim, victim_origin); - - LogToGame("World triggered \"killlocation\" (attacker_position \"%d %d %d\") (victim_position \"%d %d %d\")", RoundFloat(attacker_origin[0]), RoundFloat(attacker_origin[1]), RoundFloat(attacker_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); - } -} - -stock void LogTeamChange(int client, int newteam, const char[] properties = "") -{ - if (IsValidPlayer(client)) - { - char player_authid[32]; - if (!GetClientAuthId(client, AuthId_Engine, player_authid, sizeof(player_authid), false)) - { - strcopy(player_authid, sizeof(player_authid), "UNKNOWN"); - } - - LogToGame("\"%N<%d><%s><%s>\" joined team \"%s\"%s", client, GetClientUserId(client), player_authid, g_team_list[GetClientTeam(client)], g_team_list[newteam], properties); - } -} - -stock void LogRoleChange(int client, const char[] role, const char[] properties = "") -{ - if (IsValidPlayer(client)) - { - char player_authid[32]; - if (!GetClientAuthId(client, AuthId_Engine, player_authid, sizeof(player_authid), false)) - { - strcopy(player_authid, sizeof(player_authid), "UNKNOWN"); - } - - LogToGame("\"%N<%d><%s><%s>\" changed role to \"%s\"%s", client, GetClientUserId(client), player_authid, g_team_list[GetClientTeam(client)], role, properties); - } -} - -stock void LogMapLoad() -{ - char map[64]; - GetCurrentMap(map, sizeof(map)); - LogToGame("Loading map \"%s\"", map); -} - -static stock bool IsValidPlayer(int client) -{ - if (client > 0 && client <= MaxClients && IsClientInGame(client)) - { - return true; - } - return false; -} \ No newline at end of file diff --git a/includes/morecolors.inc b/includes/morecolors.inc deleted file mode 100644 index 3a416d8..0000000 --- a/includes/morecolors.inc +++ /dev/null @@ -1,674 +0,0 @@ -// MOAR COLORS -// By Dr. McKay -// Inspired by: https://forums.alliedmods.net/showthread.php?t=96831 - -#if defined _colors_included - #endinput -#endif -#define _colors_included - -#include - -#define MORE_COLORS_VERSION "1.9.1" -#define MAX_MESSAGE_LENGTH 256 -#define MAX_BUFFER_LENGTH (MAX_MESSAGE_LENGTH * 4) - -#define COLOR_RED 0xFF4040 -#define COLOR_BLUE 0x99CCFF -#define COLOR_GRAY 0xCCCCCC -#define COLOR_GREEN 0x3EFF3E - -#define GAME_DODS 0 - -new bool:CSkipList[MAXPLAYERS + 1]; -new Handle:CTrie; -new CTeamColors[][] = {{0xCCCCCC, 0x4D7942, 0xFF4040}}; // Multi-dimensional array for games that don't support SayText2. First index is the game index (as defined by the GAME_ defines), second index is team. 0 = spectator, 1 = team1, 2 = team2 - -/** - * Prints a message to a specific client in the chat area. - * Supports color tags. - * - * @param client Client index. - * @param message Message (formatting rules). - * @noreturn - * - * On error/Errors: If the client is not connected an error will be thrown. - */ -stock CPrintToChat(client, const String:message[], any:...) { - CCheckTrie(); - if(client <= 0 || client > MaxClients) { - ThrowError("Invalid client index %i", client); - } - if(!IsClientInGame(client)) { - ThrowError("Client %i is not in game", client); - } - decl String:buffer[MAX_BUFFER_LENGTH], String:buffer2[MAX_BUFFER_LENGTH]; - SetGlobalTransTarget(client); - Format(buffer, sizeof(buffer), "\x01%s", message); - VFormat(buffer2, sizeof(buffer2), buffer, 3); - CReplaceColorCodes(buffer2); - CSendMessage(client, buffer2); -} - -/** - * Prints a message to all clients in the chat area. - * Supports color tags. - * - * @param client Client index. - * @param message Message (formatting rules). - * @noreturn - */ -stock CPrintToChatAll(const String:message[], any:...) { - CCheckTrie(); - decl String:buffer[MAX_BUFFER_LENGTH], String:buffer2[MAX_BUFFER_LENGTH]; - for(new i = 1; i <= MaxClients; i++) { - if(!IsClientInGame(i) || CSkipList[i]) { - CSkipList[i] = false; - continue; - } - SetGlobalTransTarget(i); - Format(buffer, sizeof(buffer), "\x01%s", message); - VFormat(buffer2, sizeof(buffer2), buffer, 2); - CReplaceColorCodes(buffer2); - CSendMessage(i, buffer2); - } -} - -/** - * Prints a message to a specific client in the chat area. - * Supports color tags and teamcolor tag. - * - * @param client Client index. - * @param author Author index whose color will be used for teamcolor tag. - * @param message Message (formatting rules). - * @noreturn - * - * On error/Errors: If the client or author are not connected an error will be thrown - */ -stock CPrintToChatEx(client, author, const String:message[], any:...) { - CCheckTrie(); - if(client <= 0 || client > MaxClients) { - ThrowError("Invalid client index %i", client); - } - if(!IsClientInGame(client)) { - ThrowError("Client %i is not in game", client); - } - if(author <= 0 || author > MaxClients) { - ThrowError("Invalid client index %i", author); - } - if(!IsClientInGame(author)) { - ThrowError("Client %i is not in game", author); - } - decl String:buffer[MAX_BUFFER_LENGTH], String:buffer2[MAX_BUFFER_LENGTH]; - SetGlobalTransTarget(client); - Format(buffer, sizeof(buffer), "\x01%s", message); - VFormat(buffer2, sizeof(buffer2), buffer, 4); - CReplaceColorCodes(buffer2, author); - CSendMessage(client, buffer2, author); -} - -/** - * Prints a message to all clients in the chat area. - * Supports color tags and teamcolor tag. - * - * @param author Author index whose color will be used for teamcolor tag. - * @param message Message (formatting rules). - * @noreturn - * - * On error/Errors: If the author is not connected an error will be thrown. - */ -stock CPrintToChatAllEx(author, const String:message[], any:...) { - CCheckTrie(); - if(author <= 0 || author > MaxClients) { - ThrowError("Invalid client index %i", author); - } - if(!IsClientInGame(author)) { - ThrowError("Client %i is not in game", author); - } - decl String:buffer[MAX_BUFFER_LENGTH], String:buffer2[MAX_BUFFER_LENGTH]; - for(new i = 1; i <= MaxClients; i++) { - if(!IsClientInGame(i) || CSkipList[i]) { - CSkipList[i] = false; - continue; - } - SetGlobalTransTarget(i); - Format(buffer, sizeof(buffer), "\x01%s", message); - VFormat(buffer2, sizeof(buffer2), buffer, 3); - CReplaceColorCodes(buffer2, author); - CSendMessage(i, buffer2, author); - } -} - -/** - * Sends a SayText2 usermessage - * - * @param client Client to send usermessage to - * @param message Message to send - * @noreturn - */ -stock CSendMessage(client, const String:message[], author=0) { - if(author == 0) { - author = client; - } - decl String:buffer[MAX_MESSAGE_LENGTH], String:game[16]; - GetGameFolderName(game, sizeof(game)); - strcopy(buffer, sizeof(buffer), message); - new UserMsg:index = GetUserMessageId("SayText2"); - if(index == INVALID_MESSAGE_ID) { - if(StrEqual(game, "dod")) { - new team = GetClientTeam(author); - if(team == 0) { - ReplaceString(buffer, sizeof(buffer), "\x03", "\x04", false); // Unassigned gets green - } else { - decl String:temp[16]; - Format(temp, sizeof(temp), "\x07%06X", CTeamColors[GAME_DODS][team - 1]); - ReplaceString(buffer, sizeof(buffer), "\x03", temp, false); - } - } - PrintToChat(client, "%s", buffer); - return; - } - new Handle:buf = StartMessageOne("SayText2", client, USERMSG_RELIABLE|USERMSG_BLOCKHOOKS); - if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf) { - PbSetInt(buf, "ent_idx", author); - PbSetBool(buf, "chat", true); - PbSetString(buf, "msg_name", buffer); - PbAddString(buf, "params", ""); - PbAddString(buf, "params", ""); - PbAddString(buf, "params", ""); - PbAddString(buf, "params", ""); - } else { - BfWriteByte(buf, author); // Message author - BfWriteByte(buf, true); // Chat message - BfWriteString(buf, buffer); // Message text - } - EndMessage(); -} - -/** - * This function should only be used right in front of - * CPrintToChatAll or CPrintToChatAllEx. It causes those functions - * to skip the specified client when printing the message. - * After printing the message, the client will no longer be skipped. - * - * @param client Client index - * @noreturn - */ -stock CSkipNextClient(client) { - if(client <= 0 || client > MaxClients) { - ThrowError("Invalid client index %i", client); - } - CSkipList[client] = true; -} - -/** - * Checks if the colors trie is initialized and initializes it if it's not (used internally) - * - * @return No return - */ -stock CCheckTrie() { - if(CTrie == INVALID_HANDLE) { - CTrie = InitColorTrie(); - } -} - -/** - * Replaces color tags in a string with color codes (used internally by CPrintToChat, CPrintToChatAll, CPrintToChatEx, and CPrintToChatAllEx - * - * @param buffer String. - * @param author Optional client index to use for {teamcolor} tags, or 0 for none - * @param removeTags Optional boolean value to determine whether we're replacing tags with colors, or just removing tags, used by CRemoveTags - * @param maxlen Optional value for max buffer length, used by CRemoveTags - * @noreturn - * - * On error/Errors: If the client index passed for author is invalid or not in game. - */ -stock CReplaceColorCodes(String:buffer[], author=0, bool:removeTags=false, maxlen=MAX_BUFFER_LENGTH) { - CCheckTrie(); - if(!removeTags) { - ReplaceString(buffer, maxlen, "{default}", "\x01", false); - } else { - ReplaceString(buffer, maxlen, "{default}", "", false); - ReplaceString(buffer, maxlen, "{teamcolor}", "", false); - } - if(author != 0 && !removeTags) { - if(author < 0 || author > MaxClients) { - ThrowError("Invalid client index %i", author); - } - if(!IsClientInGame(author)) { - ThrowError("Client %i is not in game", author); - } - ReplaceString(buffer, maxlen, "{teamcolor}", "\x03", false); - } - new cursor = 0; - new value; - decl String:tag[32], String:buff[32], String:output[maxlen]; - strcopy(output, maxlen, buffer); - // Since the string's size is going to be changing, output will hold the replaced string and we'll search buffer - - new Handle:regex = CompileRegex("{[a-zA-Z0-9]+}"); - for(new i = 0; i < 1000; i++) { // The RegEx extension is quite flaky, so we have to loop here :/. This loop is supposed to be infinite and broken by return, but conditions have been added to be safe. - if(MatchRegex(regex, buffer[cursor]) < 1) { - CloseHandle(regex); - strcopy(buffer, maxlen, output); - return; - } - GetRegexSubString(regex, 0, tag, sizeof(tag)); - CStrToLower(tag); - cursor = StrContains(buffer[cursor], tag, false) + cursor + 1; - strcopy(buff, sizeof(buff), tag); - ReplaceString(buff, sizeof(buff), "{", ""); - ReplaceString(buff, sizeof(buff), "}", ""); - - if(!GetTrieValue(CTrie, buff, value)) { - continue; - } - - if(removeTags) { - ReplaceString(output, maxlen, tag, "", false); - } else { - Format(buff, sizeof(buff), "\x07%06X", value); - ReplaceString(output, maxlen, tag, buff, false); - } - } - LogError("[MORE COLORS] Infinite loop broken."); -} - -/** - * Gets a part of a string - * - * @param input String to get the part from - * @param output Buffer to write to - * @param maxlen Max length of output buffer - * @param start Position to start at - * @param numChars Number of characters to return, or 0 for the end of the string - * @noreturn - */ -stock CSubString(const String:input[], String:output[], maxlen, start, numChars=0) { - new i = 0; - for(;;) { - if(i == maxlen - 1 || i >= numChars || input[start + i] == '\0') { - output[i] = '\0'; - return; - } - output[i] = input[start + i]; - i++; - } -} - -/** - * Converts a string to lowercase - * - * @param buffer String to convert - * @noreturn - */ -stock CStrToLower(String:buffer[]) { - new len = strlen(buffer); - for(new i = 0; i < len; i++) { - buffer[i] = CharToLower(buffer[i]); - } -} - -/** - * Adds a color to the colors trie - * - * @param name Color name, without braces - * @param color Hexadecimal representation of the color (0xRRGGBB) - * @return True if color was added successfully, false if a color already exists with that name - */ -stock bool:CAddColor(const String:name[], color) { - CCheckTrie(); - new value; - if(GetTrieValue(CTrie, name, value)) { - return false; - } - decl String:newName[64]; - strcopy(newName, sizeof(newName), name); - CStrToLower(newName); - SetTrieValue(CTrie, newName, color); - return true; -} - -/** - * Removes color tags from a message - * - * @param message Message to remove tags from - * @param maxlen Maximum buffer length - * @noreturn - */ -stock CRemoveTags(String:message[], maxlen) { - CReplaceColorCodes(message, 0, true, maxlen); -} - -/** - * Replies to a command with colors - * - * @param client Client to reply to - * @param message Message (formatting rules) - * @noreturn - */ -stock CReplyToCommand(client, const String:message[], any:...) { - decl String:buffer[MAX_BUFFER_LENGTH]; - SetGlobalTransTarget(client); - VFormat(buffer, sizeof(buffer), message, 3); - if(GetCmdReplySource() == SM_REPLY_TO_CONSOLE) { - CRemoveTags(buffer, sizeof(buffer)); - PrintToConsole(client, "%s", buffer); - } else { - CPrintToChat(client, "%s", buffer); - } -} - -/** - * Replies to a command with colors - * - * @param client Client to reply to - * @param author Client to use for {teamcolor} - * @param message Message (formatting rules) - * @noreturn - */ -stock CReplyToCommandEx(client, author, const String:message[], any:...) { - decl String:buffer[MAX_BUFFER_LENGTH]; - SetGlobalTransTarget(client); - VFormat(buffer, sizeof(buffer), message, 4); - if(GetCmdReplySource() == SM_REPLY_TO_CONSOLE) { - CRemoveTags(buffer, sizeof(buffer)); - PrintToConsole(client, "%s", buffer); - } else { - CPrintToChatEx(client, author, "%s", buffer); - } -} - -/** - * Shows admin activity with colors - * - * @param client Client performing an action - * @param message Message (formatting rules) - * @noreturn - */ -stock CShowActivity(client, const String:message[], any:...) { - CCheckTrie(); - if(client < 0 || client > MaxClients) { - ThrowError("Invalid client index %d", client); - } - if(client != 0 && !IsClientInGame(client)) { - ThrowError("Client %d is not in game", client); - } - decl String:buffer[MAX_BUFFER_LENGTH], String:buffer2[MAX_BUFFER_LENGTH]; - Format(buffer, sizeof(buffer), "\x01%s", message); - VFormat(buffer2, sizeof(buffer2), buffer, 3); - CReplaceColorCodes(buffer2); - ShowActivity(client, "%s", buffer2); -} - -/** - * Shows admin activity with colors - * - * @param client Client performing an action - * @param tag Tag to prepend to the message (color tags supported) - * @param message Message (formatting rules) - * @noreturn - */ -stock CShowActivityEx(client, const String:tag[], const String:message[], any:...) { - CCheckTrie(); - if(client < 0 || client > MaxClients) { - ThrowError("Invalid client index %d", client); - } - if(client != 0 && !IsClientInGame(client)) { - ThrowError("Client %d is not in game", client); - } - decl String:buffer[MAX_BUFFER_LENGTH], String:buffer2[MAX_BUFFER_LENGTH]; - Format(buffer, sizeof(buffer), "\x01%s", message); - VFormat(buffer2, sizeof(buffer2), buffer, 4); - CReplaceColorCodes(buffer2); - strcopy(buffer, sizeof(buffer), tag); - CReplaceColorCodes(buffer); - ShowActivityEx(client, tag, "%s", buffer2); -} - -/** - * Shows admin activity with colors - * - * @param client Client performing an action - * @param tag Tag to prepend to the message (color tags supported) - * @param message Message (formatting rules) - * @noreturn - */ -stock CShowActivity2(client, const String:tag[], const String:message[], any:...) { - CCheckTrie(); - if(client < 0 || client > MaxClients) { - ThrowError("Invalid client index %d", client); - } - if(client != 0 && !IsClientInGame(client)) { - ThrowError("Client %d is not in game", client); - } - decl String:buffer[MAX_BUFFER_LENGTH], String:buffer2[MAX_BUFFER_LENGTH]; - Format(buffer, sizeof(buffer), "\x01%s", message); - VFormat(buffer2, sizeof(buffer2), buffer, 4); - CReplaceColorCodes(buffer2); - strcopy(buffer, sizeof(buffer), tag); - CReplaceColorCodes(buffer); - ShowActivity2(client, buffer, "%s", buffer2); -} - -/** - * Determines whether a color name exists - * - * @param color The color name to check - * @return True if the color exists, false otherwise - */ -stock bool:CColorExists(const String:color[]) { - CCheckTrie(); - new temp; - return GetTrieValue(CTrie, color, temp); -} - -/** - * Returns the hexadecimal representation of a client's team color (will NOT initialize the trie) - * - * @param client Client to get the team color for - * @return Client's team color in hexadecimal, or green if unknown - * On error/Errors: If the client index passed is invalid or not in game. - */ -stock CGetTeamColor(client) { - if(client <= 0 || client > MaxClients) { - ThrowError("Invalid client index %i", client); - } - if(!IsClientInGame(client)) { - ThrowError("Client %i is not in game", client); - } - new value; - switch(GetClientTeam(client)) { - case 1: { - value = COLOR_GRAY; - } - case 2: { - value = COLOR_RED; - } - case 3: { - value = COLOR_BLUE; - } - default: { - value = COLOR_GREEN; - } - } - return value; -} - -stock Handle:InitColorTrie() { - new Handle:hTrie = CreateTrie(); - SetTrieValue(hTrie, "aliceblue", 0xF0F8FF); - SetTrieValue(hTrie, "allies", 0x4D7942); // same as Allies team in DoD:S - SetTrieValue(hTrie, "ancient", 0xEB4B4B); // same as Ancient item rarity in Dota 2 - SetTrieValue(hTrie, "antiquewhite", 0xFAEBD7); - SetTrieValue(hTrie, "aqua", 0x00FFFF); - SetTrieValue(hTrie, "aquamarine", 0x7FFFD4); - SetTrieValue(hTrie, "arcana", 0xADE55C); // same as Arcana item rarity in Dota 2 - SetTrieValue(hTrie, "axis", 0xFF4040); // same as Axis team in DoD:S - SetTrieValue(hTrie, "azure", 0x007FFF); - SetTrieValue(hTrie, "beige", 0xF5F5DC); - SetTrieValue(hTrie, "bisque", 0xFFE4C4); - SetTrieValue(hTrie, "black", 0x000000); - SetTrieValue(hTrie, "blanchedalmond", 0xFFEBCD); - SetTrieValue(hTrie, "blue", 0x99CCFF); // same as BLU/Counter-Terrorist team color - SetTrieValue(hTrie, "blueviolet", 0x8A2BE2); - SetTrieValue(hTrie, "brown", 0xA52A2A); - SetTrieValue(hTrie, "burlywood", 0xDEB887); - SetTrieValue(hTrie, "cadetblue", 0x5F9EA0); - SetTrieValue(hTrie, "chartreuse", 0x7FFF00); - SetTrieValue(hTrie, "chocolate", 0xD2691E); - SetTrieValue(hTrie, "collectors", 0xAA0000); // same as Collector's item quality in TF2 - SetTrieValue(hTrie, "common", 0xB0C3D9); // same as Common item rarity in Dota 2 - SetTrieValue(hTrie, "community", 0x70B04A); // same as Community item quality in TF2 - SetTrieValue(hTrie, "coral", 0xFF7F50); - SetTrieValue(hTrie, "cornflowerblue", 0x6495ED); - SetTrieValue(hTrie, "cornsilk", 0xFFF8DC); - SetTrieValue(hTrie, "corrupted", 0xA32C2E); // same as Corrupted item quality in Dota 2 - SetTrieValue(hTrie, "crimson", 0xDC143C); - SetTrieValue(hTrie, "cyan", 0x00FFFF); - SetTrieValue(hTrie, "darkblue", 0x00008B); - SetTrieValue(hTrie, "darkcyan", 0x008B8B); - SetTrieValue(hTrie, "darkgoldenrod", 0xB8860B); - SetTrieValue(hTrie, "darkgray", 0xA9A9A9); - SetTrieValue(hTrie, "darkgrey", 0xA9A9A9); - SetTrieValue(hTrie, "darkgreen", 0x006400); - SetTrieValue(hTrie, "darkkhaki", 0xBDB76B); - SetTrieValue(hTrie, "darkmagenta", 0x8B008B); - SetTrieValue(hTrie, "darkolivegreen", 0x556B2F); - SetTrieValue(hTrie, "darkorange", 0xFF8C00); - SetTrieValue(hTrie, "darkorchid", 0x9932CC); - SetTrieValue(hTrie, "darkred", 0x8B0000); - SetTrieValue(hTrie, "darksalmon", 0xE9967A); - SetTrieValue(hTrie, "darkseagreen", 0x8FBC8F); - SetTrieValue(hTrie, "darkslateblue", 0x483D8B); - SetTrieValue(hTrie, "darkslategray", 0x2F4F4F); - SetTrieValue(hTrie, "darkslategrey", 0x2F4F4F); - SetTrieValue(hTrie, "darkturquoise", 0x00CED1); - SetTrieValue(hTrie, "darkviolet", 0x9400D3); - SetTrieValue(hTrie, "deeppink", 0xFF1493); - SetTrieValue(hTrie, "deepskyblue", 0x00BFFF); - SetTrieValue(hTrie, "dimgray", 0x696969); - SetTrieValue(hTrie, "dimgrey", 0x696969); - SetTrieValue(hTrie, "dodgerblue", 0x1E90FF); - SetTrieValue(hTrie, "exalted", 0xCCCCCD); // same as Exalted item quality in Dota 2 - SetTrieValue(hTrie, "firebrick", 0xB22222); - SetTrieValue(hTrie, "floralwhite", 0xFFFAF0); - SetTrieValue(hTrie, "forestgreen", 0x228B22); - SetTrieValue(hTrie, "frozen", 0x4983B3); // same as Frozen item quality in Dota 2 - SetTrieValue(hTrie, "fuchsia", 0xFF00FF); - SetTrieValue(hTrie, "fullblue", 0x0000FF); - SetTrieValue(hTrie, "fullred", 0xFF0000); - SetTrieValue(hTrie, "gainsboro", 0xDCDCDC); - SetTrieValue(hTrie, "genuine", 0x4D7455); // same as Genuine item quality in TF2 - SetTrieValue(hTrie, "ghostwhite", 0xF8F8FF); - SetTrieValue(hTrie, "gold", 0xFFD700); - SetTrieValue(hTrie, "goldenrod", 0xDAA520); - SetTrieValue(hTrie, "gray", 0xCCCCCC); // same as spectator team color - SetTrieValue(hTrie, "grey", 0xCCCCCC); - SetTrieValue(hTrie, "green", 0x3EFF3E); - SetTrieValue(hTrie, "greenyellow", 0xADFF2F); - SetTrieValue(hTrie, "haunted", 0x38F3AB); // same as Haunted item quality in TF2 - SetTrieValue(hTrie, "honeydew", 0xF0FFF0); - SetTrieValue(hTrie, "hotpink", 0xFF69B4); - SetTrieValue(hTrie, "immortal", 0xE4AE33); // same as Immortal item rarity in Dota 2 - SetTrieValue(hTrie, "indianred", 0xCD5C5C); - SetTrieValue(hTrie, "indigo", 0x4B0082); - SetTrieValue(hTrie, "ivory", 0xFFFFF0); - SetTrieValue(hTrie, "khaki", 0xF0E68C); - SetTrieValue(hTrie, "lavender", 0xE6E6FA); - SetTrieValue(hTrie, "lavenderblush", 0xFFF0F5); - SetTrieValue(hTrie, "lawngreen", 0x7CFC00); - SetTrieValue(hTrie, "legendary", 0xD32CE6); // same as Legendary item rarity in Dota 2 - SetTrieValue(hTrie, "lemonchiffon", 0xFFFACD); - SetTrieValue(hTrie, "lightblue", 0xADD8E6); - SetTrieValue(hTrie, "lightcoral", 0xF08080); - SetTrieValue(hTrie, "lightcyan", 0xE0FFFF); - SetTrieValue(hTrie, "lightgoldenrodyellow", 0xFAFAD2); - SetTrieValue(hTrie, "lightgray", 0xD3D3D3); - SetTrieValue(hTrie, "lightgrey", 0xD3D3D3); - SetTrieValue(hTrie, "lightgreen", 0x99FF99); - SetTrieValue(hTrie, "lightpink", 0xFFB6C1); - SetTrieValue(hTrie, "lightsalmon", 0xFFA07A); - SetTrieValue(hTrie, "lightseagreen", 0x20B2AA); - SetTrieValue(hTrie, "lightskyblue", 0x87CEFA); - SetTrieValue(hTrie, "lightslategray", 0x778899); - SetTrieValue(hTrie, "lightslategrey", 0x778899); - SetTrieValue(hTrie, "lightsteelblue", 0xB0C4DE); - SetTrieValue(hTrie, "lightyellow", 0xFFFFE0); - SetTrieValue(hTrie, "lime", 0x00FF00); - SetTrieValue(hTrie, "limegreen", 0x32CD32); - SetTrieValue(hTrie, "linen", 0xFAF0E6); - SetTrieValue(hTrie, "magenta", 0xFF00FF); - SetTrieValue(hTrie, "maroon", 0x800000); - SetTrieValue(hTrie, "mediumaquamarine", 0x66CDAA); - SetTrieValue(hTrie, "mediumblue", 0x0000CD); - SetTrieValue(hTrie, "mediumorchid", 0xBA55D3); - SetTrieValue(hTrie, "mediumpurple", 0x9370D8); - SetTrieValue(hTrie, "mediumseagreen", 0x3CB371); - SetTrieValue(hTrie, "mediumslateblue", 0x7B68EE); - SetTrieValue(hTrie, "mediumspringgreen", 0x00FA9A); - SetTrieValue(hTrie, "mediumturquoise", 0x48D1CC); - SetTrieValue(hTrie, "mediumvioletred", 0xC71585); - SetTrieValue(hTrie, "midnightblue", 0x191970); - SetTrieValue(hTrie, "mintcream", 0xF5FFFA); - SetTrieValue(hTrie, "mistyrose", 0xFFE4E1); - SetTrieValue(hTrie, "moccasin", 0xFFE4B5); - SetTrieValue(hTrie, "mythical", 0x8847FF); // same as Mythical item rarity in Dota 2 - SetTrieValue(hTrie, "navajowhite", 0xFFDEAD); - SetTrieValue(hTrie, "navy", 0x000080); - SetTrieValue(hTrie, "normal", 0xB2B2B2); // same as Normal item quality in TF2 - SetTrieValue(hTrie, "oldlace", 0xFDF5E6); - SetTrieValue(hTrie, "olive", 0x9EC34F); - SetTrieValue(hTrie, "olivedrab", 0x6B8E23); - SetTrieValue(hTrie, "orange", 0xFFA500); - SetTrieValue(hTrie, "orangered", 0xFF4500); - SetTrieValue(hTrie, "orchid", 0xDA70D6); - SetTrieValue(hTrie, "palegoldenrod", 0xEEE8AA); - SetTrieValue(hTrie, "palegreen", 0x98FB98); - SetTrieValue(hTrie, "paleturquoise", 0xAFEEEE); - SetTrieValue(hTrie, "palevioletred", 0xD87093); - SetTrieValue(hTrie, "papayawhip", 0xFFEFD5); - SetTrieValue(hTrie, "peachpuff", 0xFFDAB9); - SetTrieValue(hTrie, "peru", 0xCD853F); - SetTrieValue(hTrie, "pink", 0xFFC0CB); - SetTrieValue(hTrie, "plum", 0xDDA0DD); - SetTrieValue(hTrie, "powderblue", 0xB0E0E6); - SetTrieValue(hTrie, "purple", 0x800080); - SetTrieValue(hTrie, "rare", 0x4B69FF); // same as Rare item rarity in Dota 2 - SetTrieValue(hTrie, "red", 0xFF4040); // same as RED/Terrorist team color - SetTrieValue(hTrie, "rosybrown", 0xBC8F8F); - SetTrieValue(hTrie, "royalblue", 0x4169E1); - SetTrieValue(hTrie, "saddlebrown", 0x8B4513); - SetTrieValue(hTrie, "salmon", 0xFA8072); - SetTrieValue(hTrie, "sandybrown", 0xF4A460); - SetTrieValue(hTrie, "seagreen", 0x2E8B57); - SetTrieValue(hTrie, "seashell", 0xFFF5EE); - SetTrieValue(hTrie, "selfmade", 0x70B04A); // same as Self-Made item quality in TF2 - SetTrieValue(hTrie, "sienna", 0xA0522D); - SetTrieValue(hTrie, "silver", 0xC0C0C0); - SetTrieValue(hTrie, "skyblue", 0x87CEEB); - SetTrieValue(hTrie, "slateblue", 0x6A5ACD); - SetTrieValue(hTrie, "slategray", 0x708090); - SetTrieValue(hTrie, "slategrey", 0x708090); - SetTrieValue(hTrie, "snow", 0xFFFAFA); - SetTrieValue(hTrie, "springgreen", 0x00FF7F); - SetTrieValue(hTrie, "steelblue", 0x4682B4); - SetTrieValue(hTrie, "strange", 0xCF6A32); // same as Strange item quality in TF2 - SetTrieValue(hTrie, "tan", 0xD2B48C); - SetTrieValue(hTrie, "teal", 0x008080); - SetTrieValue(hTrie, "thistle", 0xD8BFD8); - SetTrieValue(hTrie, "tomato", 0xFF6347); - SetTrieValue(hTrie, "turquoise", 0x40E0D0); - SetTrieValue(hTrie, "uncommon", 0xB0C3D9); // same as Uncommon item rarity in Dota 2 - SetTrieValue(hTrie, "unique", 0xFFD700); // same as Unique item quality in TF2 - SetTrieValue(hTrie, "unusual", 0x8650AC); // same as Unusual item quality in TF2 - SetTrieValue(hTrie, "valve", 0xA50F79); // same as Valve item quality in TF2 - SetTrieValue(hTrie, "vintage", 0x476291); // same as Vintage item quality in TF2 - SetTrieValue(hTrie, "violet", 0xEE82EE); - SetTrieValue(hTrie, "wheat", 0xF5DEB3); - SetTrieValue(hTrie, "white", 0xFFFFFF); - SetTrieValue(hTrie, "whitesmoke", 0xF5F5F5); - SetTrieValue(hTrie, "yellow", 0xFFFF00); - SetTrieValue(hTrie, "yellowgreen", 0x9ACD32); - return hTrie; -} \ No newline at end of file diff --git a/zr_repeatkill/scripting/include/zombiereloaded.inc b/zr_repeatkill/scripting/include/zombiereloaded.inc deleted file mode 120000 index c9a376e..0000000 --- a/zr_repeatkill/scripting/include/zombiereloaded.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/zombiereloaded.inc \ No newline at end of file