diff --git a/AntiLenny/scripting/AntiLenny.sp b/AntiLenny/scripting/AntiLenny.sp new file mode 100644 index 00000000..28a4f193 --- /dev/null +++ b/AntiLenny/scripting/AntiLenny.sp @@ -0,0 +1,100 @@ +#pragma semicolon 1 + +#include +#include +#include +#include +#include +#include +#include + +bool g_bHideLennies[MAXPLAYERS + 1] = { false, ... }; +bool g_bHideLenniesHooked = false; +Handle g_hCookieHideLennies = null; + +char g_cLennies[23][] = {"( ͡° ͜ʖ ͡°)", "͜ʖ", "(° ͜ʖ °)", "( ͝͠°͜ل͝͠°)", "( ͡° ͜ ͡°)", "( ͡°╭͜ʖ╮͡° )", "( ͠° ͜ʖ ͡°)", "( ° ͜ʖ °)", "(╯°□°)╯", "_(ツ)_", "_ツ_", "( ̿°̿ ͜ل͜ ̿°̿ )", "( ͡", "( ͠", "( ͝", "( °", "(͡", "ಠ_ಠ", "͡°", "°͡", "ʖ", "͡", "͜"}; + +public Plugin myinfo = +{ + name = "AntiLenny", + author = "Dogan", + description = "Makes it possible to selfmute Lennies", + version = "1.2.0", + url = "" +} + +public void OnPluginStart() +{ + RegConsoleCmd("sm_hide_lennies", HideLennies, "Toggle blocking Lennies"); + + g_hCookieHideLennies = RegClientCookie("lennies_blocked", "are lennies blocked", CookieAccess_Protected); +} + +public Action CCC_OnChatMessage(int client, int author, const char[] message) +{ + for(int i = 0; i < 23; i++) + { + if(g_bHideLennies[client] && StrContains(message, g_cLennies[i], false) != -1) + { + return Plugin_Handled; + } + } + return Plugin_Continue; +} + +public Action HideLennies(int client, int args) +{ + g_bHideLennies[client] = !g_bHideLennies[client]; + CheckHideLenniesHooks(); + + if(g_bHideLennies[client]) + { + ReplyToCommand(client, "You blocked Lennies"); + SetClientCookie(client, g_hCookieHideLennies, "1"); + } + else + { + ReplyToCommand(client, "You unblocked Lennies"); + SetClientCookie(client, g_hCookieHideLennies, ""); + } + return Plugin_Handled; +} + +public void OnClientCookiesCached(int client) +{ + char sBuffer[2]; + + GetClientCookie(client, g_hCookieHideLennies, sBuffer, sizeof(sBuffer)); + + if(sBuffer[0] != '\0') + { + g_bHideLennies[client] = true; + g_bHideLenniesHooked = true; + } + else + { + g_bHideLennies[client] = false; + } +} + +public void OnClientDisconnect(int client) +{ + g_bHideLennies[client] = false; + CheckHideLenniesHooks(); +} + +public void CheckHideLenniesHooks() +{ + bool bShouldHook = false; + + for(int i = 1; i <= MaxClients; i++) + { + if(g_bHideLennies[i]) + { + bShouldHook = true; + break; + } + } + + g_bHideLenniesHooked = bShouldHook; +} \ No newline at end of file diff --git a/SpamMessage/scripting/SpamMessage.sp b/SpamMessage/scripting/SpamMessage.sp new file mode 100644 index 00000000..463114f6 --- /dev/null +++ b/SpamMessage/scripting/SpamMessage.sp @@ -0,0 +1,102 @@ +#pragma semicolon 1 + +#include +#include +/*#include +#include +#include +#include */ + +ConVar g_cMessagePosition; +ConVar g_cMessageColor; +ConVar g_cMessageCooldown; +ConVar g_cMessageText; + +float MessagePos[2]; +int MessageColor[3]; +char MessageTxt[512]; +Handle MessageTimer; +Handle MessageSync; + +public Plugin myinfo = +{ + name = "SpamMessage", + author = "Dogan", + description = "Provide the server with important informations/advertisements", + version = "1.1.0", + url = "" +} + +public void OnPluginStart() +{ + g_cMessagePosition = CreateConVar("sm_message_position", "-1.0 0.8125", "The x and y positions for the message"); + g_cMessageColor = CreateConVar("sm_message_color", "0 255 0", "RGB color value for the message"); + g_cMessageCooldown = CreateConVar("sm_message_cooldown", "180", "Cooldown of the message in seconds"); + g_cMessageText = CreateConVar("sm_message_text", "UNLOZE Christmas Sale: 25%% on all VIP Offers. Check www.unloze.com for more info.", "Text thats shown on the message"); + + g_cMessagePosition.AddChangeHook(ConVarChange); + g_cMessageColor.AddChangeHook(ConVarChange); + g_cMessageCooldown.AddChangeHook(ConVarChange); + g_cMessageText.AddChangeHook(ConVarChange); + + MessageSync = CreateHudSynchronizer(); + + AutoExecConfig(true, "plugin.SpamMessage"); + GetConVars(); +} + +public void ColorStringToArray(const char[] sColorString, int aColor[3]) +{ + char asColors[4][4]; + ExplodeString(sColorString, " ", asColors, sizeof(asColors), sizeof(asColors[])); + + aColor[0] = StringToInt(asColors[0]); + aColor[1] = StringToInt(asColors[1]); + aColor[2] = StringToInt(asColors[2]); +} + +public void GetConVars() +{ + char StringPos[2][8]; + char PosValue[16]; + g_cMessagePosition.GetString(PosValue, sizeof(PosValue)); + ExplodeString(PosValue, " ", StringPos, sizeof(StringPos), sizeof(StringPos[])); + + MessagePos[0] = StringToFloat(StringPos[0]); + MessagePos[1] = StringToFloat(StringPos[1]); + + char ColorValue[64]; + g_cMessageColor.GetString(ColorValue, sizeof(ColorValue)); + + ColorStringToArray(ColorValue, MessageColor); + + g_cMessageText.GetString(MessageTxt, sizeof(MessageTxt)); + + if (MessageTimer != INVALID_HANDLE && CloseHandle(MessageTimer)) + MessageTimer = INVALID_HANDLE; + + MessageTimer = CreateTimer(g_cMessageCooldown.FloatValue, TimerCooldown, _, TIMER_REPEAT); +} + +public void ConVarChange(ConVar convar, char[] oldValue, char[] newValue) +{ + GetConVars(); +} + +public void SendMessage() +{ + SetHudTextParams(MessagePos[0], MessagePos[1], 6.0, MessageColor[0], MessageColor[1], MessageColor[2], 255, 1, 4.0, 0.8, 0.8); + + for (int client = 1; client <= MAXPLAYERS; client++) + { + if (IsClientConnected(client)) + { + ShowSyncHudText(client, MessageSync, MessageTxt); + } + } +} + +public Action TimerCooldown(Handle timer) +{ + SendMessage(); +} \ No newline at end of file diff --git a/VIPMode/scripting/VIPMode.sp b/VIPMode/scripting/VIPMode.sp new file mode 100644 index 00000000..12ee8c07 --- /dev/null +++ b/VIPMode/scripting/VIPMode.sp @@ -0,0 +1,192 @@ +#pragma semicolon 1 + +#include +#include +#include +#include +#include + +int g_iVIPClient = -1; +bool g_bmotherInfect = false; + +public Plugin myinfo = +{ + name = "VIP Mode", + author = "Dogan + zaCade", + description = "VIP Mode from Paranoid as Plugin", + version = "1.0.0", + url = "" +}; + +public void OnPluginStart() +{ + HookEvent("player_death", OnPlayerDeath); + HookEvent("round_start", OnRoundStart); + HookEvent("round_end", OnRoundEnd); + HookEvent("player_team", OnPlayerTeam); + + RegConsoleCmd("sm_currentvip", WhoIsVIP); + RegAdminCmd("sm_randomvip", PerformAdminVIPSelection, ADMFLAG_GENERIC, "Randomly chooses another alive humans as VIP"); +} + +public Action WhoIsVIP(int client, int args) +{ + if (g_iVIPClient == -1) + { + CReplyToCommand(client, "{purple}VIP Mode:{red} There currently is no VIP!"); + } + else + { + CReplyToCommand(client, "{purple}VIP Mode:{red} %N is the current VIP! Protect him.", g_iVIPClient); + } + return Plugin_Handled; +} + +public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn) +{ + if(motherInfect && g_bmotherInfect == false) + { + g_bmotherInfect = true; + CreateTimer(5.0, SelectVIP, _, TIMER_FLAG_NO_MAPCHANGE); + } +} + +public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast) +{ + g_iVIPClient = -1; + g_bmotherInfect = false; +} + +public Action OnRoundEnd(Event event, const char[] name, bool dontBroadcast) +{ + g_iVIPClient = -1; + g_bmotherInfect = false; +} + +public Action SelectVIP(Handle timer) +{ + PerformVIPSelection(false); +} + +public Action SlayHumans(Handle timer) +{ + PerformCTSlay(); +} + +public void PerformVIPSelection(bool reselect) +{ + int PotentialVIPCount; + int PotentialVIPClient[64]; + + for (int client = 1; client <= MaxClients; client++) + { + if (IsClientInGame(client) && IsPlayerAlive(client) && ZR_IsClientHuman(client)) + { + PotentialVIPClient[PotentialVIPCount] = client; + PotentialVIPCount++; + } + } + + g_iVIPClient = PotentialVIPClient[GetRandomInt(0, PotentialVIPCount - 1)]; + + CPrintToChatAll("{purple}VIP Mode:{red} %N is the new VIP! Protect him.", g_iVIPClient); + + if (!reselect) + { + CPrintToChatAll("{purple}VIP Mode:{red} Everyone will die when the VIP dies!"); + CPrintToChatAll("{purple}VIP Mode:{red} Everyone will die when the VIP dies!"); + CPrintToChatAll("{purple}VIP Mode:{red} Everyone will die when the VIP dies!"); + } +} + +public Action PerformAdminVIPSelection(int client, int args) +{ + if(g_iVIPClient == -1) + { + CReplyToCommand(client, "{purple}VIP Mode:{red} You can't choose a VIP yet."); + } + + else + { + g_iVIPClient = -1; + + int PotentialVIPCount; + int PotentialVIPClient[64]; + + for (int player = 1; player <= MaxClients; player++) + { + if (IsClientInGame(player) && IsPlayerAlive(player) && ZR_IsClientHuman(player)) + { + PotentialVIPClient[PotentialVIPCount] = player; + PotentialVIPCount++; + } + } + g_iVIPClient = PotentialVIPClient[GetRandomInt(0, PotentialVIPCount - 1)]; + + CPrintToChatAll("{purple}VIP Mode:{red} %N is the new VIP! Protect him.", g_iVIPClient); + + CReplyToCommand(client, "{purple}VIP Mode:{red} You have randomly chosen another VIP."); + } + return Plugin_Handled; +} + +public Action OnPlayerDeath(Event event, const char[] name, bool dontBroadcast) +{ + int client = GetClientOfUserId(GetEventInt(event, "userid")); + + if(client == g_iVIPClient) + { + g_iVIPClient = -1; + + CPrintToChatAll("{purple}VIP Mode:{red} The VIP died! It's over."); + CPrintToChatAll("{purple}VIP Mode:{red} The VIP died! It's over."); + CPrintToChatAll("{purple}VIP Mode:{red} The VIP died! It's over."); + + CreateTimer(2.0, SlayHumans, _, TIMER_FLAG_NO_MAPCHANGE); + } +} + +public void OnClientDisconnect(int client) +{ + if(client == g_iVIPClient) + { + g_iVIPClient = -1; + PerformVIPSelection(true); + } +} + +public Action OnPlayerTeam(Event event, const char[] name, bool dontBroadcast) +{ + int client = GetClientOfUserId(GetEventInt(event, "userid")); + + if(client == g_iVIPClient) + { + g_iVIPClient = -1; + RequestFrame(RequestFrame_Callback); + } +} + +public void OnPlayerSwitchedToSpectateByCommand(int client) +{ + if(client == g_iVIPClient) + { + g_iVIPClient = -1; + RequestFrame(RequestFrame_Callback); + } +} + +public void RequestFrame_Callback(int iPacked) +{ + PerformVIPSelection(true); +} + +public void PerformCTSlay() +{ + for (int player = 1; player <= MaxClients; player++) + { + if (IsClientInGame(player) && IsPlayerAlive(player) && ZR_IsClientHuman(player)) + { + ForcePlayerSuicide(player); + } + } +} \ No newline at end of file