From 11aefe731b8733fbef6a56fa57c2c6fbb6927cbf Mon Sep 17 00:00:00 2001 From: BotoX Date: Tue, 26 Apr 2016 12:36:03 +0200 Subject: [PATCH] Added python scripts for easier compiling Fixed bunch of includes and a warnings Added ip addresses for admins to status KnifeAlert prints to everyone now if someone gets infected due to a knifed zombie Fixed WeaponCleaner not registering weapons if somebody disconnects Refactored custom-chatcolors to new syntax, added autoreplace and some fixes Added GFLClan.ru support to immunityreservedslots added nominate_removemap to mapchooser_extended and fixed a bug for recently played maps --- .../scripting/AdvancedTargeting.sp | 1 + .../scripting/include/AdvancedTargeting.inc | 4 +- AfkManager/scripting/AfkManager.sp | 123 +- ExtraCommands/scripting/ExtraCommands.sp | 17 +- ForceInputs/scripting/ForceInputs.sp | 4 +- KnifeAlert/scripting/KnifeAlert.sp | 10 +- NapalmLagFix/scripting/NapalmLagFix.sp | 2 +- .../ZE_FFVII_Mako_Reactor_V6_B08.cfg | 6 + SelfMute/scripting/SelfMute.sp | 124 +- Status/scripting/Status.sp | 10 +- WeaponCleaner/scripting/WeaponCleaner.sp | 69 +- WeaponEquip/scripting/WeaponEquip.sp | 4 +- compile-all.py | 37 + compile.py | 36 + .../configs/custom-chatcolorsreplace.cfg | 17 + .../scripting/custom-chatcolors.sp | 1881 ++++++++--------- custom-chatcolors/scripting/include/ccc.inc | 41 +- .../translations/allchat.phrases.txt | 25 +- .../scripting/immunityreserveslots_connect.sp | 135 +- .../scripting/include/connect.inc | 29 +- .../immunityreserveslots.phrases.txt | 115 + includes/GFLClanru.inc | 30 + includes/connect.inc | 41 + includes/updater.inc | 97 + includes/zombiereloaded.inc | 33 +- .../scripting/mapchooser_extended.sp | 7 +- .../scripting/nominations_extended.sp | 62 +- .../scripting/rockthevote_extended.sp | 2 +- .../mapchooser_extended.phrases.txt | 8 +- 29 files changed, 1639 insertions(+), 1331 deletions(-) create mode 100755 compile-all.py create mode 100755 compile.py create mode 100644 custom-chatcolors/configs/custom-chatcolorsreplace.cfg create mode 100644 immunityreserveslots/translations/immunityreserveslots.phrases.txt create mode 100644 includes/GFLClanru.inc create mode 100644 includes/connect.inc create mode 100644 includes/updater.inc diff --git a/AdvancedTargeting/scripting/AdvancedTargeting.sp b/AdvancedTargeting/scripting/AdvancedTargeting.sp index df938605..3962b904 100644 --- a/AdvancedTargeting/scripting/AdvancedTargeting.sp +++ b/AdvancedTargeting/scripting/AdvancedTargeting.sp @@ -253,6 +253,7 @@ public APIWebResponse(const char[] sData, int client) if(!Response.ImportFromString(sData, "SteamAPIResponse")) { LogError("ImportFromString(sData, \"SteamAPIResponse\") failed."); + delete Response; return; } diff --git a/AdvancedTargeting/scripting/include/AdvancedTargeting.inc b/AdvancedTargeting/scripting/include/AdvancedTargeting.inc index 85d3c5bb..8ffd3ad2 100644 --- a/AdvancedTargeting/scripting/include/AdvancedTargeting.inc +++ b/AdvancedTargeting/scripting/include/AdvancedTargeting.inc @@ -6,7 +6,7 @@ native int IsClientFriend(int client, int friend); native int ReadClientFriends(int client); -public SharedPlugin:__pl_AdvancedTargeting = +public SharedPlugin __pl_AdvancedTargeting = { name = "AdvancedTargeting", file = "AdvancedTargeting.smx", @@ -18,7 +18,7 @@ public SharedPlugin:__pl_AdvancedTargeting = }; #if !defined REQUIRE_PLUGIN -public __pl_myfile_SetNTVOptional() +public __pl_AdvancedTargeting_SetNTVOptional() { MarkNativeAsOptional("IsClientFriend"); MarkNativeAsOptional("ReadClientFriends"); diff --git a/AfkManager/scripting/AfkManager.sp b/AfkManager/scripting/AfkManager.sp index 037f0690..c454a6e9 100644 --- a/AfkManager/scripting/AfkManager.sp +++ b/AfkManager/scripting/AfkManager.sp @@ -26,36 +26,36 @@ public Plugin myinfo = name = "Good AFK Manager", author = "BotoX", description = "A good AFK manager?", - version = "1.0", + version = "1.1", url = "" }; -public Cvar_KickTime(Handle:cvar, const String:oldvalue[], const String:newvalue[]) +public void Cvar_KickTime(Handle:cvar, const char[] oldvalue, const char[] newvalue) { g_fKickTime = GetConVarFloat(cvar); } -public Cvar_MoveTime(Handle:cvar, const String:oldvalue[], const String:newvalue[]) +public void Cvar_MoveTime(Handle:cvar, const char[] oldvalue, const char[] newvalue) { g_fMoveTime = GetConVarFloat(cvar); } -public Cvar_WarnTime(Handle:cvar, const String:oldvalue[], const String:newvalue[]) +public void Cvar_WarnTime(Handle:cvar, const char[] oldvalue, const char[] newvalue) { g_fWarnTime = GetConVarFloat(cvar); } -public Cvar_KickMinPlayers(Handle:cvar, const String:oldvalue[], const String:newvalue[]) +public void Cvar_KickMinPlayers(Handle:cvar, const char[] oldvalue, const char[] newvalue) { g_iKickMinPlayers = GetConVarInt(cvar); } -public Cvar_MoveMinPlayers(Handle:cvar, const String:oldvalue[], const String:newvalue[]) +public void Cvar_MoveMinPlayers(Handle:cvar, const char[] oldvalue, const char[] newvalue) { g_iMoveMinPlayers = GetConVarInt(cvar); } -public Cvar_Immunity(Handle:cvar, const String:oldvalue[], const String:newvalue[]) +public void Cvar_Immunity(Handle:cvar, const char[] oldvalue, const char[] newvalue) { g_iImmunity = GetConVarInt(cvar); } -public OnPluginStart() +public void OnPluginStart() { Handle cvar; HookConVarChange((cvar = CreateConVar("sm_afk_move_min", "4", "Min players for AFK move")), Cvar_MoveMinPlayers); @@ -85,24 +85,21 @@ public OnPluginStart() AutoExecConfig(true, "plugin.AfkManager"); } -public OnMapStart() +public void OnMapStart() { CreateTimer(AFK_CHECK_INTERVAL, Timer_CheckPlayer, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); - for (int Index = 1; Index <= MaxClients; Index++) - { - g_Players_bEnabled[Index] = false; - if (IsClientConnected(Index) && IsClientInGame(Index) && !IsFakeClient(Index)) - InitializePlayer(Index); - } } -CheckAdminImmunity(Index) +int CheckAdminImmunity(int Index) { + if(!IsClientAuthorized(Index)) + return false; + AdminId Id = GetUserAdmin(Index); return GetAdminFlag(Id, Admin_Generic); } -ResetPlayer(Index) +void ResetPlayer(int Index) { g_Players_bEnabled[Index] = false; g_Players_bFlagged[Index] = false; @@ -113,9 +110,9 @@ ResetPlayer(Index) g_Players_iSpecTarget[Index] = 0; } -InitializePlayer(Index) +void InitializePlayer(int Index) { - if (!(g_iImmunity == 1 && CheckAdminImmunity(Index))) + if(!(g_iImmunity == 1 && CheckAdminImmunity(Index))) { ResetPlayer(Index); g_Players_iLastAction[Index] = GetTime(); @@ -123,36 +120,37 @@ InitializePlayer(Index) } } -public OnClientPostAdminCheck(Index) +public void OnClientConnected(int client) { - if (!IsFakeClient(Index)) + ResetPlayer(client); +} + +public void OnClientPostAdminCheck(int Index) +{ + if(!IsFakeClient(Index)) InitializePlayer(Index); } -public OnClientDisconnect(Index) +public void OnClientDisconnect(int Index) { ResetPlayer(Index); } -public Action:Event_PlayerTeamPost(Handle:event, const String:name[], bool:dontBroadcast) +public Action Event_PlayerTeamPost(Handle event, const char[] name, bool dontBroadcast) { int Index = GetClientOfUserId(GetEventInt(event, "userid")); - if (Index > 0 && !IsFakeClient(Index)) - { - if (!g_Players_bEnabled[Index]) - InitializePlayer(Index); + if(Index > 0 && !IsFakeClient(Index)) g_Players_iLastAction[Index] = GetTime(); - } } -public Action:Command_Say(Index, const String:Command[], Args) +public Action Command_Say(Index, const char[] Command, Args) { g_Players_iLastAction[Index] = GetTime(); } -public Action:OnPlayerRunCmd(Index, &iButtons, &iImpulse, Float:fVel[3], Float:fAngles[3], &iWeapon) +public Action OnPlayerRunCmd(int Index, int &iButtons, int &iImpulse, float fVel[3], float fAngles[3], int &iWeapon) { - if (((g_Players_fEyePosition[Index][0] != fAngles[0]) || + if(((g_Players_fEyePosition[Index][0] != fAngles[0]) || (g_Players_fEyePosition[Index][1] != fAngles[1]) || (g_Players_fEyePosition[Index][2] != fAngles[2])) && g_Players_iSpecMode[Index] != 4) // OBS_MODE_IN_EYE @@ -172,33 +170,33 @@ public Action:OnPlayerRunCmd(Index, &iButtons, &iImpulse, Float:fVel[3], Float:f return Plugin_Continue; } -public Action:Timer_CheckPlayer(Handle:Timer, any:Data) +public Action Timer_CheckPlayer(Handle Timer, any Data) { int Index; int Clients = 0; - for (Index = 1; Index <= MaxClients; Index++) + for(Index = 1; Index <= MaxClients; Index++) { - if (IsClientInGame(Index) && !IsFakeClient(Index)) + if(IsClientInGame(Index) && !IsFakeClient(Index)) Clients++; } bool bMovePlayers = (Clients >= g_iMoveMinPlayers && g_fMoveTime > 0.0); bool bKickPlayers = (Clients >= g_iKickMinPlayers && g_fKickTime > 0.0); - if (!bMovePlayers && !bKickPlayers) + if(!bMovePlayers && !bKickPlayers) return Plugin_Continue; - for (Index = 1; Index <= MaxClients; Index++) + for(Index = 1; Index <= MaxClients; Index++) { - if (!g_Players_bEnabled[Index] || !IsClientInGame(Index)) // Is this player actually in the game? + if(!g_Players_bEnabled[Index] || !IsClientInGame(Index)) continue; int iTeamNum = GetClientTeam(Index); - if (IsClientObserver(Index)) + if(IsClientObserver(Index)) { - if (iTeamNum > CS_TEAM_SPECTATOR && !IsPlayerAlive(Index)) + if(iTeamNum > CS_TEAM_SPECTATOR && !IsPlayerAlive(Index)) continue; int iSpecMode = g_Players_iSpecMode[Index]; @@ -207,68 +205,66 @@ public Action:Timer_CheckPlayer(Handle:Timer, any:Data) g_Players_iSpecMode[Index] = GetEntProp(Index, Prop_Send, "m_iObserverMode"); g_Players_iSpecTarget[Index] = GetEntPropEnt(Index, Prop_Send, "m_hObserverTarget"); - if ((iSpecMode && g_Players_iSpecMode[Index] != iSpecMode) || (iSpecTarget && g_Players_iSpecTarget[Index] != iSpecTarget)) + if((iSpecMode && g_Players_iSpecMode[Index] != iSpecMode) || (iSpecTarget && g_Players_iSpecTarget[Index] != iSpecTarget)) g_Players_iLastAction[Index] = GetTime(); } int IdleTime = GetTime() - g_Players_iLastAction[Index]; - if (g_Players_bFlagged[Index] && (g_fKickTime - IdleTime) > 0.0) + if(g_Players_bFlagged[Index] && (g_fKickTime - IdleTime) > 0.0) { PrintCenterText(Index, "Welcome back!"); - PrintToChat(Index, "\x04[AFK] \x01You have been un-flagged for being inactive."); + PrintToChat(Index, "\x04[AFK]\x01 You have been un-flagged for being inactive."); g_Players_bFlagged[Index] = false; } - if (bMovePlayers && iTeamNum > CS_TEAM_SPECTATOR && ( !g_iImmunity || g_iImmunity == 2 || !CheckAdminImmunity(Index))) + if(bMovePlayers && iTeamNum > CS_TEAM_SPECTATOR && (!g_iImmunity || g_iImmunity == 2 || !CheckAdminImmunity(Index))) { float iTimeleft = g_fMoveTime - IdleTime; - if (iTimeleft > 0.0) + if(iTimeleft > 0.0) { if(iTimeleft <= g_fWarnTime) { PrintCenterText(Index, "Warning: If you do not move in %d seconds, you will be moved to spectate.", RoundToFloor(iTimeleft)); - PrintToChat(Index, "\x04[AFK] \x01Warning: If you do not move in %d seconds, you will be moved to spectate.", RoundToFloor(iTimeleft)); + PrintToChat(Index, "\x04[AFK]\x01 Warning: If you do not move in %d seconds, you will be moved to spectate.", RoundToFloor(iTimeleft)); } } else { - decl String:f_Name[MAX_NAME_LENGTH+4]; - Format(f_Name, sizeof(f_Name), "\x03%N\x01", Index); - PrintToChatAll("\x04[AFK] \x01%s was moved to spectate for being AFK too long.", f_Name); + PrintToChatAll("\x04[AFK] \x03%N\x01 was moved to spectate for being AFK too long.", Index); ForcePlayerSuicide(Index); ChangeClientTeam(Index, CS_TEAM_SPECTATOR); } } - else if (g_fKickTime > 0.0 && (!g_iImmunity || g_iImmunity == 3 || !CheckAdminImmunity(Index))) + else if(g_fKickTime > 0.0 && (!g_iImmunity || g_iImmunity == 3 || !CheckAdminImmunity(Index))) { float iTimeleft = g_fKickTime - IdleTime; - if (iTimeleft > 0.0) + if(iTimeleft > 0.0) { - if (iTimeleft <= g_fWarnTime) + if(iTimeleft <= g_fWarnTime) { PrintCenterText(Index, "Warning: If you do not move in %d seconds, you will be kick-flagged for being inactive.", RoundToFloor(iTimeleft)); - PrintToChat(Index, "\x04[AFK] \x01Warning: If you do not move in %d seconds, you will be kick-flagged for being inactive.", RoundToFloor(iTimeleft)); + PrintToChat(Index, "\x04[AFK]\x01 Warning: If you do not move in %d seconds, you will be kick-flagged for being inactive.", RoundToFloor(iTimeleft)); } } else { - if (!g_Players_bFlagged[Index]) + if(!g_Players_bFlagged[Index]) { - PrintToChat(Index, "\x04[AFK] \x01You have been kick-flagged for being inactive."); + PrintToChat(Index, "\x04[AFK]\x01 You have been kick-flagged for being inactive."); g_Players_bFlagged[Index] = true; } int FlaggedPlayers = 0; int Position = 1; - for (int Index_ = 1; Index_ <= MaxClients; Index_++) + for(int Index_ = 1; Index_ <= MaxClients; Index_++) { - if (!g_Players_bFlagged[Index_]) + if(!g_Players_bFlagged[Index_]) continue; FlaggedPlayers++; int IdleTime_ = GetTime() - g_Players_iLastAction[Index_]; - if (IdleTime_ > IdleTime) + if(IdleTime_ > IdleTime) Position++; } PrintCenterText(Index, "You have been kick-flagged for being inactive. [%d/%d]", Position, FlaggedPlayers); @@ -281,27 +277,24 @@ public Action:Timer_CheckPlayer(Handle:Timer, any:Data) int InactivePlayer = -1; int InactivePlayerTime = 0; - for (Index = 1; Index <= MaxClients; Index++) + for(Index = 1; Index <= MaxClients; Index++) { - if (!g_Players_bFlagged[Index]) + if(!g_Players_bEnabled[Index] || !g_Players_bFlagged[Index]) continue; int IdleTime = GetTime() - g_Players_iLastAction[Index]; - - if (IdleTime > InactivePlayerTime) + if(IdleTime >= g_fKickTime && IdleTime > InactivePlayerTime) { InactivePlayer = Index; InactivePlayerTime = IdleTime; } } - if (InactivePlayer == -1) + if(InactivePlayer == -1) break; else { - decl String:f_Name[MAX_NAME_LENGTH+4]; - Format(f_Name, sizeof(f_Name), "\x03%N\x01", InactivePlayer); - PrintToChatAll("\x04[AFK] %s was kicked for being AFK too long. (%d seconds)", f_Name, InactivePlayerTime); + PrintToChatAll("\x04[AFK] \x03%N\x01 was kicked for being AFK too long. (%d seconds)", InactivePlayer, InactivePlayerTime); KickClient(InactivePlayer, "[AFK] You were kicked for being AFK too long. (%d seconds)", InactivePlayerTime); Clients--; g_Players_bFlagged[InactivePlayer] = false; diff --git a/ExtraCommands/scripting/ExtraCommands.sp b/ExtraCommands/scripting/ExtraCommands.sp index 9ab3478e..ae01d5d1 100644 --- a/ExtraCommands/scripting/ExtraCommands.sp +++ b/ExtraCommands/scripting/ExtraCommands.sp @@ -27,13 +27,13 @@ public OnPluginStart() { LoadTranslations("common.phrases"); RegAdminCmd("sm_hp", Command_Health, ADMFLAG_GENERIC, "sm_hp <#userid|name> "); - RegAdminCmd("sm_kevlar", Command_Kevlar, ADMFLAG_GENERIC, "sm_kevlar <#userid|name> "); + RegAdminCmd("sm_armor", Command_Armor, ADMFLAG_GENERIC, "sm_armor <#userid|name> "); RegAdminCmd("sm_weapon", Command_Weapon, ADMFLAG_GENERIC, "sm_weapon <#userid|name> [clip] [ammo]"); RegAdminCmd("sm_give", Command_Weapon, ADMFLAG_GENERIC, "sm_give <#userid|name> [clip] [ammo]"); RegAdminCmd("sm_strip", Command_Strip, ADMFLAG_GENERIC, "sm_strip <#userid|name>"); - RegAdminCmd("sm_buyzone", Command_BuyZone, ADMFLAG_CUSTOM3, "sm_buyzone <#userid|name> <0|1>"); - RegAdminCmd("sm_iammo", Command_InfAmmo, ADMFLAG_CUSTOM3, "sm_iammo <#userid|name> <0|1>"); - RegAdminCmd("sm_speed", Command_Speed, ADMFLAG_CUSTOM3, "sm_speed <#userid|name> <0|1>"); + RegAdminCmd("sm_buyzone", Command_BuyZone, ADMFLAG_GENERIC, "sm_buyzone <#userid|name> <0|1>"); + RegAdminCmd("sm_iammo", Command_InfAmmo, ADMFLAG_GENERIC, "sm_iammo <#userid|name> <0|1>"); + RegAdminCmd("sm_speed", Command_Speed, ADMFLAG_GENERIC, "sm_speed <#userid|name> <0|1>"); HookEvent("bomb_planted", Event_BombPlanted, EventHookMode_Pre); HookEvent("bomb_defused", Event_BombDefused, EventHookMode_Pre); @@ -229,11 +229,11 @@ public Action:Command_Health(client, args) return Plugin_Handled; } -public Action:Command_Kevlar(client, args) +public Action:Command_Armor(client, args) { if(args < 2) { - ReplyToCommand(client, "[SM] Usage: sm_kevlar <#userid|name> "); + ReplyToCommand(client, "[SM] Usage: sm_armor <#userid|name> "); return Plugin_Handled; } @@ -365,6 +365,11 @@ public Action:Command_Weapon(client, args) for(new i = 0; i < target_count; i++) SetEntProp(target_list[i], Prop_Send, "m_bHasNightVision", 1, 1); } + else if(StrEqual(weapon, "item_defuser", false)) + { + for(new i = 0; i < target_count; i++) + SetEntProp(target_list[i], Prop_Send, "m_bHasDefuser", 1); + } else { for(new i = 0; i < target_count; i++) diff --git a/ForceInputs/scripting/ForceInputs.sp b/ForceInputs/scripting/ForceInputs.sp index 7f501fd1..159d4f0e 100644 --- a/ForceInputs/scripting/ForceInputs.sp +++ b/ForceInputs/scripting/ForceInputs.sp @@ -25,6 +25,8 @@ public Plugin:myinfo = //---------------------------------------------------------------------------------------------------- public OnPluginStart() { + LoadTranslations("common.phrases"); + RegAdminCmd("sm_forceinput", Command_ForceInput, ADMFLAG_ROOT); RegAdminCmd("sm_forceinputplayer", Command_ForceInputPlayer, ADMFLAG_ROOT); } @@ -53,7 +55,7 @@ public Action:Command_ForceInputPlayer(client, args) client, target_list, MAXPLAYERS, - COMMAND_FILTER_ALIVE, + 0, target_name, sizeof(target_name), tn_is_ml)) <= 0) diff --git a/KnifeAlert/scripting/KnifeAlert.sp b/KnifeAlert/scripting/KnifeAlert.sp index 504998fa..00e875fd 100644 --- a/KnifeAlert/scripting/KnifeAlert.sp +++ b/KnifeAlert/scripting/KnifeAlert.sp @@ -14,7 +14,7 @@ public Plugin myinfo = name = "Knife Notifications", author = "Obus + BotoX", description = "Notify administrators when zombies have been knifed by humans.", - version = "2.1", + version = "2.2", url = "" }; @@ -106,12 +106,8 @@ public Action Event_PlayerHurt(Handle hEvent, const char[] name, bool dontBroadc else LogMessage("%L killed %L (Recently knifed by a disconnected player [%s])", attacker, victim, g_sAttackerSID[attacker]); - for(int i = 1; i <= MaxClients; i++) - { - if(IsClientConnected(i) && IsClientInGame(i) && (IsClientSourceTV(i) || GetAdminFlag(GetUserAdmin(i), Admin_Generic))) - CPrintToChat(i, "{green}[SM] {red}%N {green}(%s){default} killed {blue}%N{default} - knifed by {blue}%s {green}(%s)", - attacker, sAtkSID, victim, (pOldKnifer != -1) ? sAtkAttackerName : "a disconnected player", g_sAttackerSID[attacker]); - } + CPrintToChatAll("{green}[SM] {red}%N {green}(%s){default} killed {blue}%N{default} - knifed by {blue}%s {green}(%s)", + attacker, sAtkSID, victim, (pOldKnifer != -1) ? sAtkAttackerName : "a disconnected player", g_sAttackerSID[attacker]); } } } diff --git a/NapalmLagFix/scripting/NapalmLagFix.sp b/NapalmLagFix/scripting/NapalmLagFix.sp index b360008a..811c5dc1 100644 --- a/NapalmLagFix/scripting/NapalmLagFix.sp +++ b/NapalmLagFix/scripting/NapalmLagFix.sp @@ -34,7 +34,7 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) public OnPluginStart() { // Convars. - new Handle:hCvar = CreateConVar("sm_napalmlagfix_version", PLUGIN_VERSION, PLUGIN_NAME, FCVAR_PLUGIN|FCVAR_NOTIFY|FCVAR_DONTRECORD); + new Handle:hCvar = CreateConVar("sm_napalmlagfix_version", PLUGIN_VERSION, PLUGIN_NAME, FCVAR_NOTIFY|FCVAR_DONTRECORD); SetConVarString(hCvar, PLUGIN_VERSION); // Gamedata. diff --git a/SaveLevel/configs/savelevel/ZE_FFVII_Mako_Reactor_V6_B08.cfg b/SaveLevel/configs/savelevel/ZE_FFVII_Mako_Reactor_V6_B08.cfg index 7cf596f7..1304fb9f 100644 --- a/SaveLevel/configs/savelevel/ZE_FFVII_Mako_Reactor_V6_B08.cfg +++ b/SaveLevel/configs/savelevel/ZE_FFVII_Mako_Reactor_V6_B08.cfg @@ -13,6 +13,7 @@ "restore" { "AddOutput" "OnUser1 leveling_counter,Add,1,0,-1" + "AddOutput" "OnUser4 score10,ApplyScore,,0,-1" "m_iFrags" "10" } } @@ -29,6 +30,8 @@ "restore" { "AddOutput" "OnUser1 leveling_counter,Add,2,0,-1" + "AddOutput" "OnUser4 score10,ApplyScore,,0,-1" + "AddOutput" "OnUser4 score10,ApplyScore,,0,-1" "m_iFrags" "20" } } @@ -45,6 +48,9 @@ "restore" { "AddOutput" "OnUser1 leveling_counter,Add,3,0,-1" + "AddOutput" "OnUser4 score10,ApplyScore,,0,-1" + "AddOutput" "OnUser4 score10,ApplyScore,,0,-1" + "AddOutput" "OnUser4 score10,ApplyScore,,0,-1" "m_iFrags" "30" } } diff --git a/SelfMute/scripting/SelfMute.sp b/SelfMute/scripting/SelfMute.sp index 6ad65549..6e9db8be 100644 --- a/SelfMute/scripting/SelfMute.sp +++ b/SelfMute/scripting/SelfMute.sp @@ -19,7 +19,7 @@ bool g_Plugin_zombiereloaded = false; bool g_Plugin_voiceannounce_ex = false; bool g_Plugin_AdvancedTargeting = false; -#define PLUGIN_VERSION "2.0" +#define PLUGIN_VERSION "2.0.1" public Plugin myinfo = { @@ -50,6 +50,8 @@ char g_PlayerNames[MAXPLAYERS+1][MAX_NAME_LENGTH]; public void OnPluginStart() { + LoadTranslations("common.phrases"); + CreateConVar("sm_selfmute_version", PLUGIN_VERSION, "Version of Self-Mute", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); RegConsoleCmd("sm_sm", Command_SelfMute, "Mute player by typing !sm [playername]"); @@ -803,84 +805,94 @@ void DisplayUnMuteMenu(int client) /* * HOOKS */ -int g_MsgDest; -int g_MsgClient; -char g_MsgName[256]; -char g_MsgParam1[256]; -char g_MsgParam2[256]; -char g_MsgParam3[256]; -char g_MsgParam4[256]; -int g_MsgPlayersNum; -int g_MsgPlayers[MAXPLAYERS + 1]; +#define MAX_MESSAGES 8 -int g_TimerDerp = 0; +int g_MsgDest[MAX_MESSAGES]; +int g_MsgClient[MAX_MESSAGES] = {-1, ...}; +char g_MsgName[MAX_MESSAGES][256]; +char g_MsgParam1[MAX_MESSAGES][256]; +char g_MsgParam2[MAX_MESSAGES][256]; +char g_MsgParam3[MAX_MESSAGES][256]; +char g_MsgParam4[MAX_MESSAGES][256]; +int g_MsgPlayersNum[MAX_MESSAGES]; +int g_MsgPlayers[MAX_MESSAGES][MAXPLAYERS + 1]; + +int g_NumMessages = 0; public Action Hook_UserMessageRadioText(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init) { - g_MsgDest = BfReadByte(bf); - g_MsgClient = BfReadByte(bf); - BfReadString(bf, g_MsgName, sizeof(g_MsgName), false); - BfReadString(bf, g_MsgParam1, sizeof(g_MsgParam1), false); - BfReadString(bf, g_MsgParam2, sizeof(g_MsgParam2), false); - BfReadString(bf, g_MsgParam3, sizeof(g_MsgParam3), false); - BfReadString(bf, g_MsgParam4, sizeof(g_MsgParam4), false); + if(g_NumMessages >= MAX_MESSAGES) + return Plugin_Handled; // Silently drop - g_MsgPlayersNum = playersNum; + g_MsgDest[g_NumMessages] = BfReadByte(bf); + g_MsgClient[g_NumMessages] = BfReadByte(bf); + BfReadString(bf, g_MsgName[g_NumMessages], sizeof(g_MsgName[]), false); + BfReadString(bf, g_MsgParam1[g_NumMessages], sizeof(g_MsgParam1[]), false); + BfReadString(bf, g_MsgParam2[g_NumMessages], sizeof(g_MsgParam2[]), false); + BfReadString(bf, g_MsgParam3[g_NumMessages], sizeof(g_MsgParam3[]), false); + BfReadString(bf, g_MsgParam4[g_NumMessages], sizeof(g_MsgParam4[]), false); + + g_MsgPlayersNum[g_NumMessages] = playersNum; for(int i = 0; i < playersNum; i++) - g_MsgPlayers[i] = players[i]; - - if(!g_TimerDerp) - CreateTimer(0.1, Timer_PlayerRadio); - - g_TimerDerp++; - if(g_TimerDerp > 1) - PrintToServer("DEBUG: Timer_PlayerRadio derped! (%d)", g_TimerDerp); + g_MsgPlayers[g_NumMessages][i] = players[i]; return Plugin_Handled; } -char g_MsgRadioSound[256]; +char g_MsgRadioSound[MAX_MESSAGES][256]; public Action Hook_UserMessageSendAudio(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init) { - BfReadString(bf, g_MsgRadioSound, sizeof(g_MsgRadioSound), false); + if(g_NumMessages >= MAX_MESSAGES) + return Plugin_Handled; // Silently drop + + BfReadString(bf, g_MsgRadioSound[g_NumMessages], sizeof(g_MsgRadioSound[]), false); + + if(!g_NumMessages) + CreateTimer(0.1, Timer_PlayerRadio); + + g_NumMessages++; return Plugin_Handled; } public Action Timer_PlayerRadio(Handle timer) { - g_TimerDerp = 0; - if(g_MsgClient == -1) - return Plugin_Continue; - - int[] players = new int[g_MsgPlayersNum + 1]; - int playersNum = 0; - - for(int i = 0; i < g_MsgPlayersNum; i++) + for(int NumMsg = 0; NumMsg < g_NumMessages; NumMsg++) { - int client = g_MsgPlayers[i]; - if(IsClientInGame(client) && !GetIgnored(client, g_MsgClient)) - players[playersNum++] = client; + if(g_MsgClient[NumMsg] == -1) + continue; + + int[] players = new int[g_MsgPlayersNum[NumMsg] + 1]; + int playersNum = 0; + + for(int i = 0; i < g_MsgPlayersNum[NumMsg]; i++) + { + int client = g_MsgPlayers[NumMsg][i]; + if(IsClientInGame(client) && !GetIgnored(client, g_MsgClient[NumMsg])) + players[playersNum++] = client; + } + + Handle RadioText = StartMessage("RadioText", players, playersNum, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS); + BfWriteByte(RadioText, g_MsgDest[NumMsg]); + BfWriteByte(RadioText, g_MsgClient[NumMsg]); + BfWriteString(RadioText, g_MsgName[NumMsg]); + BfWriteString(RadioText, g_MsgParam1[NumMsg]); + BfWriteString(RadioText, g_MsgParam2[NumMsg]); + BfWriteString(RadioText, g_MsgParam3[NumMsg]); + BfWriteString(RadioText, g_MsgParam4[NumMsg]); + EndMessage(); + + Handle SendAudio = StartMessage("SendAudio", players, playersNum, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS); + BfWriteString(SendAudio, g_MsgRadioSound[NumMsg]); + EndMessage(); + + g_MsgClient[NumMsg] = -1; } - Handle RadioText = StartMessage("RadioText", players, playersNum, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS); - BfWriteByte(RadioText, g_MsgDest); - BfWriteByte(RadioText, g_MsgClient); - BfWriteString(RadioText, g_MsgName); - BfWriteString(RadioText, g_MsgParam1); - BfWriteString(RadioText, g_MsgParam2); - BfWriteString(RadioText, g_MsgParam3); - BfWriteString(RadioText, g_MsgParam4); - EndMessage(); + g_NumMessages = 0; - Handle SendAudio = StartMessage("SendAudio", players, playersNum, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS); - BfWriteString(SendAudio, g_MsgRadioSound); - EndMessage(); - - g_MsgClient = -1; - - return Plugin_Continue; + return Plugin_Stop; } /* diff --git a/Status/scripting/Status.sp b/Status/scripting/Status.sp index e240d52c..9927df7e 100644 --- a/Status/scripting/Status.sp +++ b/Status/scripting/Status.sp @@ -27,7 +27,7 @@ public Plugin myinfo = name = "Status Fixer", author = "zaCade + BotoX", description = "Fixes the 'status' command", - version = "1.1", + version = "1.2", url = "" }; @@ -98,7 +98,7 @@ public Action Command_Status(int client, const char[] command, int args) Format(sSendBuffer, sizeof(sSendBuffer), "%stags : %s\n", sSendBuffer, sServerTags); Format(sSendBuffer, sizeof(sSendBuffer), "%s%edicts : %d/%d/%d (used/max/free)\n", sSendBuffer, GetEntityCount(), GetMaxEntities(), GetMaxEntities() - GetEntityCount()); Format(sSendBuffer, sizeof(sSendBuffer), "%splayers : %d humans | %d bots (%d/%d)\n", sSendBuffer, iRealClients, iFakeClients, iTotalClients, MaxClients); - Format(sSendBuffer, sizeof(sSendBuffer), "%s# %8s %40s %24s %12s %4s %4s %s", sSendBuffer, "userid", "name", "uniqueid", "connected", "ping", "loss", "state"); + Format(sSendBuffer, sizeof(sSendBuffer), "%s# %8s %40s %24s %12s %4s %4s %s %s", sSendBuffer, "userid", "name", "uniqueid", "connected", "ping", "loss", "state", "addr"); g_hPlayerList[client] = CreateArray(ByteCountToCells(1000)); @@ -117,6 +117,7 @@ public Action Command_Status(int client, const char[] command, int args) char sPlayerPing[4]; char sPlayerLoss[4]; static char sPlayerState[16]; + char sPlayerAddr[16]; Format(sPlayerID, sizeof(sPlayerID), "%d", GetClientUserId(player)); Format(sPlayerName, sizeof(sPlayerName), "\"%N\"", player); @@ -144,8 +145,11 @@ public Action Command_Status(int client, const char[] command, int args) else Format(sPlayerState, sizeof(sPlayerState), "spawning"); + if(GetAdminFlag(GetUserAdmin(client), Admin_Ban)) + GetClientIP(player, sPlayerAddr, sizeof(sPlayerAddr)); + static char sFormatted[128]; - Format(sFormatted, sizeof(sFormatted), "# %8s %40s %24s %12s %4s %4s %s\n", sPlayerID, sPlayerName, sPlayerAuth, sPlayerTime, sPlayerPing, sPlayerLoss, sPlayerState); + Format(sFormatted, sizeof(sFormatted), "# %8s %40s %24s %12s %4s %4s %s %s\n", sPlayerID, sPlayerName, sPlayerAuth, sPlayerTime, sPlayerPing, sPlayerLoss, sPlayerState, sPlayerAddr); int iFormattedLength = strlen(sFormatted); if(iBufLength + iFormattedLength >= 1000) diff --git a/WeaponCleaner/scripting/WeaponCleaner.sp b/WeaponCleaner/scripting/WeaponCleaner.sp index ed58bc01..eed570f4 100644 --- a/WeaponCleaner/scripting/WeaponCleaner.sp +++ b/WeaponCleaner/scripting/WeaponCleaner.sp @@ -10,12 +10,12 @@ Handle g_hTimer = INVALID_HANDLE; ConVar g_CVar_MaxWeapons; ConVar g_CVar_WeaponLifetime; -new g_RealRoundStartedTime; -new g_MaxWeapons; -new g_MaxWeaponLifetime; +int g_RealRoundStartedTime; +int g_MaxWeapons; +int g_MaxWeaponLifetime; #define MAX_WEAPONS MAXPLAYERS -new G_WeaponArray[MAX_WEAPONS][2]; +int G_WeaponArray[MAX_WEAPONS][2]; public Plugin myinfo = @@ -23,19 +23,17 @@ public Plugin myinfo = name = "WeaponCleaner", author = "BotoX", description = "Clean unneeded weapons", - version = "2.0", + version = "2.1", url = "" }; public void OnPluginStart() { - RegAdminCmd("sm_sweep", Command_CleanupWeapons, ADMFLAG_GENERIC, "Cleans up all the weapons on the map unless they have a HammerID attached to them."); - g_CVar_MaxWeapons = CreateConVar("sm_weaponcleaner_max", "5", "The maximum amount of weapons allowed in the game.", 0, true, 0.0, true, MAX_WEAPONS - 1.0); g_MaxWeapons = g_CVar_MaxWeapons.IntValue; g_CVar_MaxWeapons.AddChangeHook(OnConVarChanged); - g_CVar_WeaponLifetime = CreateConVar("sm_weaponcleaner_lifetime", "15", "The maximum amount of time in seconds a weapon is allowed in the game.", 0, true, 0.0); + g_CVar_WeaponLifetime = CreateConVar("sm_weaponcleaner_lifetime", "15", "The maximum number of seconds a weapon is allowed in the game.", 0, true, 0.0); g_MaxWeaponLifetime = g_CVar_WeaponLifetime.IntValue; g_CVar_WeaponLifetime.AddChangeHook(OnConVarChanged); @@ -51,10 +49,10 @@ public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] n if(StringToInt(newValue) < StringToInt(oldValue)) { // Need to shrink list and kill items - new d = StringToInt(oldValue) - StringToInt(newValue); + int d = StringToInt(oldValue) - StringToInt(newValue); // Kill items that don't have space anymore - for(new i = 0; d && i < g_MaxWeapons; i++) + for(int i = 0; d && i < g_MaxWeapons; i++) { if(!G_WeaponArray[i][0]) continue; @@ -101,6 +99,14 @@ public void OnClientDisconnect(int client) { SDKUnhook(client, SDKHook_WeaponDropPost, OnWeaponDrop); SDKUnhook(client, SDKHook_WeaponEquipPost, OnWeaponEquip); + + // Simulate dropping all equipped weapons + for(int i = 0; i < 5; i++) + { + int weapon = GetPlayerWeaponSlot(client, i); + if(weapon != -1) + OnWeaponDrop(client, weapon); + } } public void OnEntityCreated(int entity, const char[] classname) @@ -118,7 +124,7 @@ public void OnEntityDestroyed(int entity) public void OnWeaponSpawned(int entity) { - new HammerID = GetEntProp(entity, Prop_Data, "m_iHammerID"); + int HammerID = GetEntProp(entity, Prop_Data, "m_iHammerID"); // Should not be cleaned since it's a map spawned weapon if(HammerID) return; @@ -133,7 +139,7 @@ public Action OnWeaponEquip(int client, int entity) if(!IsValidEntity(entity)) return; - new HammerID = GetEntProp(entity, Prop_Data, "m_iHammerID"); + int HammerID = GetEntProp(entity, Prop_Data, "m_iHammerID"); // Should not be cleaned since it's a map spawned weapon if(HammerID) return; @@ -147,7 +153,7 @@ public Action OnWeaponDrop(int client, int entity) if(!IsValidEntity(entity)) return; - new HammerID = GetEntProp(entity, Prop_Data, "m_iHammerID"); + int HammerID = GetEntProp(entity, Prop_Data, "m_iHammerID"); // Should not be cleaned since it's a map spawned weapon if(HammerID) return; @@ -167,7 +173,7 @@ public Action OnWeaponDrop(int client, int entity) bool InsertWeapon(int entity) { // Try to find a free slot - for(new i = 0; i < g_MaxWeapons; i++) + for(int i = 0; i < g_MaxWeapons; i++) { if(G_WeaponArray[i][0]) continue; @@ -192,14 +198,14 @@ bool InsertWeapon(int entity) bool RemoveWeapon(int entity) { // Find the Weapon - for(new i = 0; i < g_MaxWeapons; i++) + for(int i = 0; i < g_MaxWeapons; i++) { if(G_WeaponArray[i][0] == entity) { G_WeaponArray[i][0] = 0; G_WeaponArray[i][1] = 0; // Move list items in front of this index back by one - for(new j = i + 1; j < g_MaxWeapons; j++) + for(int j = i + 1; j < g_MaxWeapons; j++) { G_WeaponArray[j - 1][0] = G_WeaponArray[j][0]; G_WeaponArray[j - 1][1] = G_WeaponArray[j][1]; @@ -217,12 +223,12 @@ bool RemoveWeapon(int entity) bool CheckWeapons() { - for(new i = 0; i < g_MaxWeapons; i++) + for(int i = 0; i < g_MaxWeapons; i++) { if(!G_WeaponArray[i][0]) continue; - if(GetTime() - G_WeaponArray[i][1] >= g_MaxWeaponLifetime) + if(g_MaxWeaponLifetime && GetTime() - G_WeaponArray[i][1] >= g_MaxWeaponLifetime) { // Kill it AcceptEntityInput(G_WeaponArray[i][0], "Kill"); @@ -235,27 +241,12 @@ bool CheckWeapons() return true; } -void CleanupWeapons() -{ - for(new i = 0; i < g_MaxWeapons; i++) - { - if(!G_WeaponArray[i][0]) - continue; - - // Kill it - AcceptEntityInput(G_WeaponArray[i][0], "Kill"); - // This implicitly calls OnEntityDestroyed() which calls RemoveWeapon() - - // Move index backwards (since the list was modified by removing it) - i--; - } -} - public Action Event_RoundStart(Handle:event, const char[] name, bool:dontBroadcast) { for(new i = 0; i < MAX_WEAPONS; i++) { - G_WeaponArray[i][0] = 0; G_WeaponArray[i][1] = 0; + G_WeaponArray[i][0] = 0; + G_WeaponArray[i][1] = 0; } g_RealRoundStartedTime = GetTime() + GetConVarInt(FindConVar("mp_freezetime")); } @@ -264,11 +255,3 @@ public Action Timer_CleanupWeapons(Handle:timer) { CheckWeapons(); } - -public Action Command_CleanupWeapons(client, args) -{ - CleanupWeapons(); - - LogAction(client, -1, "%L performed a weapons cleanup", client); - PrintToChat(client, "[SM] Weapons cleaned successfully!"); -} diff --git a/WeaponEquip/scripting/WeaponEquip.sp b/WeaponEquip/scripting/WeaponEquip.sp index b379dc97..f989a5ac 100644 --- a/WeaponEquip/scripting/WeaponEquip.sp +++ b/WeaponEquip/scripting/WeaponEquip.sp @@ -22,8 +22,8 @@ public Plugin myinfo = public void OnPluginStart() { - g_hCvar_WeaponSecondary = CreateConVar("sm_weaponequip_secondary", "weapon_elite", "The name of the secondary weapon to give.", FCVAR_PLUGIN); - g_hCvar_WeaponPrimary = CreateConVar("sm_weaponequip_primary", "weapon_p90", "The name of the secondary weapon to give.", FCVAR_PLUGIN); + g_hCvar_WeaponSecondary = CreateConVar("sm_weaponequip_secondary", "weapon_elite", "The name of the secondary weapon to give."); + g_hCvar_WeaponPrimary = CreateConVar("sm_weaponequip_primary", "weapon_p90", "The name of the secondary weapon to give."); AutoExecConfig(true, "plugin.WeaponEquip"); } diff --git a/compile-all.py b/compile-all.py new file mode 100755 index 00000000..9a4b113d --- /dev/null +++ b/compile-all.py @@ -0,0 +1,37 @@ +#!/usr/bin/python3 +import os +import sys +import subprocess + +SM_INCLUDES = "includes" +SPCOMP = "./spcomp" + +if __name__ == "__main__": + Plugins = [] + Path, Directories, Files = next(os.walk(".")) + for Directory in Directories: + if Directory != ".git" and Directory != "include" and Directory != "includes" and Directory != "plugins": + Plugins.append(Directory) + + for Plugin in Plugins: + print("Compiling {0}".format(Plugin)) + + SourcePath = os.path.join(Plugin, "scripting") + Path, Directories, Files = next(os.walk(SourcePath)) + for File in Files: + if File.endswith(".sp"): + SourcePath = os.path.join(Path, File) + IncludePath = os.path.join(Path, "include") + OutDir = "plugins" + OutPath = os.path.join(OutDir, os.path.splitext(os.path.basename(SourcePath))[0] + ".smx") + + Compiler = [SPCOMP, "-i" + SM_INCLUDES] + if os.path.isdir(IncludePath): + Compiler.append("-i" + IncludePath) + Compiler.append(SourcePath) + Compiler.append("-o" + OutPath) + + try: + subprocess.run(Compiler, check=True) + except Exception: + sys.exit(1) diff --git a/compile.py b/compile.py new file mode 100755 index 00000000..057a52b4 --- /dev/null +++ b/compile.py @@ -0,0 +1,36 @@ +#!/usr/bin/python3 +import os +import sys +import subprocess + +SM_INCLUDES = "includes" +SPCOMP = "./spcomp" + +if __name__ == "__main__": + Plugins = [] + for Directory in sys.argv[1:]: + if Directory != ".git" and Directory != "include" and Directory != "includes" and Directory != "plugins": + Plugins.append(Directory) + + for Plugin in Plugins: + print("Compiling {0}".format(Plugin)) + + SourcePath = os.path.join(Plugin, "scripting") + Path, Directories, Files = next(os.walk(SourcePath)) + for File in Files: + if File.endswith(".sp"): + SourcePath = os.path.join(Path, File) + IncludePath = os.path.join(Path, "include") + OutDir = "plugins" + OutPath = os.path.join(OutDir, os.path.splitext(os.path.basename(SourcePath))[0] + ".smx") + + Compiler = [SPCOMP, "-i" + SM_INCLUDES] + if os.path.isdir(IncludePath): + Compiler.append("-i" + IncludePath) + Compiler.append(SourcePath) + Compiler.append("-o" + OutPath) + + try: + subprocess.run(Compiler, check=True) + except Exception: + sys.exit(1) diff --git a/custom-chatcolors/configs/custom-chatcolorsreplace.cfg b/custom-chatcolors/configs/custom-chatcolorsreplace.cfg new file mode 100644 index 00000000..f675174e --- /dev/null +++ b/custom-chatcolors/configs/custom-chatcolorsreplace.cfg @@ -0,0 +1,17 @@ +"AutoReplace" +{ + "teh" "the" + ":lenny:" "( ͡° ͜ʖ ͡°)" + ":feel:" "( ´_ゝ`)" + ":chill:" "( ≖‿≖)" + ":cute:" "(´・ω・`)" + ":shrug:" "¯\_(ツ)_/¯" + ":smile:" "( ・◡・)" + ":sad:" "( ´A`)" + ":happy:" "(´∀`)" + ":3:" "( ¯3¯)" + ":dunno:" "┐(´д`)┌" + ":please:" "(人・_・) pleaseeee!" + ":table:" "(╯°□°)╯︵ ┻━┻" + ":?:" "ヽ( ゚Д゚)ノ?" +} \ No newline at end of file diff --git a/custom-chatcolors/scripting/custom-chatcolors.sp b/custom-chatcolors/scripting/custom-chatcolors.sp index abb52255..3a837eb4 100644 --- a/custom-chatcolors/scripting/custom-chatcolors.sp +++ b/custom-chatcolors/scripting/custom-chatcolors.sp @@ -3,13 +3,17 @@ #include #include #include -#include //#undef REQUIRE_PLUGIN #include -#define PLUGIN_VERSION "5.3.0" +#pragma newdecls required -public Plugin:myinfo = +#include + +#define PLUGIN_VERSION "6.1.0" +#define MAX_CHAT_LENGTH 192 + +public Plugin myinfo = { name = "Custom Chat Colors & Tags & Allchat", author = "Dr. McKay, edit by id/Obus, BotoX", @@ -18,53 +22,55 @@ public Plugin:myinfo = 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 Handle:g_hCoolDown = INVALID_HANDLE; -new Handle:g_hGreenText = INVALID_HANDLE; -//new Handle:g_hAdminMenu = INVALID_HANDLE; +//Handle colorForward; +//Handle nameForward; +//Handle tagForward; +//Handle applicationForward; +//Handle messageForward; +Handle preLoadedForward; +Handle loadedForward; +Handle configReloadedForward; +Handle g_hGreenText = null; +Handle g_hReplaceText = null; +//Handle g_hAdminMenu = null; -new String:g_sTag[MAXPLAYERS + 1][64]; -new String:g_sTagColor[MAXPLAYERS + 1][12]; -new String:g_sUsernameColor[MAXPLAYERS + 1][12]; -new String:g_sChatColor[MAXPLAYERS + 1][12]; +char g_sTag[MAXPLAYERS + 1][64]; +char g_sTagColor[MAXPLAYERS + 1][12]; +char g_sUsernameColor[MAXPLAYERS + 1][12]; +char g_sChatColor[MAXPLAYERS + 1][12]; -new String:g_sDefaultTag[MAXPLAYERS + 1][32]; -new String:g_sDefaultTagColor[MAXPLAYERS + 1][12]; -new String:g_sDefaultUsernameColor[MAXPLAYERS + 1][12]; -new String:g_sDefaultChatColor[MAXPLAYERS + 1][12]; -new const String:g_sColorsArray[120][2][32] = { {"aliceblue", "F0F8FF" }, { "aqua", "00FFFF" }, { "aquamarine", "7FFFD4" }, { "azure", "007FFF" }, { "beige", "F5F5DC" }, { "black", "000000" }, { "blue", "99CCFF" }, { "blueviolet", "8A2BE2" }, { "brown", "A52A2A" }, { "burlywood", "DEB887" }, { "cadetblue", "5F9EA0" }, { "chocolate", "D2691E" }, { "corrupted", "A32C2E" }, { "crimson", "DC143C" }, { "cyan", "00FFFF" }, { "darkblue", "00008B" }, { "darkcyan", "008B8B" }, { "darkgoldenrod", "B8860B" }, { "darkgray", "A9A9A9" }, { "darkgrey", "A9A9A9" }, { "darkgreen", "006400" }, { "darkkhaki", "BDB76B" }, { "darkmagenta", "8B008B" }, { "darkolivegreen", "556B2F" }, { "darkorange", "FF8C00" }, { "darkorchid", "9932CC" }, { "darkred", "8B0000" }, { "darksalmon", "E9967A" }, { "darkseagreen", "8FBC8F" }, { "darkslateblue", "483D8B" }, { "darkturquoise", "00CED1" }, { "darkviolet", "9400D3" }, { "deeppink", "FF1493" }, { "deepskyblue", "00BFFF" }, { "dimgray", "696969" }, { "dodgerblue", "1E90FF" }, { "firebrick", "B22222" }, { "floralwhite", "FFFAF0" }, { "forestgreen", "228B22" }, { "frozen", "4983B3" }, { "fuchsia", "FF00FF" }, { "fullblue", "0000FF" }, { "fullred", "FF0000" }, { "ghostwhite", "F8F8FF" }, { "gold", "FFD700" }, { "gray", "CCCCCC" }, { "green", "3EFF3E" }, { "greenyellow", "ADFF2F" }, { "hotpink", "FF69B4" }, { "indianred", "CD5C5C" }, { "indigo", "4B0082" }, { "ivory", "FFFFF0" }, { "khaki", "F0E68C" }, { "lightblue", "ADD8E6" }, { "lightcoral", "F08080" }, { "lightcyan", "E0FFFF" }, { "lightgoldenrodyellow", "FAFAD2" }, { "lightgray", "D3D3D3" }, { "lightgrey", "D3D3D3" }, { "lightgreen", "99FF99" }, { "lightpink", "FFB6C1" }, { "lightsalmon", "FFA07A" }, { "lightseagreen", "20B2AA" }, { "lightskyblue", "87CEFA" }, { "lightslategray", "778899" }, { "lightslategrey", "778899" }, { "lightsteelblue", "B0C4DE" }, { "lightyellow", "FFFFE0" }, { "lime", "00FF00" }, { "limegreen", "32CD32" }, { "magenta", "FF00FF" }, { "maroon", "800000" }, { "mediumaquamarine", "66CDAA" }, { "mediumblue", "0000CD" }, { "mediumorchid", "BA55D3" }, { "mediumturquoise", "48D1CC" }, { "mediumvioletred", "C71585" }, { "midnightblue", "191970" }, { "mintcream", "F5FFFA" }, { "mistyrose", "FFE4E1" }, { "moccasin", "FFE4B5" }, { "navajowhite", "FFDEAD" }, { "navy", "000080" }, { "oldlace", "FDF5E6" }, { "olive", "9EC34F" }, { "olivedrab", "6B8E23" }, { "orange", "FFA500" }, { "orangered", "FF4500" }, { "orchid", "DA70D6" }, { "palegoldenrod", "EEE8AA" }, { "palegreen", "98FB98" }, { "palevioletred", "D87093" }, { "pink", "FFC0CB" }, { "plum", "DDA0DD" }, { "powderblue", "B0E0E6" }, { "purple", "800080" }, { "red", "FF4040" }, { "rosybrown", "BC8F8F" }, { "royalblue", "4169E1" }, { "saddlebrown", "8B4513" }, { "salmon", "FA8072" }, { "sandybrown", "F4A460" }, { "seagreen", "2E8B57" }, { "seashell", "FFF5EE" }, { "silver", "C0C0C0" }, { "skyblue", "87CEEB" }, { "slateblue", "6A5ACD" }, { "slategray", "708090" }, { "slategrey", "708090" }, { "snow", "FFFAFA" }, { "springgreen", "00FF7F" }, { "steelblue", "4682B4" }, { "tan", "D2B48C" }, { "teal", "008080" }, { "tomato", "FF6347" }, { "turquoise", "40E0D0" }, { "violet", "EE82EE" }, { "white", "FFFFFF" }, { "yellow", "FFFF00" }, { "yellowgreen", "9ACD32" } }; //you want colors? here bomb array fak u +char g_sDefaultTag[MAXPLAYERS + 1][32]; +char g_sDefaultTagColor[MAXPLAYERS + 1][12]; +char g_sDefaultUsernameColor[MAXPLAYERS + 1][12]; +char g_sDefaultChatColor[MAXPLAYERS + 1][12]; +char g_sColorsArray[120][2][32] = { {"aliceblue", "F0F8FF" }, { "aqua", "00FFFF" }, { "aquamarine", "7FFFD4" }, { "azure", "007FFF" }, { "beige", "F5F5DC" }, { "black", "000000" }, { "blue", "99CCFF" }, { "blueviolet", "8A2BE2" }, { "brown", "A52A2A" }, { "burlywood", "DEB887" }, { "cadetblue", "5F9EA0" }, { "chocolate", "D2691E" }, { "corrupted", "A32C2E" }, { "crimson", "DC143C" }, { "cyan", "00FFFF" }, { "darkblue", "00008B" }, { "darkcyan", "008B8B" }, { "darkgoldenrod", "B8860B" }, { "darkgray", "A9A9A9" }, { "darkgrey", "A9A9A9" }, { "darkgreen", "006400" }, { "darkkhaki", "BDB76B" }, { "darkmagenta", "8B008B" }, { "darkolivegreen", "556B2F" }, { "darkorange", "FF8C00" }, { "darkorchid", "9932CC" }, { "darkred", "8B0000" }, { "darksalmon", "E9967A" }, { "darkseagreen", "8FBC8F" }, { "darkslateblue", "483D8B" }, { "darkturquoise", "00CED1" }, { "darkviolet", "9400D3" }, { "deeppink", "FF1493" }, { "deepskyblue", "00BFFF" }, { "dimgray", "696969" }, { "dodgerblue", "1E90FF" }, { "firebrick", "B22222" }, { "floralwhite", "FFFAF0" }, { "forestgreen", "228B22" }, { "frozen", "4983B3" }, { "fuchsia", "FF00FF" }, { "fullblue", "0000FF" }, { "fullred", "FF0000" }, { "ghostwhite", "F8F8FF" }, { "gold", "FFD700" }, { "gray", "CCCCCC" }, { "green", "3EFF3E" }, { "greenyellow", "ADFF2F" }, { "hotpink", "FF69B4" }, { "indianred", "CD5C5C" }, { "indigo", "4B0082" }, { "ivory", "FFFFF0" }, { "khaki", "F0E68C" }, { "lightblue", "ADD8E6" }, { "lightcoral", "F08080" }, { "lightcyan", "E0FFFF" }, { "lightgoldenrodyellow", "FAFAD2" }, { "lightgray", "D3D3D3" }, { "lightgrey", "D3D3D3" }, { "lightgreen", "99FF99" }, { "lightpink", "FFB6C1" }, { "lightsalmon", "FFA07A" }, { "lightseagreen", "20B2AA" }, { "lightskyblue", "87CEFA" }, { "lightslategray", "778899" }, { "lightslategrey", "778899" }, { "lightsteelblue", "B0C4DE" }, { "lightyellow", "FFFFE0" }, { "lime", "00FF00" }, { "limegreen", "32CD32" }, { "magenta", "FF00FF" }, { "maroon", "800000" }, { "mediumaquamarine", "66CDAA" }, { "mediumblue", "0000CD" }, { "mediumorchid", "BA55D3" }, { "mediumturquoise", "48D1CC" }, { "mediumvioletred", "C71585" }, { "midnightblue", "191970" }, { "mintcream", "F5FFFA" }, { "mistyrose", "FFE4E1" }, { "moccasin", "FFE4B5" }, { "navajowhite", "FFDEAD" }, { "navy", "000080" }, { "oldlace", "FDF5E6" }, { "olive", "9EC34F" }, { "olivedrab", "6B8E23" }, { "orange", "FFA500" }, { "orangered", "FF4500" }, { "orchid", "DA70D6" }, { "palegoldenrod", "EEE8AA" }, { "palegreen", "98FB98" }, { "palevioletred", "D87093" }, { "pink", "FFC0CB" }, { "plum", "DDA0DD" }, { "powderblue", "B0E0E6" }, { "purple", "800080" }, { "red", "FF4040" }, { "rosybrown", "BC8F8F" }, { "royalblue", "4169E1" }, { "saddlebrown", "8B4513" }, { "salmon", "FA8072" }, { "sandybrown", "F4A460" }, { "seagreen", "2E8B57" }, { "seashell", "FFF5EE" }, { "silver", "C0C0C0" }, { "skyblue", "87CEEB" }, { "slateblue", "6A5ACD" }, { "slategray", "708090" }, { "slategrey", "708090" }, { "snow", "FFFAFA" }, { "springgreen", "00FF7F" }, { "steelblue", "4682B4" }, { "tan", "D2B48C" }, { "teal", "008080" }, { "tomato", "FF6347" }, { "turquoise", "40E0D0" }, { "violet", "EE82EE" }, { "white", "FFFFFF" }, { "yellow", "FFFF00" }, { "yellowgreen", "9ACD32" } }; //you want colors? here bomb array fak u -new String:g_sPath[PLATFORM_MAX_PATH]; -new String:g_sBanPath[PLATFORM_MAX_PATH]; +char g_sPath[PLATFORM_MAX_PATH]; +char g_sReplacePath[PLATFORM_MAX_PATH]; +char g_sBanPath[PLATFORM_MAX_PATH]; -new bool:g_bWaitingForChatInput[MAXPLAYERS + 1]; -new bool:g_bTagToggled[MAXPLAYERS + 1]; -new String:g_sReceivedChatInput[MAXPLAYERS + 1][64]; -new String:g_sInputType[MAXPLAYERS + 1][32]; -new String:g_sATargetSID[MAXPLAYERS + 1][64]; -new g_iATarget[MAXPLAYERS + 1]; +bool g_bWaitingForChatInput[MAXPLAYERS + 1]; +bool g_bTagToggled[MAXPLAYERS + 1]; +char g_sReceivedChatInput[MAXPLAYERS + 1][64]; +char g_sInputType[MAXPLAYERS + 1][32]; +char g_sATargetSID[MAXPLAYERS + 1][64]; +int g_iATarget[MAXPLAYERS + 1]; -new Handle:g_hConfigFile; -new Handle:g_hBanFile; +Handle g_hConfigFile; +Handle g_hReplaceConfigFile; +Handle g_hBanFile; -new g_msgAuthor; -new bool:g_msgIsChat; -new String:g_msgName[128]; -new String:g_msgSender[128]; -new String:g_msgText[512]; -new String:g_msgFinal[1024]; -new bool:g_msgIsTeammate; +int g_msgAuthor; +bool g_msgIsChat; +char g_msgName[128]; +char g_msgSender[128]; +char g_msgText[MAX_CHAT_LENGTH]; +char g_msgFinal[255]; +bool g_msgIsTeammate; -new bool:g_Ignored[(MAXPLAYERS + 1) * (MAXPLAYERS + 1)] = {false, ...}; +bool g_Ignored[(MAXPLAYERS + 1) * (MAXPLAYERS + 1)] = {false, ...}; -public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) +public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) { MarkNativeAsOptional("Updater_AddPlugin"); @@ -82,18 +88,18 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) return APLRes_Success; } -public OnPluginStart() +public void OnPluginStart() { LoadTranslations("common.phrases"); LoadTranslations("allchat.phrases"); - //new Handle:g_hTemporary = INVALID_HANDLE; - //if(LibraryExists("adminmenu") && ((g_hTemporary = GetAdminTopMenu()) != INVALID_HANDLE)) + //new Handle g_hTemporary = null; + //if(LibraryExists("adminmenu") && ((g_hTemporary = GetAdminTopMenu()) != null)) //{ // OnAdminMenuReady(g_hTemporary); //} - new UserMsg:SayText2 = GetUserMessageId("SayText2"); + UserMsg SayText2 = GetUserMessageId("SayText2"); if (SayText2 == INVALID_MESSAGE_ID) { @@ -113,6 +119,7 @@ public OnPluginStart() RegAdminCmd("sm_cccunban", Command_CCCUnban, ADMFLAG_SLAY, "Unbans a user and allows for change of his tag, tag color, name color and chat text color"); RegAdminCmd("sm_tagmenu", Command_TagMenu, ADMFLAG_CUSTOM1, "Shows the main \"tag & colors\" menu"); RegAdminCmd("sm_tag", Command_SetTag, ADMFLAG_CUSTOM1, "Changes your custom tag"); + RegAdminCmd("sm_tags", Command_TagMenu, ADMFLAG_CUSTOM1, "Shows the main \"tag & colors\" menu"); RegAdminCmd("sm_cleartag", Command_ClearTag, ADMFLAG_CUSTOM1, "Clears your custom tag"); RegAdminCmd("sm_tagcolor", Command_SetTagColor, ADMFLAG_CUSTOM1, "Changes the color of your custom tag"); RegAdminCmd("sm_cleartagcolor", Command_ClearTagColor, ADMFLAG_CUSTOM1, "Clears the color from your custom tag"); @@ -122,26 +129,25 @@ public OnPluginStart() RegAdminCmd("sm_chatcolor", Command_SetTextColor, ADMFLAG_CUSTOM1, "Changes the color of your chat text"); RegAdminCmd("sm_cleartextcolor", Command_ClearTextColor, ADMFLAG_CUSTOM1, "Clears the color from your chat text"); RegAdminCmd("sm_clearchatcolor", Command_ClearTextColor, ADMFLAG_CUSTOM1, "Clears the color from your chat text"); - RegConsoleCmd("sm_toggletag", Command_ToggleTag, "Toggles whether or not your tag and colors show in the chat"); + RegAdminCmd("sm_toggletag", Command_ToggleTag, ADMFLAG_CUSTOM1, "Toggles whether or not your tag and colors show in the chat"); AddCommandListener(Command_Say, "say"); AddCommandListener(Command_Say, "say_team"); - //RegConsoleCmd("sm_test", Command_Test); - if (g_hCoolDown != INVALID_HANDLE) - CloseHandle(g_hCoolDown); - - if (g_hGreenText != INVALID_HANDLE) + if (g_hGreenText != null) CloseHandle(g_hGreenText); - g_hCoolDown = CreateConVar("sm_ccccooldown", "1", "Tag/Color changes cooldown period (in seconds)", FCVAR_NOTIFY|FCVAR_REPLICATED, true, 1.0); - g_hGreenText = CreateConVar("sm_cccgreentext", "1", "Enables greentexting (First chat character must be \">\")"); + if (g_hReplaceText != null) + CloseHandle(g_hReplaceText); - 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); + g_hGreenText = CreateConVar("sm_cccgreentext", "1", "Enables greentexting (First chat character must be \">\")", FCVAR_REPLICATED); + g_hReplaceText = CreateConVar("sm_cccreplacetext", "1", "Enables text replacing as defined in configs/custom-chatcolorsreplace.cfg", FCVAR_REPLICATED); + + //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); @@ -149,55 +155,53 @@ public OnPluginStart() LoadConfig(); } -LoadConfig() +void LoadConfig() { - if (g_hConfigFile != INVALID_HANDLE) - { + if (g_hConfigFile != null) CloseHandle(g_hConfigFile); - } - if (g_hBanFile != INVALID_HANDLE) - { + if (g_hReplaceConfigFile != null) + CloseHandle(g_hReplaceConfigFile); + + if (g_hBanFile != null) CloseHandle(g_hBanFile); - } g_hConfigFile = CreateKeyValues("admin_colors"); + g_hReplaceConfigFile = CreateKeyValues("AutoReplace"); g_hBanFile = CreateKeyValues("restricted_users"); BuildPath(Path_SM, g_sPath, sizeof(g_sPath), "configs/custom-chatcolors.cfg"); + BuildPath(Path_SM, g_sReplacePath, sizeof(g_sReplacePath), "configs/custom-chatcolorsreplace.cfg"); BuildPath(Path_SM, g_sBanPath, sizeof(g_sBanPath), "configs/custom-chatcolorsbans.cfg"); if (!FileToKeyValues(g_hConfigFile, g_sPath)) - { - SetFailState("[CCC] Config file missing"); - } + SetFailState("[CCC] Config file missing, please make sure \"custom-chatcolors.cfg\" is in the \"sourcemod/configs\" folder."); + + if (!FileToKeyValues(g_hReplaceConfigFile, g_sReplacePath)) + SetFailState("[CCC] Replace file missing, please make sure \"custom-chatcolorsreplace.cfg\" is in the \"sourcemod/configs\" folder."); if (!FileToKeyValues(g_hBanFile, g_sBanPath)) - { - SetFailState("[CCC] Ban file missing"); - } + SetFailState("[CCC] Ban file missing, please make sure \"custom-chatcolorsbans.cfg\" is in the \"sourcemod/configs\" folder."); - for (new i = 1; i <= MaxClients; i++) + for (int i = 1; i <= MaxClients; i++) { if (!IsClientInGame(i) || IsFakeClient(i)) - { continue; - } ClearValues(i); OnClientPostAdminCheck(i); } } -/*public OnLibraryRemoved(const String:name[]) +/* public OnLibraryRemoved(const char name[]) { if (StrEqual(name, "adminmenu")) { - g_hAdminMenu = INVALID_HANDLE; + g_hAdminMenu = null; } } -public OnAdminMenuReady(Handle:CCCAMenu) +public OnAdminMenuReady(Handle CCCAMenu) { if (CCCAMenu == g_hAdminMenu) { @@ -215,78 +219,44 @@ public OnAdminMenuReady(Handle:CCCAMenu) AddToTopMenu(g_hAdminMenu, "CCCReset", TopMenuObject_Item, Handle_AMenuReset, MenuObject, "sm_cccreset", ADMFLAG_SLAY); AddToTopMenu(g_hAdminMenu, "CCCBan", TopMenuObject_Item, Handle_AMenuBan, MenuObject, "sm_cccban", ADMFLAG_SLAY); AddToTopMenu(g_hAdminMenu, "CCCUnBan", TopMenuObject_Item, Handle_AMenuUnBan, MenuObject, "sm_cccunban", ADMFLAG_SLAY); -}*/ //figure out why reloading the plugin makes this admin menu take control of other admin menus +} */ -public Action:Command_Test(client, args) +bool MakeStringPrintable(char[] str, int str_len_max, const char[] empty) //function taken from Forlix FloodCheck (http://forlix.org/gameaddons/floodcheck.shtml) { - decl String:Arg[64]; - decl String:SArg[64]; - decl String:TArg[64]; - new color; - GetCmdArg(1, Arg, sizeof(SArg)); - GetCmdArg(2, SArg, sizeof(SArg)); - GetCmdArg(3, TArg, sizeof(SArg)); - color |= ((StringToInt(Arg, 10) & 0xFF) << 16); - color |= ((StringToInt(SArg, 10) & 0xFF) << 8); - color |= ((StringToInt(TArg, 10) & 0xFF) << 0); - - if (IsValidHex(Arg)) - { - ReplaceString(Arg, 64, "#", ""); - PrintToChat(client, "%02X, %04X, %06X", Arg, Arg, Arg); - new Hex, r, g, b; - StringToIntEx(Arg, Hex, 16); - r = ((Hex >> 16) & 0xFF); - g = ((Hex >> 8) & 0xFF); - b = ((Hex >> 0) & 0xFF); - - - PrintToChat(client, "Hex = %s, R = %i, G = %i, B = %i", Arg, r, g, b); - } - else - { - PrintToChat(client, "Arg: %d, SArg: %d, TArg: %d", StringToInt(Arg),StringToInt(SArg),StringToInt(TArg)); - PrintToChat(client, "%06X", color); - //PrintToChat(client, "test %X, r = %i, g = %i, b = %i", test, r, g, b); - } -} - -bool:MakeStringPrintable(String:str[], str_len_max, const String:empty[]) //function taken from Forlix FloodCheck (http://forlix.org/gameaddons/floodcheck.shtml) -{ - new r = 0; - new w = 0; - new bool:modified = false; - new bool:nonspace = false; - new bool:addspace = false; + int r = 0; + int w = 0; + bool modified = false; + bool nonspace = false; + bool addspace = false; if (str[0]) - do - { - if(str[r] < '\x20') + { + do { - modified = true; + if (str[r] < '\x20') + { + modified = true; - if((str[r] == '\n' - || str[r] == '\t') - && w > 0 - && str[w-1] != '\x20') - addspace = true; + if((str[r] == '\n' || str[r] == '\t') && w > 0 && str[w-1] != '\x20') + addspace = true; + } + else + { + if (str[r] != '\x20') + { + nonspace = true; + + if (addspace) + str[w++] = '\x20'; + } + + addspace = false; + str[w++] = str[r]; + } } - else - { - if(str[r] != '\x20') - { - nonspace = true; + while(str[++r]); + } - if(addspace) - str[w++] = '\x20'; - } - - addspace = false; - str[w++] = str[r]; - } - } - while(str[++r]); str[w] = '\0'; if (!nonspace) @@ -298,7 +268,7 @@ bool:MakeStringPrintable(String:str[], str_len_max, const String:empty[]) //func return (modified); } -bool:SingularOrMultiple(int num) +bool SingularOrMultiple(int num) { if (num > 1 || num == 0) { @@ -308,79 +278,70 @@ bool:SingularOrMultiple(int num) return false; } -bool:HasFlag(client, AdminFlag:ADMFLAG) +bool HasFlag(int client, AdminFlag ADMFLAG) { - new AdminId:Admin = GetUserAdmin(client); + AdminId Admin = GetUserAdmin(client); - if (Admin != INVALID_ADMIN_ID && GetAdminFlag(Admin, ADMFLAG, Access_Effective) == true) - { + if (Admin != INVALID_ADMIN_ID && GetAdminFlag(Admin, ADMFLAG, Access_Effective)) return true; - } return false; } -bool:NoFilter(String:arg[64]) +bool ForceColor(int client, char Key[64]) { - if (StrEqual(arg[0], "@cts") || StrEqual(arg[0], "@ct") || StrEqual(arg[0], "@all") || StrEqual(arg[0], "@alive") || StrEqual(arg[0], "@admins") || StrEqual(arg[0], "@dead") || StrEqual(arg[0], "@humans") || StrEqual(arg[0], "@t") || StrEqual(arg[0], "@ts") || StrEqual(arg[0], "@!me")) + int iTarget; + char sTarget[64]; + char sCol[64]; + GetCmdArg(1, sTarget, sizeof(sTarget)); + GetCmdArg(2, sCol, sizeof(sCol)); + + if (IsValidRGBNum(sCol)) { - return true; - } - - return false; -} - -int ForceColor(client, String:Key[64]) -{ - decl String:arg[64]; - decl String:col[64]; - GetCmdArg(1, arg, sizeof(arg)); - GetCmdArg(2, col, sizeof(col)); - - decl String:target_name[MAX_TARGET_LENGTH]; - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; - - if (IsValidRGBNum(col)) - { - new String:g[8]; - new String:b[8]; + char g[8]; + char b[8]; GetCmdArg(3, g, sizeof(g)); GetCmdArg(4, b, sizeof(b)); - new hex; - hex |= ((StringToInt(col) & 0xFF) << 16); + int hex; + + hex |= ((StringToInt(sCol) & 0xFF) << 16); hex |= ((StringToInt(g) & 0xFF) << 8); hex |= ((StringToInt(b) & 0xFF) << 0); - Format(col, 64, "#%06X", hex); + Format(sCol, 64, "#%06X", hex); } - if (NoFilter(arg)) + if ((iTarget = FindTarget(client, sTarget, true)) == -1) { - ReplyToCommand(client, "[SM] This command only supports special filters <@aim|@me>."); - return 1; + return false; } - if ((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_CONNECTED|COMMAND_FILTER_NO_BOTS, target_name, sizeof(target_name), tn_is_ml)) <= 0) - { - ReplyToTargetError(client, target_count); - return 2; - } + char SID[64]; + GetClientAuthId(iTarget, AuthId_Steam2, SID, sizeof(SID)); - for (new i = 0; i < target_count; i++) + if (IsValidHex(sCol)) { - decl String:SID[64]; - GetClientAuthId(target_list[i], AuthId_Steam2, SID, sizeof(SID)); + if (sCol[0] != '#') + Format(sCol, sizeof(sCol), "#%s", sCol); - if (IsValidHex(col)) - SetColor(SID, Key, col, -1, true, true); + SetColor(SID, Key, sCol, -1, true); + + if (!strcmp(Key, "namecolor")) + CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Successfully set {green}%N's{default} name color to: \x07%s#%s{default}!", iTarget, sCol[1], sCol[1]); + else if (!strcmp(Key, "tagcolor")) + CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Successfully set {green}%N's{default} tag color to: \x07%s#%s{default}!", iTarget, sCol[1], sCol[1]); else - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}]{default} Invalid HEX|RGB color code given."); + CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Successfully set {green}%N's{default} text color to: \x07%s#%s{default}!", iTarget, sCol[1], sCol[1]); + } + else + { + CReplyToCommand(client, "{green}[{red}C{green}C{blue}C{green}]{default} Invalid HEX|RGB color code given."); } - return 0; + return true; } -bool:IsValidRGBNum(String:arg[]) +bool IsValidRGBNum(char[] arg) { if (SimpleRegexMatch(arg, "^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$") == 2) { @@ -390,7 +351,7 @@ bool:IsValidRGBNum(String:arg[]) return false; } -bool:IsValidHex(String:arg[]) +bool IsValidHex(char[] arg) { if (SimpleRegexMatch(arg, "^(#?)([A-Fa-f0-9]{6})$") == 0) { @@ -400,7 +361,7 @@ bool:IsValidHex(String:arg[]) return true; } -bool:SetColor(String:SID[64], String:Key[64], String:HEX[64], client, bool:IgnoreCooldown=false, bool:IgnoreBan=false) +bool SetColor(char SID[64], char Key[64], char HEX[64], int client, bool IgnoreBan=false) { if (!IgnoreBan) { @@ -419,7 +380,7 @@ bool:SetColor(String:SID[64], String:Key[64], String:HEX[64], client, bool:Ignor } else { - decl String:TimeBuffer[64]; + char TimeBuffer[64]; int tstamp = KvGetNum(g_hBanFile, "length"); tstamp = (tstamp - GetTime()); @@ -451,48 +412,6 @@ bool:SetColor(String:SID[64], String:Key[64], String:HEX[64], client, bool:Ignor } } - if (!IgnoreCooldown) - { - KvRewind(g_hConfigFile); - - if (KvJumpToKey(g_hConfigFile, SID, true)) - { - decl String:KeyCD[64]; - Format(KeyCD, sizeof(KeyCD), "%scd", Key); - - if (KvGetNum(g_hConfigFile, KeyCD) < GetTime()) - { - KvSetNum(g_hConfigFile, KeyCD, GetTime() + GetConVarInt(g_hCoolDown)); - } - else - { - decl String:TimeBuffer[64]; - int tstamp = KvGetNum(g_hConfigFile, KeyCD); - tstamp = (tstamp - GetTime()); - int hrs = (tstamp / 3600); - int mins = ((tstamp / 60) % 60); - int sec = (tstamp % 60); - - if (tstamp > 3600) - { - Format(TimeBuffer, sizeof(TimeBuffer), "%d %s, %d %s, %d %s", hrs, SingularOrMultiple(hrs) ? "Hours" : "Hour", mins, SingularOrMultiple(mins) ? "Minutes" : "Minute", sec, SingularOrMultiple(sec) ? "Seconds" : "Second"); - } - else if (tstamp > 60) - { - Format(TimeBuffer, sizeof(TimeBuffer), "%d %s, %d %s", mins, SingularOrMultiple(mins) ? "Minutes" : "Minute", sec, SingularOrMultiple(sec) ? "Seconds" : "Second"); - } - else - { - Format(TimeBuffer, sizeof(TimeBuffer), "%d %s", sec, SingularOrMultiple(sec) ? "Seconds" : "Second"); - } - //Format(TimeBuffer, sizeof(TimeBuffer), "%d Hours, %d Minutes, %d Seconds", hrs, mins, sec); - - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}]{default} Time remaining until you can change your {green}%s{default}: {green}%s", Key, TimeBuffer); - return false; - } - } - } - KvRewind(g_hConfigFile); KvRewind(g_hBanFile); @@ -512,7 +431,7 @@ bool:SetColor(String:SID[64], String:Key[64], String:HEX[64], client, bool:Ignor return true; } -bool:SetTag(String:SID[64], String:text[64], client, bool:IgnoreCooldown=false, bool:IgnoreBan=false) +bool SetTag(char SID[64], char text[64], int client, bool IgnoreBan=false) { if (!IgnoreBan) { @@ -531,7 +450,7 @@ bool:SetTag(String:SID[64], String:text[64], client, bool:IgnoreCooldown=false, } else { - decl String:TimeBuffer[128]; + char TimeBuffer[128]; int tstamp = KvGetNum(g_hBanFile, "length"); tstamp = (tstamp - GetTime()); @@ -563,45 +482,6 @@ bool:SetTag(String:SID[64], String:text[64], client, bool:IgnoreCooldown=false, } } - if (!IgnoreCooldown) - { - KvRewind(g_hConfigFile); - - if (KvJumpToKey(g_hConfigFile, SID, true)) - { - if (KvGetNum(g_hConfigFile, "tagcd") < GetTime()) - { - KvSetNum(g_hConfigFile, "tagcd", GetTime() + GetConVarInt(g_hCoolDown)); - } - else - { - decl String:TimeBuffer[128]; - int tstamp = KvGetNum(g_hConfigFile, "tagcd"); - tstamp = (tstamp - GetTime()); - int hrs = (tstamp / 3600); - int mins = ((tstamp / 60) % 60); - int sec = (tstamp % 60); - - if (tstamp > 3600) - { - Format(TimeBuffer, sizeof(TimeBuffer), "%d %s, %d %s, %d %s", hrs, SingularOrMultiple(hrs) ? "Hours" : "Hour", mins, SingularOrMultiple(mins) ? "Minutes" : "Minute", sec, SingularOrMultiple(sec) ? "Seconds" : "Second"); - } - else if (tstamp > 60) - { - Format(TimeBuffer, sizeof(TimeBuffer), "%d %s, %d %s", mins, SingularOrMultiple(mins) ? "Minutes" : "Minute", sec, SingularOrMultiple(sec) ? "Seconds" : "Second"); - } - else - { - Format(TimeBuffer, sizeof(TimeBuffer), "%d %s", sec, SingularOrMultiple(sec) ? "Seconds" : "Second"); - } - //Format(TimeBuffer, sizeof(TimeBuffer), "%d Hours, %d Minutes, %d Seconds", hrs, mins, sec); - - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}]{default} Time remaining until you can change your {green}tag{default}: {green}%s", TimeBuffer); - return false; - } - } - } - KvRewind(g_hConfigFile); KvRewind(g_hBanFile); @@ -613,7 +493,7 @@ bool:SetTag(String:SID[64], String:text[64], client, bool:IgnoreCooldown=false, } else { - decl String:FormattedText[64]; + char FormattedText[64]; VFormat(FormattedText, sizeof(FormattedText), "%.24s ", 2); KvSetString(g_hConfigFile, "tag", FormattedText); @@ -631,7 +511,7 @@ bool:SetTag(String:SID[64], String:text[64], client, bool:IgnoreCooldown=false, return true; } -bool:RemoveCCC(String:SID[64]) +bool RemoveCCC(char SID[64]) { KvRewind(g_hConfigFile); @@ -654,7 +534,7 @@ bool:RemoveCCC(String:SID[64]) return true; } -bool:BanCCC(String:SID[64], client, target, String:Time[128]) +bool BanCCC(char SID[64], int client, int target, char Time[128]) { KvRewind(g_hBanFile); @@ -666,7 +546,7 @@ bool:BanCCC(String:SID[64], client, target, String:Time[128]) if (KvJumpToKey(g_hBanFile, SID, true)) { - new time = StringToInt(Time); + int time = StringToInt(Time); time = GetTime() + (time * 60); if (StringToInt(Time) == 0) @@ -683,7 +563,7 @@ bool:BanCCC(String:SID[64], client, target, String:Time[128]) return true; } -bool:UnBanCCC(String:SID[64], client, target) +bool UnBanCCC(char SID[64], int client, int target) { KvRewind(g_hBanFile); @@ -694,7 +574,7 @@ bool:UnBanCCC(String:SID[64], client, target) } else { - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Client not restricted"); + CReplyToCommand(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Client not restricted"); return false; } @@ -703,6 +583,22 @@ bool:UnBanCCC(String:SID[64], client, target) return true; } +bool ToggleCCC(char SID[64], int client) +{ + KvRewind(g_hConfigFile); + + if (KvJumpToKey(g_hConfigFile, SID, true)) + { + g_bTagToggled[client] = view_as(KvGetNum(g_hConfigFile, "toggled", 0)); + g_bTagToggled[client] = !g_bTagToggled[client]; + KvSetNum(g_hConfigFile, "toggled", view_as(g_bTagToggled[client])); + } + + KvRewind(g_hConfigFile); + KeyValuesToFile(g_hConfigFile, g_sPath); + return true; +} + // .d8888b. .d88888b. 888b d888 888b d888 d8888 888b 888 8888888b. .d8888b. // d88P Y88b d88P" "Y88b 8888b d8888 8888b d8888 d88888 8888b 888 888 "Y88b d88P Y88b // 888 888 888 888 88888b.d88888 88888b.d88888 d88P888 88888b 888 888 888 Y88b. @@ -713,7 +609,7 @@ bool:UnBanCCC(String:SID[64], client, target) // "Y8888P" "Y88888P" 888 888 888 888 d88P 888 888 Y888 8888888P" "Y8888P" // -public Action:Command_ReloadConfig(client, args) +public Action Command_ReloadConfig(int client, int args) { LoadConfig(); @@ -724,11 +620,11 @@ public Action:Command_ReloadConfig(client, args) return Plugin_Handled; } -public Action:Command_TagMenu(client, args) +public Action Command_TagMenu(int client, int args) { - if (client == 0) + if (!client) { - PrintToServer("[CCC] Cannot use command from server console"); + ReplyToCommand(client, "[CCC] Cannot use command from server console"); return Plugin_Handled; } @@ -736,14 +632,23 @@ public Action:Command_TagMenu(client, args) return Plugin_Handled; } -public Action:Command_Say(client, const String:command[], argc) +public Action Command_Say(int client, const char[] command, int argc) { + char text[MAX_CHAT_LENGTH]; + GetCmdArgString(text, sizeof(text)); + + if (client && !HasFlag(client, Admin_Generic)) + { + if (MakeStringPrintable(text, sizeof(text), "")) + { + return Plugin_Handled; + } + } + if (g_bWaitingForChatInput[client]) { - decl String:text[64]; - decl String:SID[64]; + char SID[64]; GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID)); - GetCmdArgString(text, sizeof(text)); if (text[strlen(text)-1] == '"') { @@ -754,13 +659,8 @@ public Action:Command_Say(client, const String:command[], argc) g_bWaitingForChatInput[client] = false; ReplaceString(g_sReceivedChatInput[client], sizeof(g_sReceivedChatInput), "\"", "'"); - if (!HasFlag(client, Admin_Cheats) && !StrEqual(SID, "STEAM_0:0:50540848", true)) - { - if (MakeStringPrintable(text, sizeof(text), "")) - { - return Plugin_Handled; - } - } + if (g_sReceivedChatInput[client][0] != '#') + Format(g_sReceivedChatInput[client], sizeof(g_sReceivedChatInput[]), "#%s", g_sReceivedChatInput[client]); if (StrEqual(g_sInputType[client], "ChangeTag")) { @@ -816,18 +716,19 @@ public Action:Command_Say(client, const String:command[], argc) } else if (StrEqual(g_sInputType[client], "MenuForceTag")) { - if (SetTag(g_sATargetSID[client], g_sReceivedChatInput[client], client, true, true)) + if (SetTag(g_sATargetSID[client], g_sReceivedChatInput[client], client, true)) { - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Successfully set {green}%N's tag{default}!", g_iATarget[client]); + CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Successfully set {green}%N's{default} tag to: {green}%s{default}!", g_iATarget[client], g_sReceivedChatInput[client]); } } else if (StrEqual(g_sInputType[client], "MenuForceTagColor")) { if (IsValidHex(g_sReceivedChatInput[client])) { - if (SetColor(g_sATargetSID[client], "tagcolor", g_sReceivedChatInput[client], client, true, true)) + if (SetColor(g_sATargetSID[client], "tagcolor", g_sReceivedChatInput[client], client, true)) { - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Successfully set {green}%N's tag color{default}!", g_iATarget[client]); + ReplaceString(g_sReceivedChatInput[client], sizeof(g_sReceivedChatInput[]), "#", ""); + CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Successfully set {green}%N's{default} tag color to: \x07%s#%s{default}!", g_iATarget[client], g_sReceivedChatInput[client], g_sReceivedChatInput[client]); } } else @@ -839,9 +740,10 @@ public Action:Command_Say(client, const String:command[], argc) { if (IsValidHex(g_sReceivedChatInput[client])) { - if (SetColor(g_sATargetSID[client], "namecolor", g_sReceivedChatInput[client], client, true, true)) + if (SetColor(g_sATargetSID[client], "namecolor", g_sReceivedChatInput[client], client, true)) { - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Successfully set {green}%N's name color{default}!", g_iATarget[client]); + ReplaceString(g_sReceivedChatInput[client], sizeof(g_sReceivedChatInput[]), "#", ""); + CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Successfully set {green}%N's{default} name color to: \x07%s#%s{default}!", g_iATarget[client], g_sReceivedChatInput[client], g_sReceivedChatInput[client]); } } else @@ -853,9 +755,10 @@ public Action:Command_Say(client, const String:command[], argc) { if (IsValidHex(g_sReceivedChatInput[client])) { - if (SetColor(g_sATargetSID[client], "textcolor", g_sReceivedChatInput[client], client, true, true)) + if (SetColor(g_sATargetSID[client], "textcolor", g_sReceivedChatInput[client], client, true)) { - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Successfully set {green}%N's text color{default}!", g_iATarget[client]); + ReplaceString(g_sReceivedChatInput[client], sizeof(g_sReceivedChatInput[]), "#", ""); + CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Successfully set {green}%N's{default} text color to: \x07%s#%s{default}!", g_iATarget[client], g_sReceivedChatInput[client], g_sReceivedChatInput[client]); } } else @@ -869,33 +772,29 @@ public Action:Command_Say(client, const String:command[], argc) else { if (StrEqual(command, "say_team", false)) - { g_msgIsTeammate = true; - } else - { g_msgIsTeammate = false; - } } return Plugin_Continue; } -public Action:Event_PlayerSay(Handle:event, const String:name[], bool:dontBroadcast) +public Action Event_PlayerSay(Handle event, const char[] name, bool dontBroadcast) { if (g_msgAuthor == -1 || GetClientOfUserId(GetEventInt(event, "userid")) != g_msgAuthor) { return; } - decl players[MaxClients + 1]; - new playersNum = 0; + int[] players = new int[MaxClients + 1]; + int playersNum = 0; if (g_msgIsTeammate && g_msgAuthor > 0) { - new team = GetClientTeam(g_msgAuthor); + int team = GetClientTeam(g_msgAuthor); - for (new client = 1; client <= MaxClients; client++) + for (int client = 1; client <= MaxClients; client++) { if (IsClientInGame(client) && GetClientTeam(client) == team) { @@ -906,7 +805,7 @@ public Action:Event_PlayerSay(Handle:event, const String:name[], bool:dontBroadc } else { - for (new client = 1; client <= MaxClients; client++) + for (int client = 1; client <= MaxClients; client++) { if (IsClientInGame(client)) { @@ -916,13 +815,13 @@ public Action:Event_PlayerSay(Handle:event, const String:name[], bool:dontBroadc } } - if (playersNum == 0) + if (!playersNum) { g_msgAuthor = -1; return; } - new Handle:SayText2 = StartMessage("SayText2", players, playersNum, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS); + Handle SayText2 = StartMessage("SayText2", players, playersNum, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS); if (GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf) { @@ -938,6 +837,7 @@ public Action:Event_PlayerSay(Handle:event, const String:name[], bool:dontBroadc BfWriteString(SayText2, g_msgFinal); EndMessage(); } + g_msgAuthor = -1; } @@ -945,47 +845,29 @@ public Action:Event_PlayerSay(Handle:event, const String:name[], bool:dontBroadc //Force Tag ///// //////////////////////////////////////////// -public Action:Command_ForceTag(client, args) +public Action Command_ForceTag(int client, int args) { - if (client == 0) - { - PrintToServer("[CCC] Cannot use command from server console"); - return Plugin_Handled; - } - if (args < 2) { - PrintToChat(client, "[SM] Usage: sm_forcetag "); + ReplyToCommand(client, "[SM] Usage: sm_forcetag "); return Plugin_Handled; } - decl String:arg[64]; - decl String:arg2[64]; - GetCmdArg(1, arg, sizeof(arg)); - GetCmdArg(2, arg2, sizeof(arg2)); + int iTarget; + char sTarget[64]; + char sTag[64]; + GetCmdArg(1, sTarget, sizeof(sTarget)); + GetCmdArg(2, sTag, sizeof(sTag)); - decl String:target_name[MAX_TARGET_LENGTH]; - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; - - if (NoFilter(arg)) + if ((iTarget = FindTarget(client, sTarget, true)) == -1) { - PrintToChat(client, "[SM] This command only supports special filters <@aim|@me>."); return Plugin_Handled; } - if ((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_CONNECTED|COMMAND_FILTER_NO_BOTS, target_name, sizeof(target_name), tn_is_ml)) <= 0) - { - ReplyToTargetError(client, target_count); - return Plugin_Handled; - } + char SID[64]; + GetClientAuthId(iTarget, AuthId_Steam2, SID, sizeof(SID)); - for (new i = 0; i < target_count; i++) - { - decl String:SID[64]; - GetClientAuthId(target_list[i], AuthId_Steam2, SID, sizeof(SID)); - - SetTag(SID, arg2, client, true, true); - } + SetTag(SID, sTag, client, true); return Plugin_Handled; } @@ -994,24 +876,15 @@ public Action:Command_ForceTag(client, args) //Force Tag Color ///// //////////////////////////////////////////// -public Action:Command_ForceTagColor(client, args) +public Action Command_ForceTagColor(int client, int args) { - if (client == 0) - { - PrintToServer("[CCC] Cannot use command from server console"); - return Plugin_Handled; - } - if (args < 2) { - PrintToChat(client, "[SM] Usage: sm_forcetagcolor "); + ReplyToCommand(client, "[SM] Usage: sm_forcetagcolor "); return Plugin_Handled; } - if (ForceColor(client, "tagcolor") != 0) - { - return Plugin_Handled; - } + ForceColor(client, "tagcolor"); return Plugin_Handled; } @@ -1020,24 +893,15 @@ public Action:Command_ForceTagColor(client, args) //Force Name Color ///// //////////////////////////////////////////// -public Action:Command_ForceNameColor(client, args) +public Action Command_ForceNameColor(int client, int args) { - if (client == 0) - { - PrintToServer("[CCC] Cannot use command from server console"); - return Plugin_Handled; - } - if (args < 2) { - PrintToChat(client, "[SM] Usage: sm_forcenamecolor "); + ReplyToCommand(client, "[SM] Usage: sm_forcenamecolor "); return Plugin_Handled; } - if (ForceColor(client, "namecolor") != 0) - { - return Plugin_Handled; - } + ForceColor(client, "namecolor"); return Plugin_Handled; } @@ -1046,24 +910,15 @@ public Action:Command_ForceNameColor(client, args) //Force Text Color ///// //////////////////////////////////////////// -public Action:Command_ForceTextColor(client, args) +public Action Command_ForceTextColor(int client, int args) { - if (client == 0) - { - PrintToServer("[CCC] Cannot use command from server console"); - return Plugin_Handled; - } - if (args < 2) { - PrintToChat(client, "[SM] Usage: sm_forcetextcolor "); + ReplyToCommand(client, "[SM] Usage: sm_forcetextcolor "); return Plugin_Handled; } - if (ForceColor(client, "textcolor") != 0) - { - return Plugin_Handled; - } + ForceColor(client, "textcolor"); return Plugin_Handled; } @@ -1072,46 +927,28 @@ public Action:Command_ForceTextColor(client, args) //Reset Tag & Colors ///// //////////////////////////////////////////// -public Action:Command_CCCReset(client, args) +public Action Command_CCCReset(int client, int args) { - if (client == 0) - { - PrintToServer("[CCC] Cannot use command from server console"); - return Plugin_Handled; - } - if (args < 1) { - PrintToChat(client, "[SM] Usage: sm_cccreset "); + ReplyToCommand(client, "[SM] Usage: sm_cccreset "); return Plugin_Handled; } - decl String:arg[64]; - GetCmdArg(1, arg, sizeof(arg)); + int iTarget; + char sTarget[64]; + GetCmdArg(1, sTarget, sizeof(sTarget)); - decl String:target_name[MAX_TARGET_LENGTH]; - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; - - if (NoFilter(arg)) + if ((iTarget = FindTarget(client, sTarget, true)) == -1) { - PrintToChat(client, "[SM] This command only supports special filters <@aim|@me>."); return Plugin_Handled; } - if ((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_CONNECTED|COMMAND_FILTER_NO_BOTS, target_name, sizeof(target_name), tn_is_ml)) <= 0) - { - ReplyToTargetError(client, target_count); - return Plugin_Handled; - } + char SID[64]; + GetClientAuthId(iTarget, AuthId_Steam2, SID, sizeof(SID)); - for (new i = 0; i < target_count; i++) - { - decl String:SID[64]; - GetClientAuthId(target_list[i], AuthId_Steam2, SID, sizeof(SID)); - - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Cleared {green}%N's tag {default}&{green} colors{default}.", target_list[i]); - RemoveCCC(SID); - } + CReplyToCommand(client, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Cleared {green}%N's tag {default}&{green} colors{default}.", iTarget); + RemoveCCC(SID); return Plugin_Handled; } @@ -1120,52 +957,33 @@ public Action:Command_CCCReset(client, args) //Ban Tag & Color Changes ///// //////////////////////////////////////////// -public Action:Command_CCCBan(client, args) +public Action Command_CCCBan(int client, int args) { - if (client == 0) - { - PrintToServer("[CCC] Cannot use command from server console"); - return Plugin_Handled; - } - if (args < 1) { - PrintToChat(client, "[SM] Usage: sm_cccban "); + ReplyToCommand(client, "[SM] Usage: sm_cccban "); return Plugin_Handled; } - decl String:arg[64]; - decl String:time[128]; - GetCmdArg(1, arg, sizeof(arg)); - - decl String:target_name[MAX_TARGET_LENGTH]; - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; + int iTarget; + char sTarget[64]; + char sTime[128]; + GetCmdArg(1, sTarget, sizeof(sTarget)); if (args > 1) { - GetCmdArg(2, time, sizeof(time)); + GetCmdArg(2, sTime, sizeof(sTime)); } - if (NoFilter(arg)) + if ((iTarget = FindTarget(client, sTarget, true)) == -1) { - PrintToChat(client, "[SM] This command only supports special filters <@aim|@me>."); return Plugin_Handled; } - if ((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_CONNECTED|COMMAND_FILTER_NO_BOTS, target_name, sizeof(target_name), tn_is_ml)) <= 0) - { - ReplyToTargetError(client, target_count); - return Plugin_Handled; - } + char SID[64]; + GetClientAuthId(iTarget, AuthId_Steam2, SID, sizeof(SID)); - for (new i = 0; i < target_count; i++) - { - decl String:SID[64]; - GetClientAuthId(target_list[i], AuthId_Steam2, SID, sizeof(SID)); - - RemoveCCC(SID); - BanCCC(SID, client, target_list[i], time); - } + BanCCC(SID, client, iTarget, sTime); return Plugin_Handled; } @@ -1174,45 +992,27 @@ public Action:Command_CCCBan(client, args) //Allow Tag & Color Changes ///// //////////////////////////////////////////// -public Action:Command_CCCUnban(client, args) +public Action Command_CCCUnban(int client, int args) { - if (client == 0) - { - PrintToServer("[CCC] Cannot use command from server console"); - return Plugin_Handled; - } - if (args < 1) { - PrintToChat(client, "[SM] Usage: sm_cccunban "); + ReplyToCommand(client, "[SM] Usage: sm_cccunban "); return Plugin_Handled; } - decl String:arg[64]; - GetCmdArg(1, arg, sizeof(arg)); + int iTarget; + char sTarget[64]; + GetCmdArg(1, sTarget, sizeof(sTarget)); - decl String:target_name[MAX_TARGET_LENGTH]; - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; - - if (NoFilter(arg)) + if ((iTarget = FindTarget(client, sTarget, true)) == -1) { - PrintToChat(client, "[SM] This command only supports special filters <@aim|@me>."); return Plugin_Handled; } - if ((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_CONNECTED|COMMAND_FILTER_NO_BOTS, target_name, sizeof(target_name), tn_is_ml)) <= 0) - { - ReplyToTargetError(client, target_count); - return Plugin_Handled; - } + char SID[64]; + GetClientAuthId(iTarget, AuthId_Steam2, SID, sizeof(SID)); - for (new i = 0; i < target_count; i++) - { - decl String:SID[64]; - GetClientAuthId(target_list[i], AuthId_Steam2, SID, sizeof(SID)); - - UnBanCCC(SID, client, target_list[i]); - } + UnBanCCC(SID, client, iTarget); return Plugin_Handled; } @@ -1221,36 +1021,31 @@ public Action:Command_CCCUnban(client, args) //Set Tag ///// //////////////////////////////////////////// -public Action:Command_SetTag(client, args) +public Action Command_SetTag(int client, int args) { - if (client == 0) + if (!client) { - PrintToServer("[CCC] Cannot use command from server console"); + ReplyToCommand(client, "[CCC] Cannot use command from server console"); return Plugin_Handled; } if (args < 1) { - PrintToChat(client, "[SM] Usage: sm_tag "); + ReplyToCommand(client, "[SM] Usage: sm_tag "); Menu_Main(client); return Plugin_Handled; } - decl String:SID[64]; - decl String:arg[64]; + char SID[64]; + char arg[64]; GetCmdArgString(arg, sizeof(arg)); GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID)); - //if (arg[strlen(arg)-1] == '"') - //{ - // arg[strlen(arg)-1] = '\0'; - //} - ReplaceString(arg, sizeof(arg), "\"", "'"); if (SetTag(SID, arg, client)) { - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}]{default} Successfully set your {green}tag{default} to: {green}%s{default}", arg); + CReplyToCommand(client, "{green}[{red}C{green}C{blue}C{green}]{default} Successfully set your {green}tag{default} to: {green}%s{default}", arg); } return Plugin_Handled; @@ -1260,15 +1055,15 @@ public Action:Command_SetTag(client, args) //Clear Tag ///// //////////////////////////////////////////// -public Action:Command_ClearTag(client, args) +public Action Command_ClearTag(int client, int args) { - if (client == 0) + if (!client) { - PrintToServer("[CCC] Cannot use command from server console"); + ReplyToCommand(client, "[CCC] Cannot use command from server console"); return Plugin_Handled; } - decl String:SID[64]; + char SID[64]; GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID)); SetTag(SID, "", client); @@ -1280,11 +1075,11 @@ public Action:Command_ClearTag(client, args) //Set Tag Color ///// //////////////////////////////////////////// -public Action:Command_SetTagColor(client, args) +public Action Command_SetTagColor(int client, int args) { - if (client == 0) + if (!client) { - PrintToServer("[CCC] Cannot use command from server console"); + ReplyToCommand(client, "[CCC] Cannot use command from server console"); return Plugin_Handled; } @@ -1295,18 +1090,18 @@ public Action:Command_SetTagColor(client, args) return Plugin_Handled; } - decl String:SID[64]; - decl String:col[64]; + char SID[64]; + char col[64]; GetCmdArg(1, col, sizeof(col)); GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID)); if (IsValidRGBNum(col)) { - new String:g[8]; - new String:b[8]; + char g[8]; + char b[8]; GetCmdArg(2, g, sizeof(g)); GetCmdArg(3, b, sizeof(b)); - new hex; + int hex; hex |= ((StringToInt(col) & 0xFF) << 16); hex |= ((StringToInt(g) & 0xFF) << 8); hex |= ((StringToInt(b) & 0xFF) << 0); @@ -1320,12 +1115,12 @@ public Action:Command_SetTagColor(client, args) if (SetColor(SID, "tagcolor", col, client)) { ReplaceString(col, sizeof(col), "#", ""); - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}]{default} Successfully set your {green}tag color{default} to: \x07%s#%s", col, col); + CReplyToCommand(client, "{green}[{red}C{green}C{blue}C{green}]{default} Successfully set your {green}tag color{default} to: \x07%s#%s", col, col); } } else { - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}]{default} Invalid HEX|RGB color code given."); + CReplyToCommand(client, "{green}[{red}C{green}C{blue}C{green}]{default} Invalid HEX|RGB color code given."); } return Plugin_Handled; @@ -1335,15 +1130,15 @@ public Action:Command_SetTagColor(client, args) //Clear Tag Color ///// //////////////////////////////////////////// -public Action:Command_ClearTagColor(client, args) +public Action Command_ClearTagColor(int client, int args) { - if (client == 0) + if (!client) { - PrintToServer("[CCC] Cannot use command from server console"); + ReplyToCommand(client, "[CCC] Cannot use command from server console"); return Plugin_Handled; } - decl String:SID[64]; + char SID[64]; GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID)); SetColor(SID, "tagcolor", "", client); @@ -1355,9 +1150,9 @@ public Action:Command_ClearTagColor(client, args) //Set Name Color ///// //////////////////////////////////////////// -public Action:Command_SetNameColor(client, args) +public Action Command_SetNameColor(int client, int args) { - if (client == 0) + if (!client) { PrintToServer("[CCC] Cannot use command from server console"); return Plugin_Handled; @@ -1370,18 +1165,18 @@ public Action:Command_SetNameColor(client, args) return Plugin_Handled; } - decl String:SID[64]; - decl String:col[64]; + char SID[64]; + char col[64]; GetCmdArg(1, col, sizeof(col)); GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID)); if (IsValidRGBNum(col)) { - new String:g[8]; - new String:b[8]; + char g[8]; + char b[8]; GetCmdArg(2, g, sizeof(g)); GetCmdArg(3, b, sizeof(b)); - new hex; + int hex; hex |= ((StringToInt(col) & 0xFF) << 16); hex |= ((StringToInt(g) & 0xFF) << 8); hex |= ((StringToInt(b) & 0xFF) << 0); @@ -1395,12 +1190,12 @@ public Action:Command_SetNameColor(client, args) if (SetColor(SID, "namecolor", col, client)) { ReplaceString(col, sizeof(col), "#", ""); - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}]{default} Successfully set your {green}name color{default} to: \x07%s#%s", col, col); + CReplyToCommand(client, "{green}[{red}C{green}C{blue}C{green}]{default} Successfully set your {green}name color{default} to: \x07%s#%s", col, col); } } else { - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}]{default} Invalid HEX|RGB color code given."); + CReplyToCommand(client, "{green}[{red}C{green}C{blue}C{green}]{default} Invalid HEX|RGB color code given."); } return Plugin_Handled; @@ -1410,15 +1205,15 @@ public Action:Command_SetNameColor(client, args) //Clear Name Color ///// //////////////////////////////////////////// -public Action:Command_ClearNameColor(client, args) +public Action Command_ClearNameColor(int client, int args) { - if (client == 0) + if (!client) { PrintToServer("[CCC] Cannot use command from server console"); return Plugin_Handled; } - decl String:SID[64]; + char SID[64]; GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID)); SetColor(SID, "namecolor", "", client); @@ -1430,9 +1225,9 @@ public Action:Command_ClearNameColor(client, args) //Set Text Color ///// //////////////////////////////////////////// -public Action:Command_SetTextColor(client, args) +public Action Command_SetTextColor(int client, int args) { - if (client == 0) + if (!client) { PrintToServer("[CCC] Cannot use command from server console"); return Plugin_Handled; @@ -1445,18 +1240,18 @@ public Action:Command_SetTextColor(client, args) return Plugin_Handled; } - decl String:SID[64]; - decl String:col[64]; + char SID[64]; + char col[64]; GetCmdArg(1, col, sizeof(col)); GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID)); if (IsValidRGBNum(col)) { - new String:g[8]; - new String:b[8]; + char g[8]; + char b[8]; GetCmdArg(2, g, sizeof(g)); GetCmdArg(3, b, sizeof(b)); - new hex; + int hex; hex |= ((StringToInt(col) & 0xFF) << 16); hex |= ((StringToInt(g) & 0xFF) << 8); hex |= ((StringToInt(b) & 0xFF) << 0); @@ -1470,12 +1265,12 @@ public Action:Command_SetTextColor(client, args) if (SetColor(SID, "textcolor", col, client)) { ReplaceString(col, sizeof(col), "#", ""); - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}]{default} Successfully set your {green}text color{default} to: \x07%s#%s", col, col); + CReplyToCommand(client, "{green}[{red}C{green}C{blue}C{green}]{default} Successfully set your {green}text color{default} to: \x07%s#%s", col, col); } } else { - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}]{default} Invalid HEX|RGB color code given."); + CReplyToCommand(client, "{green}[{red}C{green}C{blue}C{green}]{default} Invalid HEX|RGB color code given."); } return Plugin_Handled; @@ -1485,15 +1280,15 @@ public Action:Command_SetTextColor(client, args) //Clear Text Color ///// //////////////////////////////////////////// -public Action:Command_ClearTextColor(client, args) +public Action Command_ClearTextColor(int client, int args) { - if (client == 0) + if (!client) { PrintToServer("[CCC] Cannot use command from server console"); return Plugin_Handled; } - decl String:SID[64]; + char SID[64]; GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID)); SetColor(SID, "textcolor", "", client); @@ -1501,25 +1296,20 @@ public Action:Command_ClearTextColor(client, args) return Plugin_Handled; } -public Action:Command_ToggleTag(client, args) +public Action Command_ToggleTag(int client, int args) { - if (client == 0) + if (!client) { PrintToServer("[CCC] Cannot use command from server console"); return Plugin_Handled; } - if (!HasFlag(client, Admin_Slay)) - { - if (!HasFlag(client, Admin_Custom1)) - { - PrintToChat(client, "[SM] You do not have access to this command."); - return Plugin_Handled; - } - } + //g_bTagToggled[client] = !g_bTagToggled[client]; + char SID[64]; + GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID)); - g_bTagToggled[client] = !g_bTagToggled[client]; - CPrintToChat(client, "{green}[{red}C{green}C{blue}C{green}]{default} {green}Tag and color{default} displaying %s", g_bTagToggled[client] ? "{red}disabled{default}." : "{green}enabled{default}."); + ToggleCCC(SID, client); + CReplyToCommand(client, "{green}[{red}C{green}C{blue}C{green}]{default} {green}Tag and color{default} displaying %s", g_bTagToggled[client] ? "{red}disabled{default}." : "{green}enabled{default}."); return Plugin_Handled; } @@ -1533,7 +1323,7 @@ public Action:Command_ToggleTag(client, args) // 888 " 888 888 888 Y8888 Y88b. .d88P // 888 888 8888888888 888 Y888 "Y88888P" -/*public Handle_Commands(Handle:menu, TopMenuAction:action, TopMenuObject:object_id, param1, String:buffer[], maxlength) +/* public Handle_Commands(Handle menu, TopMenuAction action, TopMenuObject:object_id, param1, char buffer[], maxlength) { if (action == TopMenuAction_DisplayOption) { @@ -1549,7 +1339,7 @@ public Action:Command_ToggleTag(client, args) } } -public Handle_AMenuReset(Handle:menu, TopMenuAction:action, TopMenuObject:object_id, param1, String:buffer[], maxlength) +public Handle_AMenuReset(Handle menu, TopMenuAction action, TopMenuObject:object_id, param1, char buffer[], maxlength) { if(action == TopMenuAction_DisplayOption) { @@ -1557,7 +1347,7 @@ public Handle_AMenuReset(Handle:menu, TopMenuAction:action, TopMenuObject:object } else if(action == TopMenuAction_SelectOption) { - new Handle:MenuAReset = CreateMenu(MenuHandler_AdminReset); + new Handle MenuAReset = CreateMenu(MenuHandler_AdminReset); SetMenuTitle(MenuAReset, "Select a Target (Reset Tag/Colors)"); SetMenuExitBackButton(MenuAReset, true); @@ -1567,7 +1357,7 @@ public Handle_AMenuReset(Handle:menu, TopMenuAction:action, TopMenuObject:object } } -public Handle_AMenuBan(Handle:menu, TopMenuAction:action, TopMenuObject:object_id, param1, String:buffer[], maxlength) +public Handle_AMenuBan(Handle menu, TopMenuAction action, TopMenuObject:object_id, param1, char buffer[], maxlength) { if (action == TopMenuAction_DisplayOption) { @@ -1575,7 +1365,7 @@ public Handle_AMenuBan(Handle:menu, TopMenuAction:action, TopMenuObject:object_i } else if (action == TopMenuAction_SelectOption) { - new Handle:MenuABan = CreateMenu(MenuHandler_AdminBan); + new Handle MenuABan = CreateMenu(MenuHandler_AdminBan); SetMenuTitle(MenuABan, "Select a Target (Ban from Tag/Colors)"); SetMenuExitBackButton(MenuABan, true); @@ -1585,7 +1375,7 @@ public Handle_AMenuBan(Handle:menu, TopMenuAction:action, TopMenuObject:object_i } } -public Handle_AMenuUnBan(Handle:menu, TopMenuAction:action, TopMenuObject:object_id, param1, String:buffer[], maxlength) +public Handle_AMenuUnBan(Handle menu, TopMenuAction action, TopMenuObject:object_id, param1, char buffer[], maxlength) { if(action == TopMenuAction_DisplayOption) { @@ -1595,30 +1385,30 @@ public Handle_AMenuUnBan(Handle:menu, TopMenuAction:action, TopMenuObject:object { AdminMenu_UnBanList(param1); } -}*/ +} */ -public AdminMenu_UnBanList(client) +public void AdminMenu_UnBanList(int client) { - new Handle:MenuAUnBan = CreateMenu(MenuHandler_AdminUnBan); - new String:temp[64]; - SetMenuTitle(MenuAUnBan, "Select a Target (Unban from Tag/Colors)"); - SetMenuExitBackButton(MenuAUnBan, true); - new clients; + Menu MenuAUnBan = new Menu(MenuHandler_AdminUnBan); + char temp[64]; + MenuAUnBan.SetTitle("Select a Target (Unban from Tag/Colors)"); + MenuAUnBan.ExitBackButton = true; + int clients; - for (new i = 1; i <= MaxClients; i++) + for (int i = 1; i <= MaxClients; i++) { KvRewind(g_hBanFile); if (IsClientInGame(i)) { - decl String:SID[64]; + char SID[64]; GetClientAuthId(i, AuthId_Steam2, SID, sizeof(SID)); if (KvJumpToKey(g_hBanFile, SID, false)) { - decl String:info[64]; - decl String:id[32]; - decl remaining; + char info[64]; + char id[32]; + int remaining; KvGetString(g_hBanFile, "length", info, sizeof(info), "0"); remaining = ((StringToInt(info) - GetTime()) / 60); @@ -1641,7 +1431,7 @@ public AdminMenu_UnBanList(client) //PrintToChat(client, "Added uid (%d) with info (%s)", id, info); - AddMenuItem(MenuAUnBan, id, info); + MenuAUnBan.AddItem(id, info); clients++; } @@ -1651,42 +1441,40 @@ public AdminMenu_UnBanList(client) if (!clients) { Format(temp, sizeof(temp), "No banned clients"); - AddMenuItem(MenuAUnBan, "0", temp, ITEMDRAW_DISABLED); + MenuAUnBan.AddItem("0", temp, ITEMDRAW_DISABLED); } - DisplayMenu(MenuAUnBan, client, MENU_TIME_FOREVER); + MenuAUnBan.Display(client, MENU_TIME_FOREVER); } -public MenuHandler_AdminUnBan(Handle:MenuAUnBan, MenuAction:action, param1, param2) +public int MenuHandler_AdminUnBan(Menu MenuAUnBan, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuAUnBan); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_Admin(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:Selected[32]; - decl String:SID[64]; - GetMenuItem(MenuAUnBan, param2, Selected, sizeof(Selected)); - new target; - new userid = StringToInt(Selected); + char Selected[32]; + char SID[64]; + MenuAUnBan.GetItem(param2, Selected, sizeof(Selected)); + int target; + int userid = StringToInt(Selected); target = GetClientOfUserId(userid); - PrintToChat(param1, "%s", Selected); - - if (target == 0) + if (!target) { - CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Player no longer available."); + CReplyToCommand(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Player no longer available."); - /*if (g_hAdminMenu != INVALID_HANDLE) + /*if (g_hAdminMenu != null) { DisplayTopMenu(g_hAdminMenu, param1, TopMenuPosition_LastCategory); }*/ @@ -1698,7 +1486,7 @@ public MenuHandler_AdminUnBan(Handle:MenuAUnBan, MenuAction:action, param1, para UnBanCCC(SID, param1, target); - /*if (g_hAdminMenu != INVALID_HANDLE) + /*if (g_hAdminMenu != null) { DisplayTopMenu(g_hAdminMenu, param1, TopMenuPosition_LastCategory); return; @@ -1707,48 +1495,48 @@ public MenuHandler_AdminUnBan(Handle:MenuAUnBan, MenuAction:action, param1, para Menu_Admin(param1); } + + return 0; } -public Menu_Main(client) +public void Menu_Main(int client) { if (IsVoteInProgress()) - { return; - } - new Handle:MenuMain = CreateMenu(MenuHandler_Main); - SetMenuTitle(MenuMain, "Chat Tags & Colors"); + Menu MenuMain = new Menu(MenuHandler_Main); + MenuMain.SetTitle("Chat Tags & Colors"); - AddMenuItem(MenuMain, "Current", "View Current Settings"); - AddMenuItem(MenuMain, "Tag", "Tag Options"); - AddMenuItem(MenuMain, "Name", "Name Options"); - AddMenuItem(MenuMain, "Chat", "Chat Options"); + MenuMain.AddItem("Current", "View Current Settings"); + MenuMain.AddItem("Tag", "Tag Options"); + MenuMain.AddItem("Name", "Name Options"); + MenuMain.AddItem("Chat", "Chat Options"); if (g_bWaitingForChatInput[client]) { - AddMenuItem(MenuMain, "CancelCInput", "Cancel Chat Input"); + MenuMain.AddItem("CancelCInput", "Cancel Chat Input"); } if (HasFlag(client, Admin_Slay) || HasFlag(client, Admin_Cheats)) { - AddMenuItem(MenuMain, "", "", ITEMDRAW_SPACER); - AddMenuItem(MenuMain, "Admin", "Administrative Options"); + MenuMain.AddItem("", "", ITEMDRAW_SPACER); + MenuMain.AddItem("Admin", "Administrative Options"); } - DisplayMenu(MenuMain, client, MENU_TIME_FOREVER); + MenuMain.Display(client, MENU_TIME_FOREVER); } -public MenuHandler_Main(Handle:MenuMain, MenuAction:action, param1, param2) +public int MenuHandler_Main(Menu MenuMain, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuMain); - return; + return 0; } if (action == MenuAction_Select) { - decl String:Selected[32]; + char Selected[32]; GetMenuItem(MenuMain, param2, Selected, sizeof(Selected)); if (StrEqual(Selected, "Tag")) @@ -1776,40 +1564,40 @@ public MenuHandler_Main(Handle:MenuMain, MenuAction:action, param1, param2) } else if (StrEqual(Selected, "Current")) { - decl String:SID[64]; + char SID[64]; GetClientAuthId(param1, AuthId_Steam2, SID, sizeof(SID)); KvRewind(g_hConfigFile); if (KvJumpToKey(g_hConfigFile, SID)) { - new Handle:hMenuCurrent = CreateMenu(MenuHandler_Current); - decl String:sTag[32]; - decl String:sTagColor[32]; - decl String:sNameColor[32]; - decl String:sTextColor[32]; - decl String:sTagF[64]; - decl String:sTagColorF[64]; - decl String:sNameColorF[64]; - decl String:sTextColorF[64]; - SetMenuTitle(hMenuCurrent, "Current Settings:"); - SetMenuExitBackButton(hMenuCurrent, true); + Menu hMenuCurrent = new Menu(MenuHandler_Current); + char sTag[32]; + char sTagColor[32]; + char sNameColor[32]; + char sTextColor[32]; + char sTagF[64]; + char sTagColorF[64]; + char sNameColorF[64]; + char sTextColorF[64]; + hMenuCurrent.SetTitle("Current Settings:"); + hMenuCurrent.ExitBackButton = true; KvGetString(g_hConfigFile, "tag", sTag, sizeof(sTag), ""); KvGetString(g_hConfigFile, "tagcolor", sTagColor, sizeof(sTagColor), ""); KvGetString(g_hConfigFile, "namecolor", sNameColor, sizeof(sNameColor), ""); KvGetString(g_hConfigFile, "textcolor", sTextColor, sizeof(sTextColor), ""); - Format(sTagF, sizeof(sTagF), "Current sTag: %s", sTag); - Format(sTagColorF, sizeof(sTagColorF), "Current sTag Color: %s", sTagColor); + Format(sTagF, sizeof(sTagF), "Current Tag: %s", sTag); + Format(sTagColorF, sizeof(sTagColorF), "Current Tag Color: %s", sTagColor); Format(sNameColorF, sizeof(sNameColorF), "Current Name Color: %s", sNameColor); Format(sTextColorF, sizeof(sTextColorF), "Current Text Color: %s", sTextColor); - AddMenuItem(hMenuCurrent, "sTag", sTagF, ITEMDRAW_DISABLED); - AddMenuItem(hMenuCurrent, "sTagColor", sTagColorF, ITEMDRAW_DISABLED); - AddMenuItem(hMenuCurrent, "sNameColor", sNameColorF, ITEMDRAW_DISABLED); - AddMenuItem(hMenuCurrent, "sTextColor", sTextColorF, ITEMDRAW_DISABLED); + hMenuCurrent.AddItem("sTag", sTagF, ITEMDRAW_DISABLED); + hMenuCurrent.AddItem("sTagColor", sTagColorF, ITEMDRAW_DISABLED); + hMenuCurrent.AddItem("sNameColor", sNameColorF, ITEMDRAW_DISABLED); + hMenuCurrent.AddItem("sTextColor", sTextColorF, ITEMDRAW_DISABLED); - DisplayMenu(hMenuCurrent, param1, MENU_TIME_FOREVER); + hMenuCurrent.Display(param1, MENU_TIME_FOREVER); } else @@ -1822,143 +1610,140 @@ public MenuHandler_Main(Handle:MenuMain, MenuAction:action, param1, param2) PrintToChat(param1, "congrats you broke it"); } } + + return 0; } -public MenuHandler_Current(Handle:hMenuCurrent, MenuAction:action, param1, param2) +public int MenuHandler_Current(Menu hMenuCurrent, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(hMenuCurrent); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_Main(param1); - return; + return 0; } + + return 0; } -public Menu_Admin(client) +public void Menu_Admin(int client) { if (IsVoteInProgress()) - { return; - } - new Handle:MenuAdmin = CreateMenu(MenuHandler_Admin); - SetMenuTitle(MenuAdmin, "Chat Tags & Colors Admin"); - SetMenuExitBackButton(MenuAdmin, true); + Menu MenuAdmin = new Menu(MenuHandler_Admin); + MenuAdmin.SetTitle("Chat Tags & Colors Admin"); + MenuAdmin.ExitBackButton = true; - AddMenuItem(MenuAdmin, "Reset", "Reset a client's Tag & Colors"); - AddMenuItem(MenuAdmin, "Ban", "Reset and Ban a client from the Tag & Colors system"); - AddMenuItem(MenuAdmin, "Unban", "Unban a client from the Tag & Colors system"); + MenuAdmin.AddItem("Reset", "Reset a client's Tag & Colors"); + MenuAdmin.AddItem("Ban", "Ban a client from the Tag & Colors system"); + MenuAdmin.AddItem("Unban", "Unban a client from the Tag & Colors system"); if (HasFlag(client, Admin_Cheats)) { - AddMenuItem(MenuAdmin, "ForceTag", "Forcefully change a client's Tag"); - AddMenuItem(MenuAdmin, "ForceTagColor", "Forcefully change a client's Tag Color"); - AddMenuItem(MenuAdmin, "ForceNameColor", "Forcefully change a client's Name Color"); - AddMenuItem(MenuAdmin, "ForceTextColor", "Forcefully change a client's Chat Color"); + MenuAdmin.AddItem("ForceTag", "Forcefully change a client's Tag"); + MenuAdmin.AddItem("ForceTagColor", "Forcefully change a client's Tag Color"); + MenuAdmin.AddItem("ForceNameColor", "Forcefully change a client's Name Color"); + MenuAdmin.AddItem("ForceTextColor", "Forcefully change a client's Chat Color"); } - if (g_bWaitingForChatInput[client]) - { - AddMenuItem(MenuAdmin, "CancelCInput", "Cancel Chat Input"); - } - - DisplayMenu(MenuAdmin, client, MENU_TIME_FOREVER); + MenuAdmin.Display(client, MENU_TIME_FOREVER); } -public MenuHandler_Admin(Handle:MenuAdmin, MenuAction:action, param1, param2) +public int MenuHandler_Admin(Menu MenuAdmin, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuAdmin); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_Main(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:Selected[32]; - GetMenuItem(MenuAdmin, param2, Selected, sizeof(Selected)); + char Selected[32]; + MenuAdmin.GetItem(param2, Selected, sizeof(Selected)); if (StrEqual(Selected, "Reset")) { - new Handle:MenuAReset = CreateMenu(MenuHandler_AdminReset); - SetMenuTitle(MenuAReset, "Select a Target (Reset Tag/Colors)"); - SetMenuExitBackButton(MenuAReset, true); + Menu MenuAReset = new Menu(MenuHandler_AdminReset); + MenuAReset.SetTitle("Select a Target (Reset Tag/Colors)"); + MenuAReset.ExitBackButton = true; AddTargetsToMenu2(MenuAReset, 0, COMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED); - DisplayMenu(MenuAReset, param1, MENU_TIME_FOREVER); - return; + MenuAReset.Display(param1, MENU_TIME_FOREVER); + return 0; } else if (StrEqual(Selected, "Ban")) { - new Handle:MenuABan = CreateMenu(MenuHandler_AdminBan); - SetMenuTitle(MenuABan, "Select a Target (Ban from Tag/Colors)"); - SetMenuExitBackButton(MenuABan, true); + Menu MenuABan = new Menu(MenuHandler_AdminBan); + MenuABan.SetTitle("Select a Target (Ban from Tag/Colors)"); + MenuABan.ExitBackButton = true; AddTargetsToMenu2(MenuABan, 0, COMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED); - DisplayMenu(MenuABan, param1, MENU_TIME_FOREVER); - return; + MenuABan.Display(param1, MENU_TIME_FOREVER); + return 0; } else if (StrEqual(Selected, "Unban")) { AdminMenu_UnBanList(param1); - return; + return 0; } else if (StrEqual(Selected, "ForceTag")) { - new Handle:MenuAFTag = CreateMenu(MenuHandler_AdminForceTag); - SetMenuTitle(MenuAFTag, "Select a Target (Force Tag)"); - SetMenuExitBackButton(MenuAFTag, true); + Menu MenuAFTag = new Menu(MenuHandler_AdminForceTag); + MenuAFTag.SetTitle("Select a Target (Force Tag)"); + MenuAFTag.ExitBackButton = true; AddTargetsToMenu2(MenuAFTag, 0, COMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED); - DisplayMenu(MenuAFTag, param1, MENU_TIME_FOREVER); - return; + MenuAFTag.Display(param1, MENU_TIME_FOREVER); + return 0; } else if (StrEqual(Selected, "ForceTagColor")) { - new Handle:MenuAFTColor = CreateMenu(MenuHandler_AdminForceTagColor); - SetMenuTitle(MenuAFTColor, "Select a Target (Force Tag Color)"); - SetMenuExitBackButton(MenuAFTColor, true); + Menu MenuAFTColor = new Menu(MenuHandler_AdminForceTagColor); + MenuAFTColor.SetTitle("Select a Target (Force Tag Color)"); + MenuAFTColor.ExitBackButton = true; AddTargetsToMenu2(MenuAFTColor, 0, COMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED); - DisplayMenu(MenuAFTColor, param1, MENU_TIME_FOREVER); - return; + MenuAFTColor.Display(param1, MENU_TIME_FOREVER); + return 0; } else if (StrEqual(Selected, "ForceNameColor")) { - new Handle:MenuAFNColor = CreateMenu(MenuHandler_AdminForceNameColor); - SetMenuTitle(MenuAFNColor, "Select a Target (Force Name Color)"); - SetMenuExitBackButton(MenuAFNColor, true); + Menu MenuAFNColor = new Menu(MenuHandler_AdminForceNameColor); + MenuAFNColor.SetTitle("Select a Target (Force Name Color)"); + MenuAFNColor.ExitBackButton = true; AddTargetsToMenu2(MenuAFNColor, 0, COMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED); - DisplayMenu(MenuAFNColor, param1, MENU_TIME_FOREVER); - return; + MenuAFNColor.Display(param1, MENU_TIME_FOREVER); + return 0; } else if (StrEqual(Selected, "ForceTextColor")) { - new Handle:MenuAFTeColor = CreateMenu(MenuHandler_AdminForceTextColor); - SetMenuTitle(MenuAFTeColor, "Select a Target (Force Text Color)"); - SetMenuExitBackButton(MenuAFTeColor, true); + Menu MenuAFTeColor = new Menu(MenuHandler_AdminForceTextColor); + MenuAFTeColor.SetTitle("Select a Target (Force Text Color)"); + MenuAFTeColor.ExitBackButton = true; AddTargetsToMenu2(MenuAFTeColor, 0, COMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED); - DisplayMenu(MenuAFTeColor, param1, MENU_TIME_FOREVER); - return; + MenuAFTeColor.Display(param1, MENU_TIME_FOREVER); + return 0; } else if (StrEqual(Selected, "CancelCInput")) { @@ -1974,36 +1759,38 @@ public MenuHandler_Admin(Handle:MenuAdmin, MenuAction:action, param1, param2) Menu_Admin(param1); } + + return 0; } -public MenuHandler_AdminReset(Handle:MenuAReset, MenuAction:action, param1, param2) +public int MenuHandler_AdminReset(Menu MenuAReset, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuAReset); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_Admin(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:Selected[32]; - decl String:SID[64]; - GetMenuItem(MenuAReset, param2, Selected, sizeof(Selected)); - new target; - new userid = StringToInt(Selected); + char Selected[32]; + char SID[64]; + MenuAReset.GetItem(param2, Selected, sizeof(Selected)); + int target; + int userid = StringToInt(Selected); target = GetClientOfUserId(userid); - if (target == 0) + if (!target) { CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Player no longer available."); - /*if (g_hAdminMenu != INVALID_HANDLE) + /*if (g_hAdminMenu != null) { DisplayTopMenu(g_hAdminMenu, param1, TopMenuPosition_LastCategory); return; @@ -2020,36 +1807,38 @@ public MenuHandler_AdminReset(Handle:MenuAReset, MenuAction:action, param1, para Menu_Admin(param1); } + + return 0; } -public MenuHandler_AdminBan(Handle:MenuABan, MenuAction:action, param1, param2) +public int MenuHandler_AdminBan(Menu MenuABan, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuABan); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_Admin(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:Selected[32]; - decl String:SID[64]; - GetMenuItem(MenuABan, param2, Selected, sizeof(Selected)); - new target; - new userid = StringToInt(Selected); + char Selected[32]; + char SID[64]; + MenuABan.GetItem(param2, Selected, sizeof(Selected)); + int target; + int userid = StringToInt(Selected); target = GetClientOfUserId(userid); - if (target == 0) + if (!target) { CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Player no longer available."); - /*if (g_hAdminMenu != INVALID_HANDLE) + /*if (g_hAdminMenu != null) { DisplayTopMenu(g_hAdminMenu, param1, TopMenuPosition_LastCategory); return; @@ -2061,53 +1850,56 @@ public MenuHandler_AdminBan(Handle:MenuABan, MenuAction:action, param1, param2) GetClientAuthId(target, AuthId_Steam2, SID, sizeof(SID)); g_iATarget[param1] = target; g_sATargetSID[param1] = SID; - new Handle:MenuABTime = CreateMenu(MenuHandler_AdminBanTime); - SetMenuTitle(MenuABTime, "Select Ban Length"); - SetMenuExitBackButton(MenuABTime, true); - AddMenuItem(MenuABTime, "10", "10 Minutes"); - AddMenuItem(MenuABTime, "30", "30 Minutes"); - AddMenuItem(MenuABTime, "60", "1 Hour"); - AddMenuItem(MenuABTime, "1440", "1 Day"); - AddMenuItem(MenuABTime, "10080", "1 Week"); - AddMenuItem(MenuABTime, "40320", "1 Month"); - AddMenuItem(MenuABTime, "0", "Permanent"); + Menu MenuABTime = new Menu(MenuHandler_AdminBanTime); + MenuABTime.SetTitle("Select Ban Length"); + MenuABTime.ExitBackButton = true; - DisplayMenu(MenuABTime, param1, MENU_TIME_FOREVER); + MenuABTime.AddItem("10", "10 Minutes"); + MenuABTime.AddItem("30", "30 Minutes"); + MenuABTime.AddItem("60", "1 Hour"); + MenuABTime.AddItem("1440", "1 Day"); + MenuABTime.AddItem("10080", "1 Week"); + MenuABTime.AddItem("40320", "1 Month"); + MenuABTime.AddItem("0", "Permanent"); + + MenuABTime.Display(param1, MENU_TIME_FOREVER); } } + + return 0; } -public MenuHandler_AdminBanTime(Handle:MenuABTime, MenuAction:action, param1, param2) +public int MenuHandler_AdminBanTime(Menu MenuABTime, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuABTime); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { - new Handle:MenuABan = CreateMenu(MenuHandler_AdminBan); - SetMenuTitle(MenuABan, "Select a Target (Ban from Tag/Colors)"); - SetMenuExitBackButton(MenuABan, true); + Menu MenuABan = new Menu(MenuHandler_AdminBan); + MenuABan.SetTitle("Select a Target (Ban from Tag/Colors)"); + MenuABan.ExitBackButton = true; AddTargetsToMenu2(MenuABan, 0, COMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED); - DisplayMenu(MenuABan, param1, MENU_TIME_FOREVER); - return; + MenuABan.Display(param1, MENU_TIME_FOREVER); + return 0; } if (action == MenuAction_Select) { - decl String:Selected[128]; - GetMenuItem(MenuABTime, param2, Selected, sizeof(Selected)); + char Selected[128]; + MenuABTime.GetItem(param2, Selected, sizeof(Selected)); - if (g_iATarget[param1] == 0) + if (!g_iATarget[param1]) { CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Player no longer available."); - /*if (g_hAdminMenu != INVALID_HANDLE) + /*if (g_hAdminMenu != null) { DisplayTopMenu(g_hAdminMenu, param1, TopMenuPosition_LastCategory); return; @@ -2118,7 +1910,7 @@ public MenuHandler_AdminBanTime(Handle:MenuABTime, MenuAction:action, param1, pa BanCCC(g_sATargetSID[param1], param1, g_iATarget[param1], Selected); - /*if (g_hAdminMenu != INVALID_HANDLE) + /*if (g_hAdminMenu != null) { DisplayTopMenu(g_hAdminMenu, param1, TopMenuPosition_LastCategory); return; @@ -2126,32 +1918,34 @@ public MenuHandler_AdminBanTime(Handle:MenuABTime, MenuAction:action, param1, pa Menu_Admin(param1); } + + return 0; } -public MenuHandler_AdminForceTag(Handle:MenuAFTag, MenuAction:action, param1, param2) +public int MenuHandler_AdminForceTag(Menu MenuAFTag, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuAFTag); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_Admin(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:Selected[32]; - decl String:SID[64]; - GetMenuItem(MenuAFTag, param2, Selected, sizeof(Selected)); - new target; - new userid = StringToInt(Selected); + char Selected[32]; + char SID[64]; + MenuAFTag.GetItem(param2, Selected, sizeof(Selected)); + int target; + int userid = StringToInt(Selected); target = GetClientOfUserId(userid); - if (target == 0) + if (!target) { CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Player no longer available."); Menu_Admin(param1); @@ -2163,44 +1957,46 @@ public MenuHandler_AdminForceTag(Handle:MenuAFTag, MenuAction:action, param1, pa g_sATargetSID[param1] = SID; g_bWaitingForChatInput[param1] = true; g_sInputType[param1] = "MenuForceTag"; - CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Please enter what you want {green}%N's tag{default} to be.", target); + CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Please enter what you want {green}%N's{default} tag to be.", target); } Menu_Admin(param1); } + + return 0; } -public MenuHandler_AdminForceTagColor(Handle:MenuAFTColor, MenuAction:action, param1, param2) +public int MenuHandler_AdminForceTagColor(Menu MenuAFTColor, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuAFTColor); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_Admin(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:Selected[32]; - GetMenuItem(MenuAFTColor, param2, Selected, sizeof(Selected)); - new target; - new userid = StringToInt(Selected); + char Selected[32]; + MenuAFTColor.GetItem(param2, Selected, sizeof(Selected)); + int target; + int userid = StringToInt(Selected); target = GetClientOfUserId(userid); - if (target == 0) + if (!target) { CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Player no longer available."); Menu_Admin(param1); } else { - decl String:SID[64]; + char SID[64]; GetClientAuthId(target, AuthId_Steam2, SID, sizeof(SID)); g_iATarget[param1] = target; @@ -2208,37 +2004,39 @@ public MenuHandler_AdminForceTagColor(Handle:MenuAFTColor, MenuAction:action, pa g_bWaitingForChatInput[param1] = true; g_sInputType[param1] = "MenuForceTagColor"; - CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Please enter what you want {green}%N's tag color{default} to be (#{red}RR{green}GG{blue}BB{default} HEX only!).", target); + CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Please enter what you want {green}%N's{default} tag color to be (#{red}RR{green}GG{blue}BB{default} HEX only!).", target); } Menu_Admin(param1); } + + return 0; } -public MenuHandler_AdminForceNameColor(Handle:MenuAFNColor, MenuAction:action, param1, param2) +public int MenuHandler_AdminForceNameColor(Menu MenuAFNColor, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuAFNColor); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_Admin(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:Selected[32]; - decl String:SID[64]; - GetMenuItem(MenuAFNColor, param2, Selected, sizeof(Selected)); - new target; - new userid = StringToInt(Selected); + char Selected[32]; + char SID[64]; + MenuAFNColor.GetItem(param2, Selected, sizeof(Selected)); + int target; + int userid = StringToInt(Selected); target = GetClientOfUserId(userid); - if (target == 0) + if (!target) { CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Player no longer available."); Menu_Admin(param1); @@ -2250,37 +2048,39 @@ public MenuHandler_AdminForceNameColor(Handle:MenuAFNColor, MenuAction:action, p g_sATargetSID[param1] = SID; g_bWaitingForChatInput[param1] = true; g_sInputType[param1] = "MenuForceNameColor"; - CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Please enter what you want {green}%N's name color{default} to be (#{red}RR{green}GG{blue}BB{default} HEX only!).", target); + CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Please enter what you want {green}%N's{default} name color to be (#{red}RR{green}GG{blue}BB{default} HEX only!).", target); } Menu_Admin(param1); } + + return 0; } -public MenuHandler_AdminForceTextColor(Handle:MenuAFTeColor, MenuAction:action, param1, param2) +public int MenuHandler_AdminForceTextColor(Menu MenuAFTeColor, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuAFTeColor); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_Admin(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:Selected[32]; - decl String:SID[64]; - GetMenuItem(MenuAFTeColor, param2, Selected, sizeof(Selected)); - new target; - new userid = StringToInt(Selected); + char Selected[32]; + char SID[64]; + MenuAFTeColor.GetItem(param2, Selected, sizeof(Selected)); + int target; + int userid = StringToInt(Selected); target = GetClientOfUserId(userid); - if (target == 0) + if (!target) { CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Player no longer available."); Menu_Admin(param1); @@ -2292,55 +2092,55 @@ public MenuHandler_AdminForceTextColor(Handle:MenuAFTeColor, MenuAction:action, g_sATargetSID[param1] = SID; g_bWaitingForChatInput[param1] = true; g_sInputType[param1] = "MenuForceTextColor"; - CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Please enter what you want {green}%N's text color{default} to be (#{red}RR{green}GG{blue}BB{default} HEX only!).", target); + CPrintToChat(param1, "{green}[{red}C{green}C{blue}C{green}-ADMIN]{default} Please enter what you want {green}%N's{default} text color to be (#{red}RR{green}GG{blue}BB{default} HEX only!).", target); } Menu_Admin(param1); } + + return 0; } -public Menu_TagPrefs(client) +public void Menu_TagPrefs(int client) { if (IsVoteInProgress()) - { return; - } - new Handle:MenuTPrefs = CreateMenu(MenuHandler_TagPrefs); - SetMenuTitle(MenuTPrefs, "Tag Options:"); - SetMenuExitBackButton(MenuTPrefs, true); + Menu MenuTPrefs = new Menu(MenuHandler_TagPrefs); + MenuTPrefs.SetTitle("Tag Options:"); + MenuTPrefs.ExitBackButton = true; - AddMenuItem(MenuTPrefs, "Reset", "Clear Tag"); - AddMenuItem(MenuTPrefs, "ResetColor", "Clear Tag Color"); - AddMenuItem(MenuTPrefs, "ChangeTag", "Change Tag (Chat input)"); - AddMenuItem(MenuTPrefs, "Color", "Change Tag Color"); - AddMenuItem(MenuTPrefs, "ColorTag", "Change Tag Color (Chat input)"); + MenuTPrefs.AddItem("Reset", "Clear Tag"); + MenuTPrefs.AddItem("ResetColor", "Clear Tag Color"); + MenuTPrefs.AddItem("ChangeTag", "Change Tag (Chat input)"); + MenuTPrefs.AddItem("Color", "Change Tag Color"); + MenuTPrefs.AddItem("ColorTag", "Change Tag Color (Chat input)"); - DisplayMenu(MenuTPrefs, client, MENU_TIME_FOREVER); + MenuTPrefs.Display(client, MENU_TIME_FOREVER); } -public MenuHandler_TagPrefs(Handle:MenuTPrefs, MenuAction:action, param1, param2) +public int MenuHandler_TagPrefs(Menu MenuTPrefs, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuTPrefs); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_Main(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:Selected[32]; - GetMenuItem(MenuTPrefs, param2, Selected, sizeof(Selected)); + char Selected[32]; + MenuTPrefs.GetItem(param2, Selected, sizeof(Selected)); if (StrEqual(Selected, "Reset")) { - decl String:SID[64]; + char SID[64]; GetClientAuthId(param1, AuthId_Steam2, SID, sizeof(SID)); SetTag(SID, "", param1); @@ -2349,7 +2149,7 @@ public MenuHandler_TagPrefs(Handle:MenuTPrefs, MenuAction:action, param1, param2 } else if (StrEqual(Selected, "ResetColor")) { - decl String:SID[64]; + char SID[64]; GetClientAuthId(param1, AuthId_Steam2, SID, sizeof(SID)); if (SetColor(SID, "tagcolor", "", param1)) @@ -2369,65 +2169,65 @@ public MenuHandler_TagPrefs(Handle:MenuTPrefs, MenuAction:action, param1, param2 } else { - new Handle:ColorsMenu = CreateMenu(MenuHandler_TagColorSub); - decl String:info[64]; - SetMenuTitle(ColorsMenu, "Pick a color:"); - SetMenuExitBackButton(ColorsMenu, true); + Menu ColorsMenu = new Menu(MenuHandler_TagColorSub); + char info[64]; + ColorsMenu.SetTitle("Pick a color:"); + ColorsMenu.ExitBackButton = true; - for (new i = 0; i < 120; i++) + for (int i = 0; i < 120; i++) { Format(info, sizeof(info), "%s (#%s)", g_sColorsArray[i][0], g_sColorsArray[i][1]); - AddMenuItem(ColorsMenu, g_sColorsArray[i][1], info); + ColorsMenu.AddItem(g_sColorsArray[i][1], info); } - DisplayMenu(ColorsMenu, param1, MENU_TIME_FOREVER); - return; + ColorsMenu.Display(param1, MENU_TIME_FOREVER); + return 0; } Menu_Main(param1); } + + return 0; } -public Menu_NameColor(client) +public void Menu_NameColor(int client) { if (IsVoteInProgress()) - { return; - } - new Handle:MenuNColor = CreateMenu(MenuHandler_NameColor); - SetMenuTitle(MenuNColor, "Name Options:"); - SetMenuExitBackButton(MenuNColor, true); + Menu MenuNColor = new Menu(MenuHandler_NameColor); + MenuNColor.SetTitle("Name Options:"); + MenuNColor.ExitBackButton = true; - AddMenuItem(MenuNColor, "ResetColor", "Clear Name Color"); - AddMenuItem(MenuNColor, "Color", "Change Name Color"); - AddMenuItem(MenuNColor, "ColorName", "Change Name Color (Chat input)"); + MenuNColor.AddItem("ResetColor", "Clear Name Color"); + MenuNColor.AddItem("Color", "Change Name Color"); + MenuNColor.AddItem("ColorName", "Change Name Color (Chat input)"); - DisplayMenu(MenuNColor, client, MENU_TIME_FOREVER); + MenuNColor.Display(client, MENU_TIME_FOREVER); } -public MenuHandler_NameColor(Handle:MenuNColor, MenuAction:action, param1, param2) +public int MenuHandler_NameColor(Menu MenuNColor, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuNColor); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_Main(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:Selected[32]; - GetMenuItem(MenuNColor, param2, Selected, sizeof(Selected)); + char Selected[32]; + MenuNColor.GetItem(param2, Selected, sizeof(Selected)); if (StrEqual(Selected, "ResetColor")) { - decl String:SID[64]; + char SID[64]; GetClientAuthId(param1, AuthId_Steam2, SID, sizeof(SID)); if (SetColor(SID, "namecolor", "", param1)) @@ -2441,72 +2241,72 @@ public MenuHandler_NameColor(Handle:MenuNColor, MenuAction:action, param1, param } else { - new Handle:ColorsMenu = CreateMenu(MenuHandler_NameColorSub); - decl String:info[64]; - decl String:SID[64]; + Menu ColorsMenu = new Menu(MenuHandler_NameColorSub); + char info[64]; + char SID[64]; GetClientAuthId(param1, AuthId_Steam2, SID, sizeof(SID)); - SetMenuTitle(ColorsMenu, "Pick a color:"); - SetMenuExitBackButton(ColorsMenu, true); + ColorsMenu.SetTitle("Pick a color:"); + ColorsMenu.ExitBackButton = true; - for (new i = 0; i < 120; i++) + for (int i = 0; i < 120; i++) { Format(info, sizeof(info), "%s (#%s)", g_sColorsArray[i][0], g_sColorsArray[i][1]); - AddMenuItem(ColorsMenu, g_sColorsArray[i][1], info); + ColorsMenu.AddItem(g_sColorsArray[i][1], info); } - if (HasFlag(param1, Admin_Cheats) || StrEqual(SID, "STEAM_0:0:50540848", true)) + if (HasFlag(param1, Admin_Cheats)) { - AddMenuItem(ColorsMenu, "X", "X"); + ColorsMenu.AddItem("X", "X"); } - DisplayMenu(ColorsMenu, param1, MENU_TIME_FOREVER); - return; + ColorsMenu.Display(param1, MENU_TIME_FOREVER); + return 0; } Menu_Main(param1); } + + return 0; } -public Menu_ChatColor(client) +public void Menu_ChatColor(int client) { if (IsVoteInProgress()) - { return; - } - new Handle:MenuCColor = CreateMenu(MenuHandler_ChatColor); - SetMenuTitle(MenuCColor, "Chat Options:"); - SetMenuExitBackButton(MenuCColor, true); + Menu MenuCColor = new Menu(MenuHandler_ChatColor); + MenuCColor.SetTitle("Chat Options:"); + MenuCColor.ExitBackButton = true; - AddMenuItem(MenuCColor, "ResetColor", "Clear Chat Text Color"); - AddMenuItem(MenuCColor, "Color", "Change Chat Text Color"); - AddMenuItem(MenuCColor, "ColorText", "Change Chat Text Color (Chat input)"); + MenuCColor.AddItem("ResetColor", "Clear Chat Text Color"); + MenuCColor.AddItem("Color", "Change Chat Text Color"); + MenuCColor.AddItem("ColorText", "Change Chat Text Color (Chat input)"); - DisplayMenu(MenuCColor, client, MENU_TIME_FOREVER); + MenuCColor.Display(client, MENU_TIME_FOREVER); } -public MenuHandler_ChatColor(Handle:MenuCColor, MenuAction:action, param1, param2) +public int MenuHandler_ChatColor(Menu MenuCColor, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuCColor); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_Main(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:Selected[32]; - GetMenuItem(MenuCColor, param2, Selected, sizeof(Selected)); + char Selected[32]; + MenuCColor.GetItem(param2, Selected, sizeof(Selected)); - if(StrEqual(Selected, "ResetColor")) + if (StrEqual(Selected, "ResetColor")) { - decl String:SID[64]; + char SID[64]; GetClientAuthId(param1, AuthId_Steam2, SID, sizeof(SID)); if (SetColor(SID, "textcolor", "", param1)) @@ -2520,45 +2320,47 @@ public MenuHandler_ChatColor(Handle:MenuCColor, MenuAction:action, param1, param } else { - new Handle:ColorsMenu = CreateMenu(MenuHandler_ChatColorSub); - decl String:info[64]; - SetMenuTitle(ColorsMenu, "Pick a color:"); - SetMenuExitBackButton(ColorsMenu, true); + Menu ColorsMenu = new Menu(MenuHandler_ChatColorSub); + char info[64]; + ColorsMenu.SetTitle("Pick a color:"); + ColorsMenu.ExitBackButton = true; - for (new i = 0; i < 120; i++) + for (int i = 0; i < 120; i++) { Format(info, sizeof(info), "%s (#%s)", g_sColorsArray[i][0], g_sColorsArray[i][1]); - AddMenuItem(ColorsMenu, g_sColorsArray[i][1], info); + ColorsMenu.AddItem(g_sColorsArray[i][1], info); } - DisplayMenu(ColorsMenu, param1, MENU_TIME_FOREVER); - return; + ColorsMenu.Display(param1, MENU_TIME_FOREVER); + return 0; } Menu_Main(param1); } + + return 0; } -public MenuHandler_TagColorSub(Handle:MenuTCSub, MenuAction:action, param1, param2) +public int MenuHandler_TagColorSub(Menu MenuTCSub, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuTCSub); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_TagPrefs(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:SID[64]; - decl String:Selected[64]; - decl String:SelectedFinal[64]; - GetMenuItem(MenuTCSub, param2, Selected, sizeof(Selected)); + char SID[64]; + char Selected[64]; + char SelectedFinal[64]; + MenuTCSub.GetItem(param2, Selected, sizeof(Selected)); GetClientAuthId(param1, AuthId_Steam2, SID, sizeof(SID)); Format(SelectedFinal, sizeof(SelectedFinal), "#%s", Selected); @@ -2568,28 +2370,30 @@ public MenuHandler_TagColorSub(Handle:MenuTCSub, MenuAction:action, param1, para Menu_TagPrefs(param1); } + + return 0; } -public MenuHandler_NameColorSub(Handle:MenuNCSub, MenuAction:action, param1, param2) +public int MenuHandler_NameColorSub(Menu MenuNCSub, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuNCSub); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_NameColor(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:SID[64]; - decl String:Selected[64]; - decl String:SelectedFinal[64]; - GetMenuItem(MenuNCSub, param2, Selected, sizeof(Selected)); + char SID[64]; + char Selected[64]; + char SelectedFinal[64]; + MenuNCSub.GetItem(param2, Selected, sizeof(Selected)); GetClientAuthId(param1, AuthId_Steam2, SID, sizeof(SID)); Format(SelectedFinal, sizeof(SelectedFinal), "#%s", Selected); @@ -2599,28 +2403,30 @@ public MenuHandler_NameColorSub(Handle:MenuNCSub, MenuAction:action, param1, par Menu_NameColor(param1); } + + return 0; } -public MenuHandler_ChatColorSub(Handle:MenuCCSub, MenuAction:action, param1, param2) +public int MenuHandler_ChatColorSub(Menu MenuCCSub, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { CloseHandle(MenuCCSub); - return; + return 0; } if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack) { Menu_ChatColor(param1); - return; + return 0; } if (action == MenuAction_Select) { - decl String:SID[64]; - decl String:Selected[64]; - decl String:SelectedFinal[64]; - GetMenuItem(MenuCCSub, param2, Selected, sizeof(Selected)); + char SID[64]; + char Selected[64]; + char SelectedFinal[64]; + MenuCCSub.GetItem(param2, Selected, sizeof(Selected)); GetClientAuthId(param1, AuthId_Steam2, SID, sizeof(SID)); Format(SelectedFinal, sizeof(SelectedFinal), "#%s", Selected); @@ -2630,6 +2436,8 @@ public MenuHandler_ChatColorSub(Handle:MenuCCSub, MenuAction:action, param1, par Menu_ChatColor(param1); } + + return 0; } // 88888888888 d8888 .d8888b. .d8888b. 8888888888 88888888888 88888888888 8888888 888b 888 .d8888b. @@ -2641,7 +2449,7 @@ public MenuHandler_ChatColorSub(Handle:MenuCCSub, MenuAction:action, param1, par // 888 d8888888888 Y88b d88P Y88b d88P 888 888 888 888 888 Y8888 Y88b d88P // 888 d88P 888 "Y8888P88 "Y8888P" 8888888888 888 888 8888888 888 Y888 "Y8888P88 -ClearValues(client) +void ClearValues(int client) { Format(g_sTag[client], sizeof(g_sTag[]), ""); Format(g_sTagColor[client], sizeof(g_sTagColor[]), ""); @@ -2654,7 +2462,7 @@ ClearValues(client) Format(g_sDefaultChatColor[client], sizeof(g_sDefaultChatColor[]), ""); } -public OnClientConnected(client) +public void OnClientConnected(int client) { Format(g_sReceivedChatInput[client], sizeof(g_sReceivedChatInput[]), ""); Format(g_sInputType[client], sizeof(g_sInputType[]), ""); @@ -2666,7 +2474,7 @@ public OnClientConnected(client) ClearValues(client); } -public OnClientDisconnect(client) +public void OnClientDisconnect(int client) { Format(g_sReceivedChatInput[client], sizeof(g_sReceivedChatInput[]), ""); Format(g_sInputType[client], sizeof(g_sInputType[]), ""); @@ -2678,14 +2486,14 @@ public OnClientDisconnect(client) ClearValues(client); } -public OnClientPostAdminCheck(client) +public void OnClientPostAdminCheck(int client) { if (!ConfigForward(client)) { return; } - decl String:auth[32]; + char auth[32]; GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth)); KvRewind(g_hConfigFile); @@ -2694,11 +2502,11 @@ public OnClientPostAdminCheck(client) KvRewind(g_hConfigFile); KvGotoFirstSubKey(g_hConfigFile); - new AdminId:admin = GetUserAdmin(client); - new AdminFlag:flag; - decl String:configFlag[2]; - decl String:section[32]; - new bool:found = false; + AdminId admin = GetUserAdmin(client); + AdminFlag flag; + char configFlag[2]; + char section[32]; + bool found = false; do { @@ -2740,21 +2548,22 @@ public OnClientPostAdminCheck(client) } } - decl String:clientTagColor[12]; - decl String:clientNameColor[12]; - decl String:clientChatColor[12]; + char clientTagColor[12]; + char clientNameColor[12]; + char clientChatColor[12]; KvGetString(g_hConfigFile, "tag", g_sTag[client], sizeof(g_sTag[])); KvGetString(g_hConfigFile, "tagcolor", clientTagColor, sizeof(clientTagColor)); KvGetString(g_hConfigFile, "namecolor", clientNameColor, sizeof(clientNameColor)); KvGetString(g_hConfigFile, "textcolor", clientChatColor, sizeof(clientChatColor)); + g_bTagToggled[client] = view_as(KvGetNum(g_hConfigFile, "toggled")); ReplaceString(clientTagColor, sizeof(clientTagColor), "#", ""); ReplaceString(clientNameColor, sizeof(clientNameColor), "#", ""); ReplaceString(clientChatColor, sizeof(clientChatColor), "#", ""); - new tagLen = strlen(clientTagColor); - new nameLen = strlen(clientNameColor); - new chatLen = strlen(clientChatColor); + int tagLen = strlen(clientTagColor); + int nameLen = strlen(clientNameColor); + int chatLen = strlen(clientChatColor); if (tagLen == 6 || tagLen == 8 || StrEqual(clientTagColor, "T", false) || StrEqual(clientTagColor, "G", false) || StrEqual(clientTagColor, "O", false) || StrEqual(clientTagColor, "X", false)) { @@ -2780,191 +2589,152 @@ public OnClientPostAdminCheck(client) Call_PushCell(client); Call_Finish(); } -/* -public Action:OnChatMessage(&author, Handle:recipients, String:name[], String:message[]) + +public Action Hook_UserMessage(UserMsg msg_id, Handle bf, const players[], int playersNum, bool reliable, bool init) { - //new bFlags = GetMessageFlags(); - new iMaxMessageLength = 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 - - //PrintToServer("%N: %s (%d)", author, message, GetMessageFlags()); - - if (message[0] == '>' && GetConVarInt(g_hGreenText) > 0) - Format(message, iMaxMessageLength, "\x0714C800%s", message); - - if (!g_bTagToggled[author]) - { - if (CheckForward(author, message, CCC_NameColor)) - { - if (StrEqual(g_sUsernameColor[author], "G", false)) - Format(name, MAXLENGTH_NAME, "\x04%s", name); - else if (StrEqual(g_sUsernameColor[author], "O", false)) - Format(name, MAXLENGTH_NAME, "\x05%s", name); - else if (StrEqual(g_sUsernameColor[author], "X", false)) - Format(name, MAXLENGTH_NAME, "", name); - else if (strlen(g_sUsernameColor[author]) == 6) - Format(name, MAXLENGTH_NAME, "\x07%s%s", g_sUsernameColor[author], name); - else if (strlen(g_sUsernameColor[author]) == 8) - Format(name, MAXLENGTH_NAME, "\x08%s%s", g_sUsernameColor[author], name); - else - Format(name, MAXLENGTH_NAME, "\x03%s", name); // team color by default! - } - else - { - Format(name, MAXLENGTH_NAME, "\x03%s", name); // team color by default! - } - - if (CheckForward(author, message, CCC_TagColor)) - { - if (strlen(g_sTag[author]) > 0) - { - if (StrEqual(g_sTagColor[author], "T", false)) - Format(name, MAXLENGTH_NAME, "\x03%s%s", g_sTag[author], name); - else if (StrEqual(g_sTagColor[author], "G", false)) - Format(name, MAXLENGTH_NAME, "\x04%s%s", g_sTag[author], name); - else if (StrEqual(g_sTagColor[author], "O", false)) - Format(name, MAXLENGTH_NAME, "\x05%s%s", g_sTag[author], name); - else if (strlen(g_sTagColor[author]) == 6) - Format(name, MAXLENGTH_NAME, "\x07%s%s%s", g_sTagColor[author], g_sTag[author], name); - else if (strlen(g_sTagColor[author]) == 8) - Format(name, MAXLENGTH_NAME, "\x08%s%s%s", g_sTagColor[author], g_sTag[author], name); - else - Format(name, MAXLENGTH_NAME, "\x01%s%s", g_sTag[author], name); - } - } - - if (strlen(g_sChatColor[author]) > 0 && CheckForward(author, message, CCC_ChatColor)) - { - if (StrEqual(g_sChatColor[author], "T", false)) - Format(message, iMaxMessageLength, "\x03%s", message); - else if (StrEqual(g_sChatColor[author], "G", false)) - Format(message, iMaxMessageLength, "\x04%s", message); - else if (StrEqual(g_sChatColor[author], "O", false)) - Format(message, iMaxMessageLength, "\x05%s", message); - else if (strlen(g_sChatColor[author]) == 6) - Format(message, iMaxMessageLength, "\x07%s%s", g_sChatColor[author], message); - else if (strlen(g_sChatColor[author]) == 8) - Format(message, iMaxMessageLength, "\x08%s%s", g_sChatColor[author], message); - } - } - - decl String:sGame[64]; - GetGameFolderName(sGame, sizeof(sGame)); - - if (StrEqual(sGame, "csgo")) - Format(name, MAXLENGTH_NAME, "\x01\x0B%s", name); - - Call_StartForward(messageForward); - Call_PushCell(author); - Call_PushStringEx(message, iMaxMessageLength, SM_PARAM_STRING_UTF8|SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); - Call_PushCell(iMaxMessageLength); - Call_Finish(); - - return Plugin_Changed; -} -*/ - -public Action:Hook_UserMessage(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init) -{ - new String:sAuthorTag[64]; + char sAuthorTag[64]; g_msgAuthor = BfReadByte(bf); - g_msgIsChat = bool:BfReadByte(bf); + g_msgIsChat = view_as(BfReadByte(bf)); BfReadString(bf, g_msgName, sizeof(g_msgName), false); BfReadString(bf, g_msgSender, sizeof(g_msgSender), false); BfReadString(bf, g_msgText, sizeof(g_msgText), false); - if(strlen(g_msgName) == 0 || strlen(g_msgSender) == 0 || strlen(g_msgText) == 0) + if (strlen(g_msgName) == 0 || strlen(g_msgSender) == 0 || strlen(g_msgText) == 0) return Plugin_Continue; - if(!strcmp(g_msgName, "#Cstrike_Name_Change")) + if (!strcmp(g_msgName, "#Cstrike_Name_Change")) return Plugin_Continue; CCC_GetTag(g_msgAuthor, sAuthorTag, sizeof(sAuthorTag)); - new bool:bNameAlpha; - new bool:bChatAlpha; - new bool:bTagAlpha; - new xiNameColor = CCC_GetColor(g_msgAuthor, CCC_ColorType:CCC_NameColor, bNameAlpha); - new xiChatColor = CCC_GetColor(g_msgAuthor, CCC_ColorType:CCC_ChatColor, bChatAlpha); - new xiTagColor = CCC_GetColor(g_msgAuthor, CCC_ColorType:CCC_TagColor, bTagAlpha); - if (xiNameColor == COLOR_CGREEN) + bool bNameAlpha; + bool bChatAlpha; + bool bTagAlpha; + bool bIsAction; + int xiNameColor = CCC_GetColor(g_msgAuthor, view_as(CCC_NameColor), bNameAlpha); + int xiChatColor = CCC_GetColor(g_msgAuthor, view_as(CCC_ChatColor), bChatAlpha); + int xiTagColor = CCC_GetColor(g_msgAuthor, view_as(CCC_TagColor), bTagAlpha); + + TrimString(g_msgText); + + if (!strncmp(g_msgText, "/me", 3, false)) { - Format(g_msgSender, sizeof(g_msgSender), "\x04%s", g_msgSender); - } - else if (xiNameColor == COLOR_OLIVE) - { - Format(g_msgSender, sizeof(g_msgSender), "\x05%s", g_msgSender); - } - else if (xiNameColor == COLOR_TEAM) - { - Format(g_msgSender, sizeof(g_msgSender), "\x03%s", g_msgSender); - } - else if (xiNameColor == COLOR_NULL) - { - Format(g_msgSender, sizeof(g_msgSender), "", g_msgSender); - } - else if (!bNameAlpha) - { - Format(g_msgSender, sizeof(g_msgSender), "\x07%06X%s", xiNameColor, g_msgSender); - } - else - { - Format(g_msgSender, sizeof(g_msgSender), "\x08%08X%s", xiNameColor, g_msgSender); + strcopy(g_msgName, sizeof(g_msgName), "Cstrike_Chat_Me"); + strcopy(g_msgText, sizeof(g_msgText), g_msgText[4]); + bIsAction = true; } - if(strlen(sAuthorTag) > 0) + if (GetConVarInt(g_hReplaceText) > 0) { - if (xiTagColor == COLOR_TEAM) + char sPart[MAX_CHAT_LENGTH]; + char sBuff[MAX_CHAT_LENGTH]; + int CurrentIndex = 0; + int NextIndex = 0; + + while(NextIndex != -1 && CurrentIndex < sizeof(g_msgText)) { - Format(g_msgSender, sizeof(g_msgSender), "\x03%s%s", sAuthorTag, g_msgSender); + NextIndex = BreakString(g_msgText[CurrentIndex], sPart, sizeof(sPart)); + + KvGetString(g_hReplaceConfigFile, sPart, sBuff, sizeof(sBuff), NULL_STRING); + + if(sBuff[0]) + { + ReplaceString(g_msgText[CurrentIndex], sizeof(g_msgText) - CurrentIndex, sPart, sBuff); + CurrentIndex += strlen(sBuff); + } + else + CurrentIndex += NextIndex; } - else if (xiTagColor == COLOR_CGREEN) + } + + if (!g_msgAuthor || HasFlag(g_msgAuthor, Admin_Generic)) + { + CReplaceColorCodes(g_msgText, g_msgAuthor, false, sizeof(g_msgText)); + } + + if (!bIsAction) + { + if (xiNameColor == COLOR_TEAM || g_bTagToggled[g_msgAuthor]) { - Format(g_msgSender, sizeof(g_msgSender), "\x04%s%s", sAuthorTag, g_msgSender); + Format(g_msgSender, sizeof(g_msgSender), "\x03%s", g_msgSender); } - else if (xiTagColor == COLOR_OLIVE) + else if (xiNameColor == COLOR_CGREEN) { - Format(g_msgSender, sizeof(g_msgSender), "\x05%s%s", sAuthorTag, g_msgSender); + Format(g_msgSender, sizeof(g_msgSender), "\x04%s", g_msgSender); } - else if (xiTagColor == COLOR_NONE) + else if (xiNameColor == COLOR_OLIVE) { - Format(g_msgSender, sizeof(g_msgSender), "\x01%s%s", sAuthorTag, g_msgSender); + Format(g_msgSender, sizeof(g_msgSender), "\x05%s", g_msgSender); + } + else if (xiNameColor == COLOR_NULL) + { + Format(g_msgSender, sizeof(g_msgSender), "", g_msgSender); } else if (!bNameAlpha) { - Format(g_msgSender, sizeof(g_msgSender), "\x07%06X%s%s", xiTagColor, sAuthorTag, g_msgSender); + Format(g_msgSender, sizeof(g_msgSender), "\x07%06X%s", xiNameColor, g_msgSender); } else { - Format(g_msgSender, sizeof(g_msgSender), "\x08%08X%s%s", xiTagColor, sAuthorTag, g_msgSender); + Format(g_msgSender, sizeof(g_msgSender), "\x08%08X%s", xiNameColor, g_msgSender); } - } - if (g_msgText[0] == '>' && GetConVarInt(g_hGreenText) > 0) - { - Format(g_msgText, sizeof(g_msgText), "\x0714C800%s", g_msgText); - } - else if (xiChatColor == COLOR_TEAM) - { - Format(g_msgText, sizeof(g_msgText), "\x03%s", g_msgText); - } - else if (xiChatColor == COLOR_CGREEN) - { - Format(g_msgText, sizeof(g_msgText), "\x04%s", g_msgText); - } - else if (xiChatColor == COLOR_OLIVE) - { - Format(g_msgText, sizeof(g_msgText), "\x05%s", g_msgText); - } - else if (xiChatColor == COLOR_NONE) - { - } - else if (!bNameAlpha) - { - Format(g_msgText, sizeof(g_msgText), "\x07%06X%s", xiChatColor, g_msgText); - } - else - { - Format(g_msgText, sizeof(g_msgText), "\x08%08X%s", xiChatColor, g_msgText); + if (!g_bTagToggled[g_msgAuthor] && strlen(sAuthorTag) > 0) + { + if (xiTagColor == COLOR_TEAM) + { + Format(g_msgSender, sizeof(g_msgSender), "\x03%s%s", sAuthorTag, g_msgSender); + } + else if (xiTagColor == COLOR_CGREEN) + { + Format(g_msgSender, sizeof(g_msgSender), "\x04%s%s", sAuthorTag, g_msgSender); + } + else if (xiTagColor == COLOR_OLIVE) + { + Format(g_msgSender, sizeof(g_msgSender), "\x05%s%s", sAuthorTag, g_msgSender); + } + else if (xiTagColor == COLOR_NONE) + { + Format(g_msgSender, sizeof(g_msgSender), "\x01%s%s", sAuthorTag, g_msgSender); + } + else if (!bTagAlpha) + { + Format(g_msgSender, sizeof(g_msgSender), "\x07%06X%s%s", xiTagColor, sAuthorTag, g_msgSender); + } + else + { + Format(g_msgSender, sizeof(g_msgSender), "\x08%08X%s%s", xiTagColor, sAuthorTag, g_msgSender); + } + } + + if (g_msgText[0] == '>' && GetConVarInt(g_hGreenText) > 0) + { + Format(g_msgText, sizeof(g_msgText), "\x0714C800%s", g_msgText); + } + else if (xiChatColor == COLOR_NONE || g_bTagToggled[g_msgAuthor]) + { + Format(g_msgText, sizeof(g_msgText), "\x01%s", g_msgText); + } + else if (xiChatColor == COLOR_TEAM) + { + Format(g_msgText, sizeof(g_msgText), "\x03%s", g_msgText); + } + else if (xiChatColor == COLOR_CGREEN) + { + Format(g_msgText, sizeof(g_msgText), "\x04%s", g_msgText); + } + else if (xiChatColor == COLOR_OLIVE) + { + Format(g_msgText, sizeof(g_msgText), "\x05%s", g_msgText); + } + else if (!bChatAlpha) + { + Format(g_msgText, sizeof(g_msgText), "\x07%06X%s", xiChatColor, g_msgText); + } + else + { + Format(g_msgText, sizeof(g_msgText), "\x08%08X%s", xiChatColor, g_msgText); + } } Format(g_msgFinal, sizeof(g_msgFinal), "%t", g_msgName, g_msgSender, g_msgText); @@ -2981,9 +2751,9 @@ public Action:Hook_UserMessage(UserMsg:msg_id, Handle:bf, const players[], playe // 888 Y8888 d8888888888 888 888 Y888P 888 Y88b d88P // 888 Y888 d88P 888 888 8888888 Y8P 8888888888 "Y8888P" -stock bool:CheckForward(author, const String:message[], CCC_ColorType:type) +stock bool CheckForward(int author, const char[] message, CCC_ColorType type) { - new Action:result = Plugin_Continue; + new Action result = Plugin_Continue; Call_StartForward(applicationForward); Call_PushCell(author); @@ -3005,9 +2775,9 @@ stock bool:CheckForward(author, const String:message[], CCC_ColorType:type) return true; } -stock bool:ColorForward(author) +stock bool ColorForward(int author) { - new Action:result = Plugin_Continue; + Action result = Plugin_Continue; Call_StartForward(colorForward); Call_PushCell(author); @@ -3019,9 +2789,9 @@ stock bool:ColorForward(author) return true; } -stock bool:NameForward(author) +stock bool NameForward(int author) { - new Action:result = Plugin_Continue; + Action result = Plugin_Continue; Call_StartForward(nameForward); Call_PushCell(author); @@ -3033,9 +2803,9 @@ stock bool:NameForward(author) return true; } -stock bool:TagForward(author) +stock bool TagForward(int author) { - new Action:result = Plugin_Continue; + Action result = Plugin_Continue; Call_StartForward(tagForward); Call_PushCell(author); @@ -3047,9 +2817,9 @@ stock bool:TagForward(author) return true; } -stock bool:ConfigForward(client) +stock bool ConfigForward(int client) { - new Action:result = Plugin_Continue; + Action result = Plugin_Continue; Call_StartForward(preLoadedForward); Call_PushCell(client); @@ -3061,11 +2831,11 @@ stock bool:ConfigForward(client) return true; } -public Native_GetColor(Handle:plugin, numParams) +public int Native_GetColor(Handle plugin, int numParams) { - new client = GetNativeCell(1); + int client = GetNativeCell(1); - if (client < 1 || client > MaxClients || !IsClientInGame(client)) + if (!client || client > MaxClients || !IsClientInGame(client)) { ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game"); return COLOR_NONE; @@ -3164,17 +2934,17 @@ public Native_GetColor(Handle:plugin, numParams) return COLOR_NONE; } -public Native_SetColor(Handle:plugin, numParams) +public int Native_SetColor(Handle plugin, int numParams) { - new client = GetNativeCell(1); + int client = GetNativeCell(1); - if (client < 1 || client > MaxClients || !IsClientInGame(client)) + if (!client || client > MaxClients || !IsClientInGame(client)) { ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game"); - return false; + return 0; } - decl String:color[32]; + char color[32]; if (GetNativeCell(3) < 0) { @@ -3218,10 +2988,10 @@ public Native_SetColor(Handle:plugin, numParams) if (strlen(color) != 6 && strlen(color) != 8 && !StrEqual(color, "G", false) && !StrEqual(color, "O", false) && !StrEqual(color, "T", false) && !StrEqual(color, "X", false)) { - return false; + return 0; } - switch(GetNativeCell(2)) + switch (GetNativeCell(2)) { case CCC_TagColor: { @@ -3237,43 +3007,45 @@ public Native_SetColor(Handle:plugin, numParams) } } - return true; + return 1; } -public Native_GetTag(Handle:plugin, numParams) +public int Native_GetTag(Handle plugin, int numParams) { - new client = GetNativeCell(1); + int client = GetNativeCell(1); - if (client < 1 || client > MaxClients || !IsClientInGame(client)) + if (!client || client > MaxClients || !IsClientInGame(client)) { ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game"); - return; + return 0; } SetNativeString(2, g_sTag[client], GetNativeCell(3)); + return 1; } -public Native_SetTag(Handle:plugin, numParams) +public int Native_SetTag(Handle plugin, int numParams) { - new client = GetNativeCell(1); + int client = GetNativeCell(1); - if (client < 1 || client > MaxClients || !IsClientInGame(client)) + if (!client || client > MaxClients || !IsClientInGame(client)) { ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game"); - return; + return 0; } GetNativeString(2, g_sTag[client], sizeof(g_sTag[])); + return 1; } -public Native_ResetColor(Handle:plugin, numParams) +public int Native_ResetColor(Handle plugin, int numParams) { - new client = GetNativeCell(1); + int client = GetNativeCell(1); - if (client < 1 || client > MaxClients || !IsClientInGame(client)) + if (!client || client > MaxClients || !IsClientInGame(client)) { ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game"); - return; + return 0; } switch(GetNativeCell(2)) @@ -3291,24 +3063,27 @@ public Native_ResetColor(Handle:plugin, numParams) strcopy(g_sChatColor[client], sizeof(g_sChatColor[]), g_sDefaultChatColor[client]); } } + + return 1; } -public Native_ResetTag(Handle:plugin, numParams) +public int Native_ResetTag(Handle plugin, int numParams) { - new client = GetNativeCell(1); + int client = GetNativeCell(1); - if (client < 1 || client > MaxClients || !IsClientInGame(client)) + if (!client || client > MaxClients || !IsClientInGame(client)) { ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game"); - return; + return 0; } strcopy(g_sTag[client], sizeof(g_sTag[]), g_sDefaultTag[client]); + return 1; } -public Native_UpdateIgnoredArray(Handle:plugin, numParams) +public int Native_UpdateIgnoredArray(Handle plugin, int numParams) { GetNativeArray(1, g_Ignored, sizeof(g_Ignored)); - return true; -} \ No newline at end of file + return 1; +} diff --git a/custom-chatcolors/scripting/include/ccc.inc b/custom-chatcolors/scripting/include/ccc.inc index 6c65eaad..780ccd66 100644 --- a/custom-chatcolors/scripting/include/ccc.inc +++ b/custom-chatcolors/scripting/include/ccc.inc @@ -31,7 +31,7 @@ enum CCC_ColorType { * * On error/errors: Invalid client index or client is not in game */ -native CCC_GetColor(client, CCC_ColorType:type, &bool:alpha = false); +native int CCC_GetColor(int client, CCC_ColorType type, bool &alpha = false); /** * Sets a client's color as a hexadecimal integer. @@ -44,7 +44,7 @@ native CCC_GetColor(client, CCC_ColorType:type, &bool:alpha = false); * * On error/errors: Invalid client index or client is not in game */ -native bool:CCC_SetColor(client, CCC_ColorType:type, color, bool:alpha); +native int CCC_SetColor(int client, CCC_ColorType type, int color, bool alpha); /** * Gets a client's tag @@ -56,7 +56,7 @@ native bool:CCC_SetColor(client, CCC_ColorType:type, color, bool:alpha); * * On error/errors: Invalid client index or client is not in game */ -native CCC_GetTag(client, String:buffer[], maxlen); +native int CCC_GetTag(int client, char[] buffer, int maxlen); /** * Sets a client's tag @@ -67,7 +67,7 @@ native CCC_GetTag(client, String:buffer[], maxlen); * * On error/errors: Invalid client index or client is not in game */ -native CCC_SetTag(client, const String:tag[]); +native void CCC_SetTag(int client, const char[] tag); /** * Resets a client's color to the value in the config file. @@ -78,7 +78,7 @@ native CCC_SetTag(client, const String:tag[]); * * On error/errors: Invalid client index or client is not in game */ -native CCC_ResetColor(client, CCC_ColorType:type); +native int CCC_ResetColor(int client, CCC_ColorType type); /** * Resets a client's tag to the value in the config file. @@ -88,7 +88,7 @@ native CCC_ResetColor(client, CCC_ColorType:type); * * On error/errors: Invalid client index or client is not in game */ -native CCC_ResetTag(client); +native int CCC_ResetTag(int client); /** * Called when a cilent's name is about to be colored @@ -97,8 +97,8 @@ native CCC_ResetTag(client); * @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); +//#pragma deprecated Use CCC_OnColor instead +//forward Action:CCC_OnNameColor(client); /** * Called when a client's chat is about to be colored @@ -107,8 +107,8 @@ forward Action:CCC_OnNameColor(client); * @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); +//#pragma deprecated Use CCC_OnColor instead +//forward Action:CCC_OnChatColor(client); /** * Called when a client's name is about to be tagged @@ -117,8 +117,8 @@ forward Action:CCC_OnChatColor(client); * @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); +//#pragma deprecated Use CCC_OnColor instead +//forward Action:CCC_OnTagApplied(client); /** * Called when a client's name is about to be tagged @@ -129,7 +129,7 @@ forward Action:CCC_OnTagApplied(client); * @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); +//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 @@ -139,7 +139,7 @@ forward Action:CCC_OnColor(client, const String:message[], CCC_ColorType:type); * @param maxlen Maximum length of message buffer * @noreturn */ -forward CCC_OnChatMessage(author, String:message[], maxlen); +//forward CCC_OnChatMessage(author, String:message[], maxlen); /** * Called when a client's colors and tag are about to be loaded from the config file @@ -148,7 +148,7 @@ forward CCC_OnChatMessage(author, String:message[], maxlen); * @param client Client index * @return Plugin_Handled or Plugin_Stop to prevent loading, Plugin_Continue or Plugin_Changed to allow */ -forward Action:CCC_OnUserConfigPreLoaded(client); +forward Action CCC_OnUserConfigPreLoaded(int client); /** * Called when a client's colors and tag have been loaded from the config file @@ -156,18 +156,19 @@ forward Action:CCC_OnUserConfigPreLoaded(client); * @param client Client index * @noreturn */ -forward CCC_OnUserConfigLoaded(client); +forward void CCC_OnUserConfigLoaded(int client); /** * Called when the configuration file is reloaded with the sm_reloadccc command * * @noreturn */ -forward CCC_OnConfigReloaded(); +forward void CCC_OnConfigReloaded(); -native void CCC_UpdateIgnoredArray(bool IgnoredArray[(MAXPLAYERS + 1) * (MAXPLAYERS + 1)]); +native int CCC_UpdateIgnoredArray(bool IgnoredArray[(MAXPLAYERS + 1) * (MAXPLAYERS + 1)]); -public SharedPlugin:__pl_ccc = { +public SharedPlugin __pl_ccc = +{ name = "ccc", file = "custom-chatcolors.smx", #if defined REQUIRE_PLUGIN @@ -187,4 +188,4 @@ public __pl_ccc_SetNTVOptional() { MarkNativeAsOptional("CCC_ResetTag"); MarkNativeAsOptional("CCC_UpdateIgnoredArray"); } -#endif \ No newline at end of file +#endif diff --git a/custom-chatcolors/translations/allchat.phrases.txt b/custom-chatcolors/translations/allchat.phrases.txt index 8dacd4d4..599a1bb7 100644 --- a/custom-chatcolors/translations/allchat.phrases.txt +++ b/custom-chatcolors/translations/allchat.phrases.txt @@ -3,51 +3,56 @@ "Cstrike_Chat_CT_Loc" { "#format" "{1:s},{2:s}" - "en" "(Counter-Terrorist) {1} : {2}" + "en" "(Counter-Terrorist) {1} : {2}" } "Cstrike_Chat_CT" { "#format" "{1:s},{2:s}" - "en" "(Counter-Terrorist) {1} : {2}" + "en" "(Counter-Terrorist) {1} : {2}" } "Cstrike_Chat_T_Loc" { "#format" "{1:s},{2:s}" - "en" "(Terrorist) {1} : {2}" + "en" "(Terrorist) {1} : {2}" } "Cstrike_Chat_T" { "#format" "{1:s},{2:s}" - "en" "(Terrorist) {1} : {2}" + "en" "(Terrorist) {1} : {2}" } "Cstrike_Chat_CT_Dead" { "#format" "{1:s},{2:s}" - "en" "*DEAD*(Counter-Terrorist) {1} : {2}" + "en" "*DEAD*(Counter-Terrorist) {1} : {2}" } "Cstrike_Chat_T_Dead" { "#format" "{1:s},{2:s}" - "en" "*DEAD*(Terrorist) {1} : {2}" + "en" "*DEAD*(Terrorist) {1} : {2}" } "Cstrike_Chat_Spec" { "#format" "{1:s},{2:s}" - "en" "(Spectator) {1} : {2}" + "en" "(Spectator) {1} : {2}" } "Cstrike_Chat_All" { "#format" "{1:s},{2:s}" - "en" "{1} : {2}" + "en" "{1} : {2}" } "Cstrike_Chat_AllDead" { "#format" "{1:s},{2:s}" - "en" "*DEAD* {1} : {2}" + "en" "*DEAD* {1} : {2}" } "Cstrike_Chat_AllSpec" { "#format" "{1:s},{2:s}" - "en" "*SPEC* {1} : {2}" + "en" "*SPEC* {1} : {2}" + } + "Cstrike_Chat_Me" + { + "#format" "{1:s},{2:s}" + "en" "* {1} {2}" } } \ No newline at end of file diff --git a/immunityreserveslots/scripting/immunityreserveslots_connect.sp b/immunityreserveslots/scripting/immunityreserveslots_connect.sp index a11a0d42..16de7e9c 100644 --- a/immunityreserveslots/scripting/immunityreserveslots_connect.sp +++ b/immunityreserveslots/scripting/immunityreserveslots_connect.sp @@ -123,9 +123,10 @@ #undef REQUIRE_PLUGIN #include #include +#include #define REQUIRE_PLUGIN -#define PLUGIN_VERSION "2.0.9" +#define PLUGIN_VERSION "2.1.0" // Toggle build here. #define EXT_CBASE 0 @@ -154,6 +155,7 @@ new bool:b_lateLoad; new bool:b_loaded; new bool:b_useDonator; new bool:b_useEntWatch; +new bool:b_useGFLClanru; new bool:b_canKickSpec[MAXPLAYERS+1]; new g_HIPCount; @@ -212,62 +214,62 @@ public OnPluginStart() #if EXT_CONNECT Format(desc, sizeof(desc), "%t", "irs_autopassword"); - cvar_AutoPassword = CreateConVar("sm_irs_autopassword", "0", desc, FCVAR_PLUGIN, true, 0.0, true, 2.0); + cvar_AutoPassword = CreateConVar("sm_irs_autopassword", "0", desc, _, true, 0.0, true, 2.0); Format(desc, sizeof(desc), "%t", "irs_rejectreason_enable"); - cvar_RejectReasonEnable = CreateConVar("sm_irs_rejectreason_enable", "0", desc, FCVAR_PLUGIN, true, 0.0, true, 1.0); + cvar_RejectReasonEnable = CreateConVar("sm_irs_rejectreason_enable", "0", desc, _, true, 0.0, true, 1.0); Format(desc, sizeof(desc), "%t", "irs_rejectreason"); - cvar_RejectReason = CreateConVar("sm_irs_rejectreason", "default", desc, FCVAR_PLUGIN); + cvar_RejectReason = CreateConVar("sm_irs_rejectreason", "default", desc, _); cvar_GameTypeMVM = FindConVar("tf_gamemode_mvm"); #endif Format(desc, sizeof(desc), "%t", "irs_version"); - CreateConVar("sm_irs_version", PLUGIN_VERSION, desc, FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD); + CreateConVar("sm_irs_version", PLUGIN_VERSION, desc, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD); Format(desc, sizeof(desc), "%t", "irs_kicktype"); - cvar_KickType = CreateConVar("sm_irs_kicktype", "0", desc, FCVAR_PLUGIN, true, 0.0, true, 3.0); + cvar_KickType = CreateConVar("sm_irs_kicktype", "0", desc, _, true, 0.0, true, 3.0); Format(desc, sizeof(desc), "%t", "irs_kickreason"); - cvar_KickReason = CreateConVar("sm_irs_kickreason", "default", desc, FCVAR_PLUGIN); + cvar_KickReason = CreateConVar("sm_irs_kickreason", "default", desc, _); Format(desc, sizeof(desc), "%t", "irs_kickreason_immunity"); - cvar_KickReasonImmunity = CreateConVar("sm_irs_kickreason_immunity", "default", desc, FCVAR_PLUGIN); + cvar_KickReasonImmunity = CreateConVar("sm_irs_kickreason_immunity", "default", desc, _); Format(desc, sizeof(desc), "%t", "irs_kicklist_file"); - cvar_KickListFile = CreateConVar("sm_irs_kicklist_file", "default", desc, FCVAR_PLUGIN); + cvar_KickListFile = CreateConVar("sm_irs_kicklist_file", "default", desc, _); Format(desc, sizeof(desc), "%t", "irs_kicklist_mode"); - cvar_KickListMode = CreateConVar("sm_irs_kicklist_mode", "0", desc, FCVAR_PLUGIN, true, 0.0, true, 2.0); + cvar_KickListMode = CreateConVar("sm_irs_kicklist_mode", "0", desc, _, true, 0.0, true, 2.0); Format(desc, sizeof(desc), "%t", "irs_log"); - cvar_Logging = CreateConVar("sm_irs_log", "0", desc, FCVAR_PLUGIN, true, 0.0, true, 2.0); + cvar_Logging = CreateConVar("sm_irs_log", "0", desc, _, true, 0.0, true, 2.0); Format(desc, sizeof(desc), "%t", "irs_immunity"); - cvar_Immunity = CreateConVar("sm_irs_immunity", "1", desc, FCVAR_PLUGIN, true, 0.0, true, 2.0); + cvar_Immunity = CreateConVar("sm_irs_immunity", "1", desc, _, true, 0.0, true, 2.0); Format(desc, sizeof(desc), "%t", "irs_kickspecfirst"); - cvar_Spec = CreateConVar("sm_irs_kickspecfirst", "1", desc, FCVAR_PLUGIN, true, 0.0, true, 1.0); + cvar_Spec = CreateConVar("sm_irs_kickspecfirst", "1", desc, _, true, 0.0, true, 1.0); Format(desc, sizeof(desc), "%t", "irs_kickspecdelay"); - cvar_SpecKickDelay = CreateConVar("sm_irs_kickspecdelay", "0", desc, FCVAR_PLUGIN, true, 0.0); + cvar_SpecKickDelay = CreateConVar("sm_irs_kickspecdelay", "0", desc, _, true, 0.0); Format(desc, sizeof(desc), "%t", "irs_donator_support"); - cvar_Donator = CreateConVar("sm_irs_donator_support", "0", desc, FCVAR_PLUGIN, true, 0.0, true, 1.0); + cvar_Donator = CreateConVar("sm_irs_donator_support", "0", desc, _, true, 0.0, true, 1.0); Format(desc, sizeof(desc), "%t", "irs_donator_immunity"); - cvar_DonatorImmunity = CreateConVar("sm_irs_donator_immunity", "0", desc, FCVAR_PLUGIN, true, 0.0, true, 99.0); + cvar_DonatorImmunity = CreateConVar("sm_irs_donator_immunity", "0", desc, _, true, 0.0, true, 99.0); Format(desc, sizeof(desc), "%t", "irs_highimmunitylimit"); - cvar_HighImmunityLimit = CreateConVar("sm_irs_highimmunitylimit", "0", desc, FCVAR_PLUGIN, true, 0.0); + cvar_HighImmunityLimit = CreateConVar("sm_irs_highimmunitylimit", "0", desc, _, true, 0.0); Format(desc, sizeof(desc), "%t", "irs_highimmunityvalue"); - cvar_HighImmunityValue = CreateConVar("sm_irs_highimmunityvalue", "0", desc, FCVAR_PLUGIN, true, 0.0); + cvar_HighImmunityValue = CreateConVar("sm_irs_highimmunityvalue", "0", desc, _, true, 0.0); Format(desc, sizeof(desc), "%t", "irs_keepbalance"); - cvar_KeepBalance = CreateConVar("sm_irs_keepbalance", "0", desc, FCVAR_PLUGIN, true, 0.0, true, 1.0); + cvar_KeepBalance = CreateConVar("sm_irs_keepbalance", "0", desc, _, true, 0.0, true, 1.0); Format(desc, sizeof(desc), "%t", "irs_kicklist_reload"); RegServerCmd("sm_irs_kicklist_reload", Command_KickListReload, desc); @@ -378,6 +380,7 @@ public OnAllPluginsLoaded() { b_useDonator = LibraryExists("donator.core"); b_useEntWatch = LibraryExists("entWatch"); + b_useGFLClanru = LibraryExists("GFLClanru"); new Handle:h_Plugin; new Handle:arr_Plugins = CreateArray(64); @@ -427,6 +430,10 @@ public OnLibraryRemoved(const String:name[]) { b_useEntWatch = false; } + else if (StrEqual(name, "GFLClanru")) + { + b_useGFLClanru = false; + } } public OnLibraryAdded(const String:name[]) @@ -439,6 +446,10 @@ public OnLibraryAdded(const String:name[]) { b_useEntWatch = true; } + else if (StrEqual(name, "GFLClanru")) + { + b_useGFLClanru = true; + } } IRS_RemovePlugin(const String:plugin_name[]) @@ -492,7 +503,7 @@ GetRealClientCount() return ClientCount; } -public bool:OnClientPreConnectEx(const String:name[], String:password[255], const String:ip[], const String:steamID[], String:rejectReason[255]) +public EConnect OnClientPreConnectEx(const String:name[], String:password[255], const String:ip[], const String:steamID[], String:rejectReason[255]) { new AdminId:AdminID = FindAdminByIdentity(AUTHMETHOD_STEAM, steamID); @@ -517,13 +528,13 @@ public bool:OnClientPreConnectEx(const String:name[], String:password[255], cons if (!isMVM && GetClientCount(false) < MaxClients) { //LogToFileEx(g_LogFilePath, "[DEBUG] Game is not full or MVM game mode is disabled"); - return true; + return k_OnClientPreConnectEx_Accept; } if (isMVM && GetRealClientCount() < MAX_CLIENTS_MVM) { //LogToFileEx(g_LogFilePath, "[DEBUG] Game is MVM but there's still room available (%d clients connected)", GetRealClientCount()); - return true; + return k_OnClientPreConnectEx_Accept; } if (GetConVarInt(cvar_KickListMode) == 2) @@ -539,11 +550,11 @@ public bool:OnClientPreConnectEx(const String:name[], String:password[255], cons { Format(rejectReason, sizeof(rejectReason), "%t", "IRS Reject Reason"); } - return false; + return k_OnClientPreConnectEx_Reject; } else { - return true; + return k_OnClientPreConnectEx_Accept; } } } @@ -562,7 +573,7 @@ public bool:OnClientPreConnectEx(const String:name[], String:password[255], cons if (IRS_KickValidClient(AdminID, name, steamID, ImmunityLevel, isDonator)) { //LogToFileEx(g_LogFilePath, "[DEBUG] Plugin has made successful kick and will now allow client to connect"); - return true; + return k_OnClientPreConnectEx_Accept; } else if (GetConVarInt(cvar_RejectReasonEnable) || isMVM) { @@ -572,7 +583,7 @@ public bool:OnClientPreConnectEx(const String:name[], String:password[255], cons Format(rejectReason, sizeof(rejectReason), "%t", "IRS Reject Reason"); } //LogToFileEx(g_LogFilePath, "[DEBUG] No slot for connecting client, refusing connection (rejection mode)"); - return false; + return k_OnClientPreConnectEx_Reject; } //else //{ @@ -588,12 +599,56 @@ public bool:OnClientPreConnectEx(const String:name[], String:password[255], cons { Format(rejectReason, sizeof(rejectReason), "%t", "IRS Reject Reason"); } - return false; + return k_OnClientPreConnectEx_Reject; + } + + if (b_useGFLClanru) + { + new Handle:pack = CreateDataPack(); + WritePackString(pack, name); + AsyncHasSteamIDReservedSlot(steamID, AsyncHasSteamIDReservedSlotCallback, pack); + + return k_OnClientPreConnectEx_Async; } //LogToFileEx(g_LogFilePath, "[DEBUG] End of preconnection code"); - return true; + return k_OnClientPreConnectEx_Accept; +} + +public void AsyncHasSteamIDReservedSlotCallback(const char[] sSteam32ID, int Result, any Data) +{ + // Slot free'd up while waiting or doesn't have a reserved slot? + if(GetClientCount(false) < MaxClients || !Result) + { + ClientPreConnectEx(sSteam32ID, k_OnClientPreConnectEx_Accept, ""); + return; + } + + new String:name[MAX_NAME_LENGTH]; + ResetPack(Data); + ReadPackString(Data, name, sizeof(name)); + + if (IRS_KickValidClient(INVALID_ADMIN_ID, name, sSteam32ID, 0, true)) + { + //LogToFileEx(g_LogFilePath, "[DEBUG] Plugin has made successful kick and will now allow client to connect"); + ClientPreConnectEx(sSteam32ID, k_OnClientPreConnectEx_Accept, ""); + return; + } + else if (GetConVarInt(cvar_RejectReasonEnable) || isMVM) + { + char rejectReason[255]; + GetConVarString(cvar_RejectReason, rejectReason, sizeof(rejectReason)); + if (StrEqual(rejectReason, "default", false)) + { + Format(rejectReason, sizeof(rejectReason), "%t", "IRS Reject Reason"); + } + //LogToFileEx(g_LogFilePath, "[DEBUG] No slot for connecting client, refusing connection (rejection mode)"); + ClientPreConnectEx(sSteam32ID, k_OnClientPreConnectEx_Reject, rejectReason); + return; + } + + ClientPreConnectEx(sSteam32ID, k_OnClientPreConnectEx_Accept, ""); } #endif @@ -772,7 +827,7 @@ bool:IRS_KickValidClient(const AdminId:ConnectingClientAdminID, const String:Con } decl String:PlayerAuth[32]; - GetClientAuthString(i, PlayerAuth, sizeof(PlayerAuth)); + GetClientAuthId(i, AuthId_Steam2, PlayerAuth, sizeof(PlayerAuth)); new AdminId:PlayerAdmin = FindAdminByIdentity(AUTHMETHOD_STEAM, PlayerAuth) ClientImmunity[i] = GetAdminImmunityLevel(PlayerAdmin); @@ -824,17 +879,17 @@ bool:IRS_KickValidClient(const AdminId:ConnectingClientAdminID, const String:Con continue; } + if (b_useEntWatch && IsClientInGame(i) && entWatch_HasSpecialItem(i)) + { + if (Logging == 1) + { + IRS_LogClient(i, clientTeam[i], ClientImmunity[i]); + } + continue; + } + if (IsClientInGame(i)) { - if (b_useEntWatch && entWatch_HasSpecialItem(i)) - { - if (Logging == 1) - { - IRS_LogClient(i, clientTeam[i], ClientImmunity[i]); - } - continue; - } - switch (KickType) { case 0: @@ -964,7 +1019,7 @@ bool:IRS_KickValidClient(const AdminId:ConnectingClientAdminID, const String:Con if (useKickList) { decl String:PlayerAuth[32]; - GetClientAuthString(i, PlayerAuth, sizeof(PlayerAuth)); + GetClientAuthId(i, AuthId_Steam2, PlayerAuth, sizeof(PlayerAuth)); if (FindStringInArray(arr_KickListIDs, PlayerAuth) == -1) { if (Logging == 1) @@ -1091,7 +1146,7 @@ bool:IRS_KickValidClient(const AdminId:ConnectingClientAdminID, const String:Con decl String:KickName[32]; decl String:KickAuthid[32]; GetClientName(KickTarget, KickName, sizeof(KickName)); - GetClientAuthString(KickTarget, KickAuthid, sizeof(KickAuthid)); + GetClientAuthId(KickTarget, AuthId_Steam2, KickAuthid, sizeof(KickAuthid)); if (!immunityKick) { diff --git a/immunityreserveslots/scripting/include/connect.inc b/immunityreserveslots/scripting/include/connect.inc index 445a1f68..e651d2cb 100644 --- a/immunityreserveslots/scripting/include/connect.inc +++ b/immunityreserveslots/scripting/include/connect.inc @@ -1,11 +1,23 @@ -#if defined _connect_included -#endinput +#if defined _Connect_Included + #endinput #endif -#define _connect_included +#define _Connect_Included -forward bool:OnClientPreConnectEx(const String:name[], String:password[255], const String:ip[], const String:steamID[], String:rejectReason[255]); +enum EConnect +{ + k_OnClientPreConnectEx_Reject = 0, + k_OnClientPreConnectEx_Accept = 1, + k_OnClientPreConnectEx_Async = -1 +}; -public Extension:__ext_Connect = +forward EConnect OnClientPreConnectEx(const char[] sName, char sPassword[255], const char[] sIP, const char[] sSteam32ID, char sRejectReason[255]); + +native bool ClientPreConnectEx(const char[] sSteam32ID, EConnect RetVal, char sRejectReason[255]); + +/** + * Do not edit below this line! + */ +public Extension __ext_connect = { name = "Connect", file = "connect.ext", @@ -19,4 +31,11 @@ public Extension:__ext_Connect = #else required = 0, #endif +}; + +#if !defined REQUIRE_EXTENSIONS +public __ext_connect_SetNTVOptional() +{ + MarkNativeAsOptional("ClientPreConnectEx"); } +#endif diff --git a/immunityreserveslots/translations/immunityreserveslots.phrases.txt b/immunityreserveslots/translations/immunityreserveslots.phrases.txt new file mode 100644 index 00000000..5e195e2f --- /dev/null +++ b/immunityreserveslots/translations/immunityreserveslots.phrases.txt @@ -0,0 +1,115 @@ +"Phrases" +{ + "irs_version" + { + "en" "Immunity Reserve Slots version." + } + "irs_kicktype" + { + "en" "Who to kick when a valid player is found (0 - random, 1 - highest ping, 2 - highest time, 3 - lowest time)." + } + "irs_kickreason" + { + "en" "Message to display when a client is kicked for a normal reserve slot (\"default\" - uses translation phrase, anything else uses what you enter)." + } + "irs_rejectreason_enable" + { + "en" "Enable reject reason with the Connect extension (0 - disable, 1 - enable)." + } + "irs_rejectreason" + { + "en" "Message to display when a client gets rejected for a reserve slot when they have reserve rights with the Connect extension (\"default\" - uses translation phrase, anything else uses what you enter)." + } + "irs_kickreason_immunity" + { + "en" "Message to display when a client is kicked for a reserve slot based on immunity (\"default\" - uses translation phrase, anything else uses what you enter)." + } + "irs_log" + { + "en" "Enable logging (0 - disable, 1 - enable highly verbose logs, 2 - only log the disconnected and connecting users in regular SM logs)." + } + "irs_immunity" + { + "en" "Enable immunity check (0 - disable, 1 - immunity check if server is full of reserves, 2 - as with 1 but also allow players with high enough immunity and no reserve flag to stay connected)." + } + "irs_kickspecfirst" + { + "en" "When enabled spectators are always kicked first before anyone else (0 - disable, all players are taken into account for kicking, 1 - enable)." + } + "irs_kickspecdelay" + { + "en" "The delay, in seconds, to kick spectators (0 - instant, any other value gives spectators a grace of xx seconds until they can be kicked)." + } + "irs_donator_support" + { + "en" "When enabled along with the donators plugin, donaotrs will be allowed to connect (0 - disable, 1 - allow donators to connect)." + } + "irs_donator_immunity" + { + "en" "The immunity value to give to donators, if required for immunity checks within IRS." + } + "irs_highimmunitylimit" + { + "en" "The maximum amount of players that can connect to the server and kick a low immunity reserve slot player (0 - no limit, more than 0 to set the max limit)." + } + "irs_highimmunityvalue" + { + "en" "This value and over are players who are considered to have high immunity (0 - disable, more than 0 to set the high immunity value)." + } + "irs_keepbalance" + { + "en" "This tries to kick people in such a way to prevent autobalance (0 - disable, 1 - enable)." + } + "irs_autopassword" + { + "en" "Allow direct connecting reserve slot users to connect without having to type in the password on a password protected server with the Connect extension (0 - disable, 1 - enable, 2 - as with 1 but allow all connecting clients to connect)." + } + "irs_kicklist_file" + { + "en" "Path to kick list file (\"default\" - uses a file in the sourcemod config folder called irs_kicklist.ini, anything else uses what you enter e.g. \"cfg/kicklist.cfg\")." + } + "irs_kicklist_mode" + { + "en" "Enable kick list mode (0 - disable, normal reserve slot operation, 1 - only use a kick list to kick specific clients, 2 - as with 1 but allow any connecting client to kick people from the server)." + } + "irs_kicklist_reload" + { + "en" "Reloads the kick list." + } + "IRS Kick Log" + { + "#format" "{1:s},{2:s},{3:s},{4:s}" + "en" "\"{1}\" ({2}) connected, \"{3}\" ({4}) was kicked." + } + "IRS Kick Reason" + { + "en" "Slot reserved." + } + "IRS Reject Reason" + { + "en" "No reserve slots available." + } + "IRS Kick List Reloaded" + { + "en" "[SM] Immunity Reserve Slots kick list reloaded." + } + "IRS Kick Reason Immunity" + { + "en" "Slot reserved - low immunity." + } + "IRS Plugin Error" + { + "#format" "{1:s}" + "en" "Unloaded plugin {1} and moved to disabled folder, when installing IRS please do not use any other reserve slot plugins." + } + "IRS Kick List Path Error" + { + "#format" "{1:s}" + "en" "Path to kick list file \"{1}\" not found or unreadable, disabling kick list mode until corrected." + } + "IRS Donator Plugin Error" + { + "en" "Unable to load the donator plugin, please check your plugins folder for the donator plugin or any other errors in your error logs." + } +} + diff --git a/includes/GFLClanru.inc b/includes/GFLClanru.inc new file mode 100644 index 00000000..7af00d03 --- /dev/null +++ b/includes/GFLClanru.inc @@ -0,0 +1,30 @@ +#if defined _GFLClanru_Included + #endinput +#endif +#define _GFLClanru_Included + +typeset AsyncHasSteamIDReservedSlotCallbackFunc +{ + function void (const char[] sSteam32ID, int Result); + function void (const char[] sSteam32ID, int Result, any Data); +}; + +native void AsyncHasSteamIDReservedSlot(const char[] sSteam32ID, AsyncHasSteamIDReservedSlotCallbackFunc Callback, any Data = 0); + +public SharedPlugin __pl_GFLClanru = +{ + name = "GFLClanru", + file = "GFLClanru.smx", +#if defined REQUIRE_PLUGIN + required = 1, +#else + required = 0, +#endif +}; + +#if !defined REQUIRE_PLUGIN +public __pl_GFLClanru_SetNTVOptional() +{ + MarkNativeAsOptional("AsyncHasSteamIDReservedSlot"); +} +#endif diff --git a/includes/connect.inc b/includes/connect.inc new file mode 100644 index 00000000..e651d2cb --- /dev/null +++ b/includes/connect.inc @@ -0,0 +1,41 @@ +#if defined _Connect_Included + #endinput +#endif +#define _Connect_Included + +enum EConnect +{ + k_OnClientPreConnectEx_Reject = 0, + k_OnClientPreConnectEx_Accept = 1, + k_OnClientPreConnectEx_Async = -1 +}; + +forward EConnect OnClientPreConnectEx(const char[] sName, char sPassword[255], const char[] sIP, const char[] sSteam32ID, char sRejectReason[255]); + +native bool ClientPreConnectEx(const char[] sSteam32ID, EConnect RetVal, char sRejectReason[255]); + +/** + * Do not edit below this line! + */ +public Extension __ext_connect = +{ + name = "Connect", + file = "connect.ext", +#if defined AUTOLOAD_EXTENSIONS + autoload = 1, +#else + autoload = 0, +#endif +#if defined REQUIRE_EXTENSIONS + required = 1, +#else + required = 0, +#endif +}; + +#if !defined REQUIRE_EXTENSIONS +public __ext_connect_SetNTVOptional() +{ + MarkNativeAsOptional("ClientPreConnectEx"); +} +#endif diff --git a/includes/updater.inc b/includes/updater.inc new file mode 100644 index 00000000..f37bdf29 --- /dev/null +++ b/includes/updater.inc @@ -0,0 +1,97 @@ +#if defined _updater_included + #endinput +#endif +#define _updater_included + +/** + * Adds your plugin to the updater. The URL will be updated if + * your plugin was previously added. + * + * @param url URL to your plugin's update file. + * @noreturn + */ +native Updater_AddPlugin(const String:url[]); + +/** + * Removes your plugin from the updater. This does not need to + * be called during OnPluginEnd. + * + * @noreturn + */ +native Updater_RemovePlugin(); + +/** + * Forces your plugin to be checked for updates. The behaviour + * of the update is dependant on the server's configuration. + * + * @return True if an update was triggered. False otherwise. + * @error Plugin not found in updater. + */ +native bool:Updater_ForceUpdate(); + +/** + * Called when your plugin is about to be checked for updates. + * + * @return Plugin_Handled to prevent checking, Plugin_Continue to allow it. + */ +forward Action:Updater_OnPluginChecking(); + +/** + * Called when your plugin is about to begin downloading an available update. + * + * @return Plugin_Handled to prevent downloading, Plugin_Continue to allow it. + */ +forward Action:Updater_OnPluginDownloading(); + +/** + * Called when your plugin's update files have been fully downloaded + * and are about to write to their proper location. This should be used + * to free read-only resources that require write access for your update. + * + * @note OnPluginUpdated will be called later during the same frame. + * + * @noreturn + */ +forward Updater_OnPluginUpdating(); + +/** + * Called when your plugin's update has been completed. It is safe + * to reload your plugin at this time. + * + * @noreturn + */ +forward Updater_OnPluginUpdated(); + +/** + * @brief Reloads a plugin. + * + * @param plugin Plugin Handle (INVALID_HANDLE uses the calling plugin). + * @noreturn + */ +stock ReloadPlugin(Handle:plugin=INVALID_HANDLE) +{ + decl String:filename[64]; + GetPluginFilename(plugin, filename, sizeof(filename)); + ServerCommand("sm plugins reload %s", filename); +} + + +public SharedPlugin:__pl_updater = +{ + name = "updater", + file = "updater.smx", +#if defined REQUIRE_PLUGIN + required = 1, +#else + required = 0, +#endif +}; + +#if !defined REQUIRE_PLUGIN +public __pl_updater_SetNTVOptional() +{ + MarkNativeAsOptional("Updater_AddPlugin"); + MarkNativeAsOptional("Updater_RemovePlugin"); + MarkNativeAsOptional("Updater_ForceUpdate"); +} +#endif diff --git a/includes/zombiereloaded.inc b/includes/zombiereloaded.inc index d79c798b..dee73e42 100644 --- a/includes/zombiereloaded.inc +++ b/includes/zombiereloaded.inc @@ -6,7 +6,7 @@ * File: zombiereloaded.inc * Type: Include * Description: Main API include file. - * Notes: Include this file to include the whole ZR API. + * Notes: Include this file to include the whole ZR API. * * Copyright (C) 2009-2013 Greyscale, Richard Helgeby * @@ -34,3 +34,34 @@ #include #include #include + +public SharedPlugin:__pl_zombiereloaded = +{ + name = "zombiereloaded", + file = "zombiereloaded.smx", +#if defined REQUIRE_PLUGIN + required = 1 +#else + required = 0 +#endif +}; + +#if !defined REQUIRE_PLUGIN +public __pl_zombiereloaded_SetNTVOptional() +{ + MarkNativeAsOptional("ZR_IsValidClassIndex"); + MarkNativeAsOptional("ZR_GetActiveClass"); + MarkNativeAsOptional("ZR_SelectClientClass"); + MarkNativeAsOptional("ZR_GetClassByName"); + MarkNativeAsOptional("ZR_GetClassDisplayName"); + + MarkNativeAsOptional("ZR_IsClientZombie"); + MarkNativeAsOptional("ZR_IsClientHuman"); + MarkNativeAsOptional("ZR_InfectClient"); + MarkNativeAsOptional("ZR_HumanClient"); + + MarkNativeAsOptional("ZR_RespawnClient"); + MarkNativeAsOptional("ZR_SetKilledByWorld"); + MarkNativeAsOptional("ZR_GetKilledByWorld"); +} +#endif diff --git a/mapchooser_extended/scripting/mapchooser_extended.sp b/mapchooser_extended/scripting/mapchooser_extended.sp index 023107fb..8c45efce 100644 --- a/mapchooser_extended/scripting/mapchooser_extended.sp +++ b/mapchooser_extended/scripting/mapchooser_extended.sp @@ -54,7 +54,7 @@ #undef REQUIRE_PLUGIN #include -#define MCE_VERSION "1.10.2" +#define MCE_VERSION "1.11.0" #define NV "nativevotes" @@ -2161,6 +2161,11 @@ public Native_ExcludeMap(Handle:plugin, numParams) PushArrayString(g_OldMapList, map); + if (GetArraySize(g_OldMapList) > GetConVarInt(g_Cvar_ExcludeMaps)) + { + RemoveFromArray(g_OldMapList, 0); + } + return true; } diff --git a/mapchooser_extended/scripting/nominations_extended.sp b/mapchooser_extended/scripting/nominations_extended.sp index ad8fb845..fed42daf 100644 --- a/mapchooser_extended/scripting/nominations_extended.sp +++ b/mapchooser_extended/scripting/nominations_extended.sp @@ -38,7 +38,7 @@ #include #pragma semicolon 1 -#define MCE_VERSION "1.10.0" +#define MCE_VERSION "1.11.0" public Plugin:myinfo = { @@ -98,6 +98,7 @@ public OnPluginStart() RegConsoleCmd("sm_nomlist", Command_NominateList); RegAdminCmd("sm_nominate_addmap", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_nominate_addmap - Forces a map to be on the next mapvote."); + RegAdminCmd("sm_nominate_removemap", Command_Removemap, ADMFLAG_CHANGEMAP, "sm_nominate_removemap - Removes a map from Nominations."); // BotoX RegAdminCmd("sm_nominate_exclude", Command_AddExclude, ADMFLAG_CHANGEMAP, "sm_nominate_exclude - Forces a map to be inserted into the recently played maps. Effectively blocking the map from being nominated."); @@ -220,6 +221,39 @@ public Action:Command_Addmap(client, args) return Plugin_Handled; } +public Action:Command_Removemap(client, args) +{ + if (args != 1) + { + CReplyToCommand(client, "[NE] Usage: sm_nominate_removemap "); + return Plugin_Handled; + } + + decl String:mapname[PLATFORM_MAX_PATH]; + GetCmdArg(1, mapname, sizeof(mapname)); + + // new status; + if (/*!GetTrieValue(g_mapTrie, mapname, status)*/!IsMapValid(mapname)) + { + CReplyToCommand(client, "%t", "Map was not found", mapname); + return Plugin_Handled; + } + + if (!RemoveNominationByMap(mapname)) + { + CReplyToCommand(client, "This map isn't nominated.", mapname); + + return Plugin_Handled; + } + + CReplyToCommand(client, "Map '%s' removed from the nominations list.", mapname); + LogAction(client, -1, "\"%L\" removed map \"%s\" from nominations.", client, mapname); + + PrintToChatAll("[NE] %N has removed %s from nominations", client, mapname); + + return Plugin_Handled; +} + public Action:Command_AddExclude(client, args) { if (args < 1) @@ -296,7 +330,7 @@ public Action:Command_Nominate(client, args) if (g_NominationDelay > GetTime()) { - ReplyToCommand(client, "[NE] Nominations will be unlocked in %d seconds", g_NominationDelay - GetTime()); + PrintToChat(client, "[NE] Nominations will be unlocked in %d seconds", g_NominationDelay - GetTime()); return Plugin_Handled; } @@ -308,7 +342,7 @@ public Action:Command_Nominate(client, args) if (g_Player_NominationDelay[client] > GetTime()) { - ReplyToCommand(client, "[NE] Please wait %d seconds before you can nominate again", g_Player_NominationDelay[client] - GetTime()); + PrintToChat(client, "[NE] Please wait %d seconds before you can nominate again", g_Player_NominationDelay[client] - GetTime()); return Plugin_Handled; } @@ -318,7 +352,7 @@ public Action:Command_Nominate(client, args) new status; if (!GetTrieValue(g_mapTrie, mapname, status)) { - CReplyToCommand(client, "%t", "Map was not found", mapname); + CPrintToChat(client, "%t", "Map was not found", mapname); return Plugin_Handled; } @@ -326,17 +360,17 @@ public Action:Command_Nominate(client, args) { if ((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT) { - CReplyToCommand(client, "[NE] %t", "Can't Nominate Current Map"); + CPrintToChat(client, "[NE] %t", "Can't Nominate Current Map"); } if ((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS) { - CReplyToCommand(client, "[NE] %t", "Map in Exclude List"); + CPrintToChat(client, "[NE] %t", "Map in Exclude List"); } if ((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED) { - CReplyToCommand(client, "[NE] %t", "Map Already Nominated"); + CPrintToChat(client, "[NE] %t", "Map Already Nominated"); } return Plugin_Handled; @@ -348,11 +382,11 @@ public Action:Command_Nominate(client, args) { if (result == Nominate_AlreadyInVote) { - CReplyToCommand(client, "[NE] %t", "Map Already In Vote", mapname); + CPrintToChat(client, "[NE] %t", "Map Already In Vote", mapname); } else if (result == Nominate_VoteFull) { - CReplyToCommand(client, "[ME] %t", "Max Nominations"); + CPrintToChat(client, "[ME] %t", "Max Nominations"); } return Plugin_Handled; @@ -384,7 +418,7 @@ public Action:Command_NominateList(client, args) GetNominatedMapList(MapList); if (!GetArraySize(MapList)) { - CReplyToCommand(client, "[NE] No maps have been nominated."); + CPrintToChat(client, "[NE] No maps have been nominated."); return Plugin_Handled; } @@ -516,6 +550,13 @@ public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2) { case MenuAction_Select: { + if (g_Player_NominationDelay[param1] > GetTime()) + { + PrintToChat(param1, "[NE] Please wait %d seconds before you can nominate again", g_Player_NominationDelay[param1] - GetTime()); + DisplayMenuAtItem(menu, param1, GetMenuSelectionPosition(), MENU_TIME_FOREVER); + return 0; + } + decl String:map[PLATFORM_MAX_PATH], String:name[MAX_NAME_LENGTH]; GetMenuItem(menu, param2, map, sizeof(map)); @@ -543,6 +584,7 @@ public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2) PrintToChatAll("[NE] %t", "Map Nomination Changed", name, map); LogMessage("%s nominated %s", name, map); + g_Player_NominationDelay[param1] = GetTime() + GetConVarInt(g_Cvar_NominateDelay); } case MenuAction_DrawItem: diff --git a/mapchooser_extended/scripting/rockthevote_extended.sp b/mapchooser_extended/scripting/rockthevote_extended.sp index 2cbdc875..5f1188a2 100644 --- a/mapchooser_extended/scripting/rockthevote_extended.sp +++ b/mapchooser_extended/scripting/rockthevote_extended.sp @@ -42,7 +42,7 @@ #pragma semicolon 1 -#define MCE_VERSION "1.10.0" +#define MCE_VERSION "1.11.0" public Plugin:myinfo = { diff --git a/mapchooser_extended/translations/mapchooser_extended.phrases.txt b/mapchooser_extended/translations/mapchooser_extended.phrases.txt index 03d22af5..b2b2f0d5 100644 --- a/mapchooser_extended/translations/mapchooser_extended.phrases.txt +++ b/mapchooser_extended/translations/mapchooser_extended.phrases.txt @@ -3,12 +3,12 @@ "Vote Nextmap" { "en" "Vote for the next map!" - } + } "Nextmap Voting Started" { "en" "Voting for next map has started." - } + } "Nextmap Voting Finished" { @@ -21,7 +21,7 @@ "#format" "{1:i},{2:i}" "en" "The current map has been extended. (Received {1}%% of {2} votes)" } - + "Extend Map" { "en" "Extend Current Map" @@ -41,7 +41,7 @@ "Changed Next Map" { "#format" "{1:s}" - "en" "Changed nextmap to \"{1}\"." + "en" "Changed nextmap to \"{1}\"." } "Runoff Vote Nextmap"