Delete whats obsolete

This commit is contained in:
DoganGFL 2019-07-25 00:35:33 +02:00
parent 9073c3f590
commit 7d8af52e61
25 changed files with 0 additions and 3236 deletions

View File

@ -1,166 +0,0 @@
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <zombiereloaded>
#include <cstrike>
#include <ccc>
#include <multicolors>
#include <clientprefs>
bool g_bHideLennies[MAXPLAYERS + 1] = { false, ... };
Handle g_hCookieHideLennies = null;
#define NUMBEROFLENNIES 23
char g_cLennies[NUMBEROFLENNIES][] = {"( ͡° ͜ʖ ͡°)", "͜ʖ", "(° ͜ʖ °)", "( ͝͠°͜ل͝͠°)", "( ͡° ͜ ͡°)", "( ͡°╭͜ʖ╮͡° )", "( ͠° ͜ʖ ͡°)", "( ° ͜ʖ °)", "(╯°□°)╯", "_(ツ)_", "_ツ_", "( ̿°̿ ͜ل͜ ̿°̿ )", "( ͡", "( ͠", "( ͝", "( °", "", "ಠ_ಠ", "͡°", "°͡", "ʖ", "͡", "͜"};
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Plugin myinfo =
{
name = "AntiLenny",
author = "Dogan",
description = "Makes it possible to selfmute Lennies",
version = "1.3.0",
url = ""
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnPluginStart()
{
RegConsoleCmd("sm_hide_lennies", OnToggleLennies, "Toggle blocking Lennies");
g_hCookieHideLennies = RegClientCookie("lennies_blocked", "are lennies blocked", CookieAccess_Protected);
SetCookieMenuItem(MenuHandler_CookieMenu, 0, "Hide Lennies");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action OnToggleLennies(int client, int args)
{
ToggleLennies(client);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void ShowSettingsMenu(int client)
{
Menu menu = new Menu(MenuHandler_MainMenu);
menu.SetTitle("AntiLenny Settings", client);
char sBuffer[128];
Format(sBuffer, sizeof(sBuffer), "Hiding Lennies: %s", g_bHideLennies[client] ? "Enabled" : "Disabled");
menu.AddItem("0", sBuffer);
menu.ExitBackButton = true;
menu.Display(client, MENU_TIME_FOREVER);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void MenuHandler_CookieMenu(int client, CookieMenuAction action, any info, char[] buffer, int maxlen)
{
switch(action)
{
case(CookieMenuAction_DisplayOption):
{
Format(buffer, maxlen, "AntiLenny", client);
}
case(CookieMenuAction_SelectOption):
{
ShowSettingsMenu(client);
}
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public int MenuHandler_MainMenu(Menu menu, MenuAction action, int client, int selection)
{
switch(action)
{
case(MenuAction_Select):
{
switch(selection)
{
case(0): ToggleLennies(client);
}
ShowSettingsMenu(client);
}
case(MenuAction_Cancel):
{
ShowCookieMenu(client);
}
case(MenuAction_End):
{
delete menu;
}
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action CCC_OnChatMessage(int client, int author, const char[] message)
{
for(int i = 0; i < NUMBEROFLENNIES; i++)
{
if(g_bHideLennies[client] && StrContains(message, g_cLennies[i], false) != -1)
{
return Plugin_Handled;
}
}
return Plugin_Continue;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void ToggleLennies(int client)
{
g_bHideLennies[client] = !g_bHideLennies[client];
SetClientCookie(client, g_hCookieHideLennies, g_bHideLennies[client] ? "1" : "");
CPrintToChat(client, "{cyan}[AntiLenny] {white}%s", g_bHideLennies[client] ? "Lennies are now hidden." : "Lennies are not hidden anymore.");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientCookiesCached(int client)
{
char sBuffer[2];
GetClientCookie(client, g_hCookieHideLennies, sBuffer, sizeof(sBuffer));
if(sBuffer[0] != '\0')
{
g_bHideLennies[client] = true;
}
else
{
g_bHideLennies[client] = false;
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientDisconnect(int client)
{
g_bHideLennies[client] = false;
}

View File

@ -1,116 +0,0 @@
#pragma semicolon 1
#define VERSION "1.0.1"
#include <sourcemod>
public Plugin:myinfo =
{
name = "Auto !zspawn",
author = "Darkthrone, Otstrel Team, TigerOx, TechKnow, AlliedModders LLC",
description = "Automatically exec !zspawn command on dead players",
version = VERSION,
url = "http://forums.alliedmods.net/showthread.php?t=117601"
};
new Handle:g_Respawn[MAXPLAYERS + 1] = {INVALID_HANDLE, ...};
new Handle:g_Cvar_RespawnTime = INVALID_HANDLE;
new Float:g_respawnTime;
new bool:g_roundStarted;
new g_playerClass[MAXPLAYERS + 1];
public OnPluginStart()
{
g_Cvar_RespawnTime = CreateConVar("autozspawn_delay", "0.1", "Delay before !zspawn");
g_respawnTime = GetConVarFloat(g_Cvar_RespawnTime);
new Handle:Cvar_Version = CreateConVar("autozspawn_version", VERSION, "Version of the Auto !zspawn", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
/* Just to make sure they it updates the convar version if they just had the plugin reload on map change */
SetConVarString(Cvar_Version, VERSION);
HookConVarChange(g_Cvar_RespawnTime, CvarChanged);
HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
HookEvent("player_team", Event_PlayerTeam);
g_roundStarted = true;
RegConsoleCmd("joinclass", Event_JoinClass);
}
public Action:Event_JoinClass(client, args)
{
g_Respawn[client] = CreateTimer(g_respawnTime, ExecRespawn, client);
g_playerClass[client] = 1;
}
public CvarChanged(Handle:cvar, const String:oldValue[], const String:newValue[])
{
if ( cvar == g_Cvar_RespawnTime )
{
g_respawnTime = GetConVarFloat(g_Cvar_RespawnTime);
if ( g_respawnTime < 2 )
{
g_respawnTime = 2.0;
}
return;
}
}
public Action:Event_RoundEnd(Handle:event,const String:name[],bool:dontBroadcast)
{
g_roundStarted = false;
}
public Action:Event_RoundStart(Handle:event,const String:name[],bool:dontBroadcast)
{
g_roundStarted = true;
}
public Action:ExecRespawn(Handle:timer, any:client)
{
if ( client && IsClientInGame(client) && (GetClientTeam(client) > 1) && (!IsPlayerAlive(client)) && g_playerClass[client] )
{
if ( !g_roundStarted )
{
PrintToChat(client,"\x04[Auto !zspawn] \x01You will respawn next round");
}
else if (FindConVar("gs_zombiereloaded_version") != INVALID_HANDLE)
{
FakeClientCommand(client, "zspawn");
}
else if (FindConVar("zombie_version") != INVALID_HANDLE)
{
FakeClientCommand(client, "zombie_respawn");
}
else
{
FakeClientCommand(client, "say !zspawn");
}
}
g_Respawn[client] = INVALID_HANDLE;
return Plugin_Stop;
}
public Event_PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
new newTeam = GetEventInt(event, "team");
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if ( !client || (newTeam < 2) )
{
return;
}
if ( IsFakeClient(client) )
{
g_playerClass[client] = 1;
// Fake clients does not exec joinclass, so we need to spawn them
// just when they joined team
g_Respawn[client] = CreateTimer(g_respawnTime, ExecRespawn, client);
}
else
{
g_playerClass[client] = 0;
}
}

View File

@ -1,897 +0,0 @@
#pragma semicolon 1
#include <basecomm>
#include <sourcemod>
#include <SteamWorks>
#include <regex>
#include <smjansson>
#include "sdktools_functions.inc"
#include <AntiBhopCheat>
#pragma newdecls required
#include "SteamAPI.secret" // #define STEAM_API_KEY "<key>"
#include "Discord.secret" // #define DISCORD_*
Regex g_Regex_Clyde = null;
ConVar g_Cvar_HostIP = null;
ConVar g_Cvar_HostPort = null;
ConVar g_Cvar_HostName = null;
ArrayList g_arrQueuedMessages = null;
Handle g_hDataTimer = null;
Handle g_hReplaceConfigFile = null;
UserMsg g_umSayText2 = INVALID_MESSAGE_ID;
bool g_bLoadedLate;
bool g_bTimerDone;
bool g_bProcessingData;
bool g_bGotReplaceFile;
bool g_bTeamChat;
char g_sReplacePath[PLATFORM_MAX_PATH];
char g_sAvatarURL[MAXPLAYERS + 1][128];
int g_iPlayersAtPOST = 0;
int g_iRatelimitRemaining = 5;
int g_iRatelimitReset;
float g_fReportCooldown[MAXPLAYERS + 1];
public Plugin myinfo =
{
name = "Discord core",
author = "Obus",
description = "Implements live chat and map reporting for Discord.",
version = "1.1.0",
url = ""
}
public APLRes AskPluginLoad2(Handle hThis, bool bLate, char[] sError, int err_max)
{
g_bLoadedLate = bLate;
return APLRes_Success;
}
public void OnPluginStart()
{
char sRegexErr[32];
RegexError RegexErr;
g_Regex_Clyde = CompileRegex(".*(clyde).*", PCRE_CASELESS, sRegexErr, sizeof(sRegexErr), RegexErr);
if (RegexErr != REGEX_ERROR_NONE)
LogError("Could not compile \"Clyde\" regex (err: %s)", sRegexErr);
g_hReplaceConfigFile = CreateKeyValues("AutoReplace");
BuildPath(Path_SM, g_sReplacePath, sizeof(g_sReplacePath), "configs/custom-chatcolorsreplace.cfg");
if (FileToKeyValues(g_hReplaceConfigFile, g_sReplacePath))
g_bGotReplaceFile = true;
g_arrQueuedMessages = CreateArray(ByteCountToCells(1024));
g_hDataTimer = CreateTimer(0.333, Timer_DataProcessor, INVALID_HANDLE, TIMER_REPEAT);
g_Cvar_HostIP = FindConVar("hostip");
g_Cvar_HostPort = FindConVar("hostport");
g_Cvar_HostName = FindConVar("hostname");
g_umSayText2 = GetUserMessageId("SayText2");
if (g_umSayText2 == INVALID_MESSAGE_ID)
SetFailState("This game doesn't support SayText2 user messages.");
HookUserMessage(g_umSayText2, Hook_UserMessage, false);
HookEvent("player_say", EventHook_PlayerSay, EventHookMode_Post);
AddCommandListener(CommandListener_SmChat, "sm_chat");
RegConsoleCmd("sm_report", Command_Report);
if (g_bLoadedLate)
{
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientAuthorized(i))
continue;
static char sAuthID32[32];
GetClientAuthId(i, AuthId_Steam2, sAuthID32, sizeof(sAuthID32));
OnClientAuthorized(i, sAuthID32);
}
}
}
public void OnPluginEnd()
{
delete g_arrQueuedMessages;
delete g_hDataTimer;
UnhookUserMessage(g_umSayText2, Hook_UserMessage, false);
UnhookEvent("player_say", EventHook_PlayerSay, EventHookMode_Post);
}
public void OnClientPutInServer(int client)
{
g_fReportCooldown[client] = 0.0;
if (!g_bTimerDone)
return;
int iClientCount = GetClientCount(false);
if (iClientCount >= g_iPlayersAtPOST+10)
FormatStatusAndPOST(g_iPlayersAtPOST = iClientCount);
}
public void OnClientAuthorized(int client, const char[] sAuthID32)
{
if (IsFakeClient(client))
return;
char sAuthID64[32];
if (!Steam32IDtoSteam64ID(sAuthID32, sAuthID64, sizeof(sAuthID64)))
return;
static char sRequest[256];
FormatEx(sRequest, sizeof(sRequest), "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=%s&steamids=%s&format=vdf", STEAM_API_KEY, sAuthID64);
Handle hRequest = SteamWorks_CreateHTTPRequest(k_EHTTPMethodGET, sRequest);
if (!hRequest ||
!SteamWorks_SetHTTPRequestContextValue(hRequest, client) ||
!SteamWorks_SetHTTPCallbacks(hRequest, OnTransferComplete) ||
!SteamWorks_SendHTTPRequest(hRequest))
{
delete hRequest;
}
}
public void OnMapStart()
{
g_bTimerDone = false;
CreateTimer(10.0, Timer_OnMapStart);
}
public Action Timer_OnMapStart(Handle hThis)
{
g_bTimerDone = true;
FormatStatusAndPOST(g_iPlayersAtPOST = GetClientCount(false));
}
public Action Timer_DataProcessor(Handle hThis)
{
if (!g_bProcessingData)
return;
if (g_iRatelimitRemaining == 0 && GetTime() < g_iRatelimitReset)
return;
//PrintToServer("[Timer_DataProcessor] Array Length #1: %d", g_arrQueuedMessages.Length);
char sContent[1024];
g_arrQueuedMessages.GetString(0, sContent, sizeof(sContent));
g_arrQueuedMessages.Erase(0);
char sURL[128];
g_arrQueuedMessages.GetString(0, sURL, sizeof(sURL));
g_arrQueuedMessages.Erase(0);
if (g_arrQueuedMessages.Length == 0)
g_bProcessingData = false;
//PrintToServer("[Timer_DataProcessor] Array Length #2: %d", g_arrQueuedMessages.Length);
//PrintToServer("%s | %s", sURL, sContent);
Handle hRequest = SteamWorks_CreateHTTPRequest(k_EHTTPMethodPOST, sURL);
JSONObject RequestJSON = view_as<JSONObject>(json_load(sContent));
if (!hRequest ||
!SteamWorks_SetHTTPRequestContextValue(hRequest, RequestJSON) ||
!SteamWorks_SetHTTPCallbacks(hRequest, OnHTTPRequestCompleted) ||
!SteamWorks_SetHTTPRequestRawPostBody(hRequest, "application/json", sContent, strlen(sContent)) ||
!SteamWorks_SetHTTPRequestNetworkActivityTimeout(hRequest, 10) ||
!SteamWorks_SendHTTPRequest(hRequest))
{
LogError("Discord SteamWorks_CreateHTTPRequest failed.");
delete RequestJSON;
delete hRequest;
return;
}
}
public void FormatStatusAndPOST(int iCurrentClients)
{
char sFinal[512];
char sCurrentMap[32];
char sServerName[64];
int iServerIP = g_Cvar_HostIP.IntValue;
int iServerPort = g_Cvar_HostPort.IntValue;
GetCurrentMap(sCurrentMap, sizeof(sCurrentMap));
g_Cvar_HostName.GetString(sServerName, sizeof(sServerName));
char sTitle[64];
char sDescription[256];
strcopy(sTitle, sizeof(sTitle), sServerName);
Format(sDescription, sizeof(sDescription), "Current Map: **%s**\nCurrent Players: **%d/%d**\nQuick Join: **steam://connect/%d.%d.%d.%d:%d**",
sCurrentMap, iCurrentClients, MaxClients, iServerIP >>> 24 & 255, iServerIP >>> 16 & 255, iServerIP >>> 8 & 255, iServerIP & 255, iServerPort);
JSONRootNode hJSONFinal = new JSONObject();
JSONObject hEmbeds = new JSONObject();
JSONArray arrEmbeds = new JSONArray();
(view_as<JSONObject>(hJSONFinal)).SetString("username", "MapInfo");
hEmbeds.SetInt("color", 0xFF0000);
hEmbeds.SetString("title", sTitle);
hEmbeds.SetString("description", sDescription);
arrEmbeds.Append(hEmbeds);
(view_as<JSONObject>(hJSONFinal)).Set("embeds", arrEmbeds);
//hJSONFinal.DumpToServer();
hJSONFinal.ToString(sFinal, sizeof(sFinal), 0);
HTTPPostJSON(DISCORD_MAPWEBHOOK_URL, sFinal);
delete hJSONFinal;
}
public Action Hook_UserMessage(UserMsg msg_id, Handle bf, const players[], int playersNum, bool reliable, bool init)
{
char sMessageName[32];
char sMessageSender[64];
int iAuthor = BfReadByte(bf);
bool bIsChat = view_as<bool>(BfReadByte(bf)); if (bIsChat) bIsChat=false; //fucking compiler shut the fuck up REEEEEE
BfReadString(bf, sMessageName, sizeof(sMessageName), false);
BfReadString(bf, sMessageSender, sizeof(sMessageSender), false);
if (iAuthor <= 0 || iAuthor > MaxClients)
return;
if (strlen(sMessageName) == 0 || strlen(sMessageSender) == 0)
return;
if (strcmp(sMessageName, "#Cstrike_Name_Change") == 0)
return;
if (sMessageName[13] == 'C' || sMessageName[13] == 'T' || sMessageName[13] == 'S')
g_bTeamChat = true;
else
g_bTeamChat = false;
}
public void EventHook_PlayerSay(Event hThis, const char[] sName, bool bDontBroadcast)
{
int iUserID = GetEventInt(hThis, "userid");
int iClient = GetClientOfUserId(iUserID);
char sMessageText[192];
GetEventString(hThis, "text", sMessageText, sizeof(sMessageText));
//PrintToServer("[EventHook_PlayerSay] Fired for %N: %s", iClient, sMessageText);
TrimString(sMessageText);
if (strlen(sMessageText) == 0)
return;
char sClientName[64];
GetClientName(iClient, sClientName, sizeof(sClientName));
if (g_bGotReplaceFile)
{
char sPart[192];
char sBuff[192];
int CurrentIndex = 0;
int NextIndex = 0;
while(NextIndex != -1 && CurrentIndex < sizeof(sMessageText))
{
NextIndex = BreakString(sMessageText[CurrentIndex], sPart, sizeof(sPart));
KvGetString(g_hReplaceConfigFile, sPart, sBuff, sizeof(sBuff), NULL_STRING);
if(sBuff[0])
{
ReplaceString(sMessageText[CurrentIndex], sizeof(sMessageText) - CurrentIndex, sPart, sBuff);
CurrentIndex += strlen(sBuff);
}
else
CurrentIndex += NextIndex;
}
}
if (g_bTeamChat)
{
if (sMessageText[0] == '@')
return;
char sMessageFinal[256];
char sTeamName[32];
GetTeamName(GetClientTeam(iClient), sTeamName, sizeof(sTeamName));
if (sTeamName[0] == 'C')
Format(sMessageFinal, sizeof(sMessageFinal), "(Counter-Terrorist) %s", sMessageText);
else if (sTeamName[0] == 'T')
Format(sMessageFinal, sizeof(sMessageFinal), "(Terrorist) %s", sMessageText);
else
Format(sMessageFinal, sizeof(sMessageFinal), "(Spectator) %s", sMessageText);
if (g_sAvatarURL[iClient][0] != '\0')
Discord_POST(DISCORD_LIVEWEBHOOK_URL, sMessageFinal, true, sClientName, true, g_sAvatarURL[iClient]);
else
Discord_POST(DISCORD_LIVEWEBHOOK_URL, sMessageFinal, true, sClientName);
return;
}
if (g_sAvatarURL[iClient][0] != '\0')
Discord_POST(DISCORD_LIVEWEBHOOK_URL, sMessageText, true, sClientName, true, g_sAvatarURL[iClient]);
else
Discord_POST(DISCORD_LIVEWEBHOOK_URL, sMessageText, true, sClientName);
}
stock bool Steam32IDtoSteam64ID(const char[] sSteam32ID, char[] sSteam64ID, int Size)
{
if (strlen(sSteam32ID) < 11 || strncmp(sSteam32ID[0], "STEAM_0:", 8) || strcmp(sSteam32ID, "STEAM_ID_PENDING") == 0)
{
sSteam64ID[0] = 0;
return false;
}
int iUpper = 765611979;
int isSteam64ID = StringToInt(sSteam32ID[10]) * 2 + 60265728 + sSteam32ID[8] - 48;
int iDiv = isSteam64ID / 100000000;
int iIdx = 9 - (iDiv ? (iDiv / 10 + 1) : 0);
iUpper += iDiv;
IntToString(isSteam64ID, sSteam64ID[iIdx], Size - iIdx);
iIdx = sSteam64ID[9];
IntToString(iUpper, sSteam64ID, Size);
sSteam64ID[9] = iIdx;
return true;
}
stock void Discord_MakeStringSafe(const char[] sOrigin, char[] sOut, int iOutSize)
{
int iDataLen = strlen(sOrigin);
int iCurIndex;
for (int i = 0; i < iDataLen && iCurIndex < iOutSize; i++)
{
if (sOrigin[i] < 0x20 && sOrigin[i] != 0x0)
{
//sOut[iCurIndex] = 0x20;
//iCurIndex++;
continue;
}
switch (sOrigin[i])
{
// case '"':
// {
// strcopy(sOut[iCurIndex], iOutSize, "\\u0022");
// iCurIndex += 6;
// continue;
// }
// case '\\':
// {
// strcopy(sOut[iCurIndex], iOutSize, "\\u005C");
// iCurIndex += 6;
// continue;
// }
case '@':
{
strcopy(sOut[iCurIndex], iOutSize, "@"); //@ + zero-width space
iCurIndex += 4;
continue;
}
case '`':
{
strcopy(sOut[iCurIndex], iOutSize, "\\`");
iCurIndex += 2;
continue;
}
case '_':
{
strcopy(sOut[iCurIndex], iOutSize, "\\_");
iCurIndex += 2;
continue;
}
case '~':
{
strcopy(sOut[iCurIndex], iOutSize, "\\~");
iCurIndex += 2;
continue;
}
default:
{
sOut[iCurIndex] = sOrigin[i];
iCurIndex++;
}
}
}
}
stock int OnTransferComplete(Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode, int client)
{
if (bFailure || !bRequestSuccessful || eStatusCode != k_EHTTPStatusCode200OK)
{
if (eStatusCode != k_EHTTPStatusCode429TooManyRequests)
LogError("SteamAPI HTTP Response failed: %d", eStatusCode);
delete hRequest;
return;
}
int iBodyLength;
SteamWorks_GetHTTPResponseBodySize(hRequest, iBodyLength);
char[] sData = new char[iBodyLength];
SteamWorks_GetHTTPResponseBodyData(hRequest, sData, iBodyLength);
delete hRequest;
APIWebResponse(sData, client);
}
stock void APIWebResponse(const char[] sData, int client)
{
KeyValues kvResponse = new KeyValues("SteamAPIResponse");
if (!kvResponse.ImportFromString(sData, "SteamAPIResponse"))
{
LogError("kvResponse.ImportFromString(\"SteamAPIResponse\") in APIWebResponse failed.");
delete kvResponse;
return;
}
if (!kvResponse.JumpToKey("players"))
{
LogError("kvResponse.JumpToKey(\"players\") in APIWebResponse failed.");
delete kvResponse;
return;
}
if (!kvResponse.GotoFirstSubKey())
{
LogError("kvResponse.GotoFirstSubKey() in APIWebResponse failed.");
delete kvResponse;
return;
}
kvResponse.GetString("avatarfull", g_sAvatarURL[client], sizeof(g_sAvatarURL[]));
delete kvResponse;
}
stock void HTTPPostJSON(const char[] sURL, const char[] sText)
{
// if (g_iRatelimitRemaining > 0 && !g_bProcessingData && GetTime() < g_iRatelimitReset)
// {
Handle hRequest = SteamWorks_CreateHTTPRequest(k_EHTTPMethodPOST, sURL);
JSONObject RequestJSON = view_as<JSONObject>(json_load(sText));
if (!hRequest ||
!SteamWorks_SetHTTPRequestContextValue(hRequest, RequestJSON) ||
!SteamWorks_SetHTTPCallbacks(hRequest, OnHTTPRequestCompleted) ||
!SteamWorks_SetHTTPRequestRawPostBody(hRequest, "application/json", sText, strlen(sText)) ||
!SteamWorks_SetHTTPRequestNetworkActivityTimeout(hRequest, 15) ||
!SteamWorks_SendHTTPRequest(hRequest))
{
LogError("Discord SteamWorks_CreateHTTPRequest failed.");
delete RequestJSON;
delete hRequest;
return;
}
// }
// else
// {
// g_arrQueuedMessages.PushString(sText);
// g_arrQueuedMessages.PushString(sURL);
// g_bProcessingData = true;
// }
//delete hRequest;
}
stock void Discord_POST(const char[] sURL, char[] sText, bool bUsingUsername=false, char[] sUsername=NULL_STRING, bool bUsingAvatar=false, char[] sAvatarURL=NULL_STRING, bool bSafe=true, bool bTimestamp=true)
{
//PrintToServer("[Discord_POST] Called with text: %s", sText);
if (bTimestamp)
{
int iTime = GetTime();
char sTime[32];
FormatTime(sTime, sizeof(sTime), "%r", iTime);
Format(sText, 2048, "[%s] %s", sTime, sText);
}
JSONRootNode hJSONRoot = new JSONObject();
char sSafeText[4096];
char sFinal[4096];
if (bUsingUsername)
{
TrimString(sUsername);
if (g_Regex_Clyde.Match(sUsername) > 0 || strlen(sUsername) < 2)
(view_as<JSONObject>(hJSONRoot)).SetString("username", "Invalid Name");
else
(view_as<JSONObject>(hJSONRoot)).SetString("username", sUsername);
}
if (bUsingAvatar)
(view_as<JSONObject>(hJSONRoot)).SetString("avatar_url", sAvatarURL);
if (bSafe)
{
Discord_MakeStringSafe(sText, sSafeText, sizeof(sSafeText));
}
else
{
Format(sSafeText, sizeof(sSafeText), "%s", sText);
}
(view_as<JSONObject>(hJSONRoot)).SetString("content", sSafeText);
(view_as<JSONObject>(hJSONRoot)).ToString(sFinal, sizeof(sFinal), 0);
//hJSONRoot.DumpToServer();
delete hJSONRoot;
if ((g_iRatelimitRemaining > 0 || GetTime() >= g_iRatelimitReset) && !g_bProcessingData)
{
//PrintToServer("[Discord_POST] Have allowances and not processing data");
Handle hRequest = SteamWorks_CreateHTTPRequest(k_EHTTPMethodPOST, sURL);
JSONObject RequestJSON = view_as<JSONObject>(json_load(sFinal));
if (!hRequest ||
!SteamWorks_SetHTTPRequestContextValue(hRequest, RequestJSON) ||
!SteamWorks_SetHTTPCallbacks(hRequest, OnHTTPRequestCompleted) ||
!SteamWorks_SetHTTPRequestRawPostBody(hRequest, "application/json", sFinal, strlen(sFinal)) ||
!SteamWorks_SetHTTPRequestNetworkActivityTimeout(hRequest, 10) ||
!SteamWorks_SendHTTPRequest(hRequest))
{
LogError("Discord SteamWorks_CreateHTTPRequest failed.");
delete RequestJSON;
delete hRequest;
return;
}
}
else
{
//PrintToServer("[Discord_POST] Have allowances? [%s] | Is processing data? [%s]", g_iRatelimitRemaining > 0 ? "YES":"NO", g_bProcessingData?"YES":"NO");
g_arrQueuedMessages.PushString(sFinal);
g_arrQueuedMessages.PushString(sURL);
g_bProcessingData = true;
}
//delete hRequest; //nonono
}
public int OnHTTPRequestCompleted(Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode, JSONObject RequestJSON)
{
if (bFailure || !bRequestSuccessful || (eStatusCode != k_EHTTPStatusCode200OK && eStatusCode != k_EHTTPStatusCode204NoContent))
{
LogError("Discord HTTP request failed: %d", eStatusCode);
if (eStatusCode == k_EHTTPStatusCode400BadRequest)
{
char sData[2048];
(view_as<JSONRootNode>(RequestJSON)).ToString(sData, sizeof(sData), 0);
LogError("Malformed request? Dumping request data:\n%s", sData);
}
else if (eStatusCode == k_EHTTPStatusCode429TooManyRequests)
{
g_iRatelimitRemaining = 0;
g_iRatelimitReset = GetTime() + 5;
}
delete RequestJSON;
delete hRequest;
return;
}
static int iLastRatelimitRemaining = 0;
static int iLastRatelimitReset = 0;
char sTmp[32];
bool bHeaderExists = SteamWorks_GetHTTPResponseHeaderValue(hRequest, "x-ratelimit-remaining", sTmp, sizeof(sTmp));
if (!bHeaderExists)
LogError("x-ratelimit-remaining header value could not be retrieved");
int iRatelimitRemaining = StringToInt(sTmp);
bHeaderExists = SteamWorks_GetHTTPResponseHeaderValue(hRequest, "x-ratelimit-reset", sTmp, sizeof(sTmp));
if (!bHeaderExists)
LogError("x-ratelimit-reset header value could not be retrieved");
int iRatelimitReset = StringToInt(sTmp);
if (iRatelimitRemaining < iLastRatelimitRemaining || iRatelimitReset >= iLastRatelimitReset) //don't be fooled by different completion times
{
g_iRatelimitRemaining = iRatelimitRemaining;
g_iRatelimitReset = iRatelimitReset;
}
//PrintToServer("limit: %d | remaining: %d || reset %d - now %d", g_iRatelimitLimit, g_iRatelimitRemaining, g_iRatelimitReset, GetTime());
delete RequestJSON;
delete hRequest;
}
stock bool IsValidClient(int client)
{
return (client > 0 && client <= MaxClients && IsClientInGame(client));
}
public Action CommandListener_SmChat(int client, const char[] sCommand, int argc)
{
if (client <= 0)
return Plugin_Continue;
char sText[256];
char sUsername[32];
GetCmdArgString(sText, sizeof(sText));
GetClientName(client, sUsername, sizeof(sUsername));
if (g_sAvatarURL[client][0] != '\0')
Discord_POST(DISCORD_ADMINCHAT_WEBHOOKURL, sText, true, sUsername, true, g_sAvatarURL[client]);
else
Discord_POST(DISCORD_ADMINCHAT_WEBHOOKURL, sText, true, sUsername);
return Plugin_Continue;
}
public Action OnClientSayCommand(int client, const char[] sCommand, const char[] sArgs)
{
if (client <= 0 || !IsClientInGame(client) || BaseComm_IsClientGagged(client))
return Plugin_Continue;
char sFinal[256];
char sUsername[MAX_NAME_LENGTH];
GetClientName(client, sUsername, sizeof(sUsername));
if (strcmp(sCommand, "say_team") == 0)
{
if (sArgs[0] == '@')
{
bool bAdmin = CheckCommandAccess(client, "", ADMFLAG_GENERIC, true);
Format(sFinal, sizeof(sFinal), "%s%s", bAdmin ? "" : "To Admins: ", sArgs[1]);
if (g_sAvatarURL[client][0] != '\0')
Discord_POST(DISCORD_ADMINCHAT_WEBHOOKURL, sFinal, true, sUsername, true, g_sAvatarURL[client]);
else
Discord_POST(DISCORD_ADMINCHAT_WEBHOOKURL, sFinal, true, sUsername);
if (!bAdmin)
{
//g_iReplyTargetSerial = GetClientSerial(client);
//g_iReplyType = REPLYTYPE_CHAT;
}
return Plugin_Continue;
}
char sTeamName[32];
GetTeamName(GetClientTeam(client), sTeamName, sizeof(sTeamName));
Format(sFinal, sizeof(sFinal), "(%s) ", sTeamName);
}
return Plugin_Continue;
}
public Action OnLogAction(Handle hSource, Identity ident, int client, int target, const char[] sMsg)
{
if (client <= 0)
return;
if ((StrContains(sMsg, "sm_psay", false)!= -1) || (StrContains(sMsg, "sm_chat", false)!= -1))
return;// dont log sm_psay and sm_chat
char sFinal[256];
char sCurrentMap[32];
char sClientName[64];
GetCurrentMap(sCurrentMap, sizeof(sCurrentMap));
Format(sFinal, sizeof(sFinal), "[ %s ]```%s```", sCurrentMap, sMsg);
GetClientName(client, sClientName, sizeof(sClientName));
if (g_sAvatarURL[client][0] != '\0')
Discord_POST(DISCORD_ADMINLOGS_WEBHOOKURL, sFinal, true, sClientName, true, g_sAvatarURL[client], false);
else
Discord_POST(DISCORD_ADMINLOGS_WEBHOOKURL, sFinal, true, sClientName, false, "", false);
return;
}
public void AntiBhopCheat_OnClientDetected(int client, char[] sReason, char[] sStats)
{
char sUsername[MAX_NAME_LENGTH];
GetClientName(client, sUsername, sizeof(sUsername));
char currentMap[64];
GetCurrentMap(currentMap, sizeof(currentMap));
char sMessage[4096];
Format(sMessage, sizeof(sMessage), "```%s - Tick: %d``````%s\n%s```", currentMap, GetGameTickCount(), sReason, sStats);
if (g_sAvatarURL[client][0] != '\0')
Discord_POST(DISCORD_ANTIBHOPCHEAT_WEBHOOKURL, sMessage, true, sUsername, true, g_sAvatarURL[client], false);
else
Discord_POST(DISCORD_ANTIBHOPCHEAT_WEBHOOKURL, sMessage, true, sUsername, false, "", false);
}
public int entWatch_OnClientBanned(int admin, int iLenght, int client)
{
char sUsername[MAX_NAME_LENGTH];
GetClientName(client, sUsername, sizeof(sUsername));
char currentMap[64];
GetCurrentMap(currentMap, sizeof(currentMap));
char sMessageTmp[4096];
if (iLenght == 0)
{
Format(sMessageTmp, sizeof(sMessageTmp), "%L got temporarily restricted by %L", client, admin);
}
else if (iLenght == -1)
{
Format(sMessageTmp, sizeof(sMessageTmp), "%L got PERMANENTLY restricted by %L", client, admin);
}
else
{
Format(sMessageTmp, sizeof(sMessageTmp), "%L got restricted by %L for %d minutes", client, admin, iLenght);
}
char sMessage[4096];
Format(sMessage, sizeof(sMessage), "```%s - Tick: %d``````%s```", currentMap, GetGameTickCount(), sMessageTmp);
if (g_sAvatarURL[client][0] != '\0')
Discord_POST(DISCORD_ENTWATCH_WEBHOOKURL, sMessage, true, sUsername, true, g_sAvatarURL[client], false);
else
Discord_POST(DISCORD_ENTWATCH_WEBHOOKURL, sMessage, true, sUsername, false, "", false);
}
public int entWatch_OnClientUnbanned(int admin, int client)
{
char sUsername[MAX_NAME_LENGTH];
GetClientName(client, sUsername, sizeof(sUsername));
char currentMap[64];
GetCurrentMap(currentMap, sizeof(currentMap));
char sMessageTmp[4096];
Format(sMessageTmp, sizeof(sMessageTmp), "%L got unrestricted by %L", client, admin);
char sMessage[4096];
Format(sMessage, sizeof(sMessage), "```%s - Tick: %d``````%s```", currentMap, GetGameTickCount(), sMessageTmp);
if (g_sAvatarURL[client][0] != '\0')
Discord_POST(DISCORD_ENTWATCH_WEBHOOKURL, sMessage, true, sUsername, true, g_sAvatarURL[client], false);
else
Discord_POST(DISCORD_ENTWATCH_WEBHOOKURL, sMessage, true, sUsername, false, "", false);
}
public Action Command_Report(int client, int argc)
{
if (BaseComm_IsClientGagged(client))
return Plugin_Handled;
if (argc < 2)
{
ReplyToCommand(client, "[SM] Usage: sm_report <name|#userid> <reason>");
return Plugin_Handled;
}
if (g_fReportCooldown[client] > GetGameTime())
{
ReplyToCommand(client, "[SM] Please wait another %d seconds before sending another report.", RoundToNearest(g_fReportCooldown[client] - GetGameTime()));
return Plugin_Handled;
}
int iTarget;
char sTarget[32];
GetCmdArg(1, sTarget, sizeof(sTarget));
if ((iTarget = FindTarget(client, sTarget, true, false)) <= 0)
return Plugin_Handled;
char sFormatted[4096];
char sReportText[128];
char sClientAuthID32[32];
char sTargetAuthID32[32];
char sCurrentMap[32];
int iClientUID = GetClientUserId(client);
int iTargetUID = GetClientUserId(iTarget);
GetCmdArgString(sReportText, sizeof(sReportText));
Format(sReportText, sizeof(sReportText) - strlen(sTarget) + 1, sReportText[strlen(sTarget) + 1]);
if (sReportText[0] == '"')
StripQuotes(sReportText);
GetClientAuthId(client, AuthId_Steam3, sClientAuthID32, sizeof(sClientAuthID32));
GetClientAuthId(iTarget, AuthId_Steam3, sTargetAuthID32, sizeof(sTargetAuthID32));
GetCurrentMap(sCurrentMap, sizeof(sCurrentMap));
Format(sFormatted, sizeof(sFormatted),
"@here\n```%s - Tick: %d``````Reporter: %N (#%d)\nTarget: %N (#%d)\nReason: %s\n```",
sCurrentMap, GetGameTickCount(), client, iClientUID, iTarget, iTargetUID, sReportText);
char sUsername[MAX_NAME_LENGTH];
GetClientName(client, sUsername, sizeof(sUsername));
if (g_sAvatarURL[client][0] != '\0')
Discord_POST(DISCORD_REPORT_WEBHOOKURL, sFormatted, true, sUsername, true, g_sAvatarURL[client], false);
else
Discord_POST(DISCORD_REPORT_WEBHOOKURL, sFormatted, true, sUsername, false, "", false);
Format(sFormatted, sizeof(sFormatted), "#%d \"%N\" reported #%d \"%N\" for:\n\x04[Reports]\x01 %s", iClientUID, client, iTargetUID, iTarget, sReportText);
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || !IsClientAuthorized(i))
continue;
if (!CheckCommandAccess(i, "", ADMFLAG_GENERIC, true))
continue;
PrintToChat(i, "\x01\x04[Reports]\x01 %s", sFormatted);
}
g_fReportCooldown[client] = GetGameTime() + 30.0;
ReplyToCommand(client, "\x01\x04[Reports]\x01 Your report was successfully submitted!");
return Plugin_Handled;
}

View File

@ -1,231 +0,0 @@
#pragma semicolon 1
#include <sourcemod>
#include <basecomm>
#include <connect>
#include <regex>
#pragma newdecls required
/* CONVARS */
ConVar g_hCvar_BlockAdmin;
ConVar g_hCvar_BlockVoice;
ConVar g_hCvar_BlockSpoof;
/* REGEX */
Regex g_hReg_ValidateSteamID;
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Plugin myinfo =
{
name = "NoSteamManager",
author = "zaCade",
description = "Manage No-Steam clients, denying admin access, ect.",
version = "1.0.0"
};
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnPluginStart()
{
g_hReg_ValidateSteamID = CompileRegex("[^STEAM_[01]:[01]:\\d{1,10}]");
g_hCvar_BlockAdmin = CreateConVar("sm_nosteam_block_admin", "1", "Should people marked as nosteam be blocked from admin?", FCVAR_NONE, true, 0.0, true, 1.0);
g_hCvar_BlockVoice = CreateConVar("sm_nosteam_block_voice", "1", "Should people marked as nosteam be blocked from voice?", FCVAR_NONE, true, 0.0, true, 1.0);
g_hCvar_BlockSpoof = CreateConVar("sm_nosteam_block_spoof", "1", "Block nosteam people being able to spoof steamids.", FCVAR_NONE, true, 0.0, true, 1.0);
AddMultiTargetFilter("@steam", Filter_Steam, "Steam Players", false);
AddMultiTargetFilter("@nosteam", Filter_NoSteam, "No-Steam Players", false);
RegConsoleCmd("sm_nosteam", Command_DisplaySteamStats, "Shows the number of Steam and No-Steam players");
RegConsoleCmd("sm_steam", Command_DisplaySteamStats, "Shows the number of Steam and No-Steam players");
AutoExecConfig();
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnPluginEnd()
{
RemoveMultiTargetFilter("@steam", Filter_Steam);
RemoveMultiTargetFilter("@nosteam", Filter_NoSteam);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action Command_DisplaySteamStats(int client, int args)
{
char aBuf[1024];
char aBuf2[MAX_NAME_LENGTH];
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i))
{
char sSteamID[32];
GetClientAuthId(i, AuthId_Steam2, sSteamID, sizeof(sSteamID));
if(!SteamClientAuthenticated(sSteamID))
{
GetClientName(i, aBuf2, sizeof(aBuf2));
StrCat(aBuf, sizeof(aBuf), aBuf2);
StrCat(aBuf, sizeof(aBuf), ", ");
}
}
}
if(strlen(aBuf))
{
aBuf[strlen(aBuf) - 2] = 0;
ReplyToCommand(client, "[SM] No-Steam clients online: %s", aBuf);
}
else
ReplyToCommand(client, "[SM] No-Steam clients online: none");
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public bool Filter_Steam(const char[] sPattern, Handle hClients)
{
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i))
{
char sSteamID[32];
GetClientAuthId(i, AuthId_Steam2, sSteamID, sizeof(sSteamID));
if(SteamClientAuthenticated(sSteamID))
PushArrayCell(hClients, i);
}
}
return true;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public bool Filter_NoSteam(const char[] sPattern, Handle hClients)
{
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i))
{
char sSteamID[32];
GetClientAuthId(i, AuthId_Steam2, sSteamID, sizeof(sSteamID));
if(!SteamClientAuthenticated(sSteamID))
PushArrayCell(hClients, i);
}
}
return true;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action OnClientPreAdminCheck(int client)
{
if(!g_hCvar_BlockAdmin.BoolValue)
return Plugin_Continue;
if(IsFakeClient(client) || IsClientSourceTV(client))
return Plugin_Continue;
char sSteamID[32];
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
if(!SteamClientAuthenticated(sSteamID))
{
LogMessage("%L was not authenticated with steam, denying admin.", client);
NotifyPostAdminCheck(client);
return Plugin_Handled;
}
return Plugin_Continue;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientPostAdminCheck(int client)
{
if(!g_hCvar_BlockVoice.BoolValue)
return;
if(IsFakeClient(client) || IsClientSourceTV(client))
return;
char sSteamID[32];
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
if(!SteamClientAuthenticated(sSteamID))
{
LogMessage("%L was not authenticated with steam, muting client.", client);
BaseComm_SetClientMute(client, true);
return;
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientPutInServer(int client)
{
if(!g_hCvar_BlockSpoof.BoolValue)
return;
if(IsFakeClient(client) || IsClientSourceTV(client))
return;
char sSteamID[32];
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
if(MatchRegex(g_hReg_ValidateSteamID, sSteamID) <= 0)
return;
for(int player = 1; player <= MaxClients; player++)
{
if(client == player || !IsClientConnected(player))
continue;
if(IsFakeClient(player) || IsClientSourceTV(player))
continue;
char sPlayerSteamID[32];
GetClientAuthId(player, AuthId_Steam2, sPlayerSteamID, sizeof(sPlayerSteamID));
if(MatchRegex(g_hReg_ValidateSteamID, sPlayerSteamID) <= 0)
continue;
if(StrEqual(sSteamID, sPlayerSteamID, false))
{
if(!SteamClientAuthenticated(sSteamID))
{
LogMessage("%L was not authenticated with steam, steamid already connected. Kicking connector.", client);
KickClient(client, "Please come back later.");
return;
}
if(!SteamClientAuthenticated(sPlayerSteamID))
{
LogMessage("%L was not authenticated with steam, steamid already connected. Kicking connected.", player);
KickClient(player, "Please come back later.");
return;
}
break;
}
}
}

View File

@ -1,61 +0,0 @@
#include <sourcemod>
#pragma semicolon 1
public Plugin:myinfo =
{
name = "Players count in hostname",
author = "D1maxa",
description = "Showing number of players in name of server",
version = "1.11",
url = "http://forums.alliedmods.net/showthread.php?t=126060"
};
new g_NumClients=0;
new Handle:hostname = INVALID_HANDLE;
new Handle:sv_visiblemaxplayers = INVALID_HANDLE;
new Handle:formatted_hostname = INVALID_HANDLE;
public OnPluginStart()
{
hostname = FindConVar("hostname");
sv_visiblemaxplayers = FindConVar("sv_visiblemaxplayers");
formatted_hostname=CreateConVar("sm_formatted_hostname", "My Server %d/%d", "Formatted string for dynamic hostname",FCVAR_PLUGIN);
}
public OnMapStart()
{
g_NumClients=0;
}
public OnConfigsExecuted()
{
SetNumberOfPlayersInHostname();
}
public OnClientConnected(client)
{
if(!IsFakeClient(client))
{
g_NumClients++;
SetNumberOfPlayersInHostname();
}
}
public OnClientDisconnect(client)
{
if(!IsFakeClient(client))
{
g_NumClients--;
SetNumberOfPlayersInHostname();
}
}
SetNumberOfPlayersInHostname()
{
decl String:my_buf[64];
decl String:f_hostname[64];
GetConVarString(formatted_hostname,f_hostname,sizeof(f_hostname));
Format(my_buf,sizeof(my_buf),f_hostname,g_NumClients,GetConVarInt(sv_visiblemaxplayers));
SetConVarString(hostname,my_buf);
ServerCommand("heartbeat");
}

View File

@ -1,165 +0,0 @@
#pragma semicolon 1
#include <sourcemod>
#pragma newdecls required
bool g_bProtoBuf;
bool g_bBlocked[MAXPLAYERS + 1];
int g_iMessageClient = -1;
public Plugin myinfo =
{
name = "RadioMute",
description = "Very simple plugin to block players from using the in-game radio in supported games.",
author = "Obus",
version = "1.0.1",
url = ""
}
public void OnPluginStart()
{
LoadTranslations("common.phrases");
if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf)
g_bProtoBuf = true;
UserMsg RadioText = GetUserMessageId("RadioText");
if (RadioText == INVALID_MESSAGE_ID)
SetFailState("This game does not support the \"RadioText\" UserMessage.");
UserMsg SendAudio = GetUserMessageId("SendAudio");
if (SendAudio == INVALID_MESSAGE_ID)
SetFailState("This game does not support the \"SendAudio\" UserMessage.");
RegAdminCmd("sm_radiomute", Command_RadioMute, ADMFLAG_BAN, "Block a client from using the in-game radio.");
RegAdminCmd("sm_radiounmute", Command_RadioUnmute, ADMFLAG_BAN, "Unblock a client from using the in-game radio.");
HookUserMessage(RadioText, _hkRadioText, true);
HookUserMessage(SendAudio, _hkSendAudio, true);
}
public void OnClientDisconnect(int client)
{
g_bBlocked[client] = false;
}
public Action Command_RadioMute(int client, int argc)
{
if (argc < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_radiomute <target>");
return Plugin_Handled;
}
char sArgs[64];
char sTargetName[MAX_TARGET_LENGTH];
int iTargets[MAXPLAYERS];
int iTargetCount;
bool bIsML;
GetCmdArg(1, sArgs, sizeof(sArgs));
if ((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, COMMAND_FILTER_CONNECTED, sTargetName, sizeof(sTargetName), bIsML)) <= 0)
{
ReplyToTargetError(client, iTargetCount);
return Plugin_Handled;
}
for (int i = 0; i < iTargetCount; i++)
{
g_bBlocked[iTargets[i]] = true;
}
ShowActivity2(client, "\x01[SM] \x04", "\x01Radio muted \x04%s\x01", sTargetName);
LogAction(client, -1, "\"%L\" radio muted \"%s\"", client, sTargetName);
return Plugin_Handled;
}
public Action Command_RadioUnmute(int client, int argc)
{
if (argc < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_radiounmute <target>");
return Plugin_Handled;
}
char sArgs[64];
char sTargetName[MAX_TARGET_LENGTH];
int iTargets[MAXPLAYERS];
int iTargetCount;
bool bIsML;
GetCmdArg(1, sArgs, sizeof(sArgs));
if ((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, COMMAND_FILTER_CONNECTED, sTargetName, sizeof(sTargetName), bIsML)) <= 0)
{
ReplyToTargetError(client, iTargetCount);
return Plugin_Handled;
}
for (int i = 0; i < iTargetCount; i++)
{
g_bBlocked[iTargets[i]] = false;
}
ShowActivity2(client, "\x01[SM] \x04", "\x01Radio unmuted \x04%s\x01", sTargetName);
LogAction(client, -1, "\"%L\" radio unmuted \"%s\"", client, sTargetName);
return Plugin_Handled;
}
public Action _hkRadioText(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init)
{
if (g_bProtoBuf)
{
g_iMessageClient = PbReadInt(bf, "client");
}
else
{
BfReadByte(bf);
g_iMessageClient = BfReadByte(bf);
}
if (g_bBlocked[g_iMessageClient])
{
return Plugin_Handled;
}
return Plugin_Continue;
}
public Action _hkSendAudio(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init)
{
if (g_iMessageClient == -1)
return Plugin_Continue;
char sSound[128];
if(g_bProtoBuf)
PbReadString(bf, "radio_sound", sSound, sizeof(sSound));
else
BfReadString(bf, sSound, sizeof(sSound), false);
if (strncmp(sSound[6], "lock", 4, false) == 0)
return Plugin_Continue;
if (g_bBlocked[g_iMessageClient])
{
g_iMessageClient = -1;
return Plugin_Handled;
}
g_iMessageClient = -1;
return Plugin_Continue;
}

View File

@ -1,127 +0,0 @@
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <multicolors>
#define PLUGIN_VERSION "2.0"
#pragma newdecls required
bool g_bProtoBuf;
bool g_bBlocked[MAXPLAYERS + 1];
bool g_bIsEnabled[MAXPLAYERS + 1];
int g_iMessageClient = -1;
public Plugin myinfo =
{
name = "Toggle radio mute command",
author = "Nano",
description = "You can enable or disable the radio voice/text messages using a command",
version = PLUGIN_VERSION,
url = "http://steamcommunity.com/id/marianzet1"
};
public void OnPluginStart()
{
LoadTranslations("common.phrases");
if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf)
g_bProtoBuf = true;
UserMsg RadioText = GetUserMessageId("RadioText");
if (RadioText == INVALID_MESSAGE_ID)
SetFailState("This game does not support the \"RadioText\" UserMessage.");
UserMsg SendAudio = GetUserMessageId("SendAudio");
if (SendAudio == INVALID_MESSAGE_ID)
SetFailState("This game does not support the \"SendAudio\" UserMessage.");
RegConsoleCmd("sm_radio", Command_RadioMute);
RegConsoleCmd("sm_smradio", Command_RadioMute);
//RegConsoleCmd("sm_mr", Command_RadioMute);
HookUserMessage(RadioText, _hkRadioText, true);
HookUserMessage(SendAudio, _hkSendAudio, true);
}
public void OnClientPostAdminCheck(int client)
{
g_bIsEnabled[client] = false;
}
public void OnClientDisconnect(int client)
{
g_bIsEnabled[client] = false;
g_bBlocked[client] = false;
}
public Action Command_RadioMute(int client, int args)
{
if(!g_bIsEnabled[client])
{
g_bIsEnabled[client] = true;
g_bBlocked[client] = true;
CPrintToChat(client, "{green}[{lightgreen}Mute-Radio{green}]{default} You have {purple}disabled the radio messages.");
return Plugin_Handled;
}
else
{
g_bIsEnabled[client] = false;
g_bBlocked[client] = false;
CPrintToChat(client, "{green}[{lightgreen}Mute-Radio{green}]{default} You have {purple}enabled the radio messages.");
return Plugin_Handled;
}
}
public Action _hkRadioText(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init)
{
if (g_bProtoBuf)
{
g_iMessageClient = PbReadInt(bf, "client");
}
else
{
BfReadByte(bf);
g_iMessageClient = BfReadByte(bf);
}
if (g_bBlocked[g_iMessageClient])
{
return Plugin_Handled;
}
return Plugin_Continue;
}
public Action _hkSendAudio(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init)
{
if (g_iMessageClient == -1)
return Plugin_Continue;
char sSound[128];
if(g_bProtoBuf)
PbReadString(bf, "radio_sound", sSound, sizeof(sSound));
else
BfReadString(bf, sSound, sizeof(sSound), false);
if (strncmp(sSound[6], "lock", 4, false) == 0)
return Plugin_Continue;
if (g_bBlocked[g_iMessageClient])
{
g_iMessageClient = -1;
return Plugin_Handled;
}
g_iMessageClient = -1;
return Plugin_Continue;
}

View File

@ -1,308 +0,0 @@
#include <clientprefs>
#include <multicolors>
#include <sourcemod>
#include <sdktools>
#include <zombiereloaded>
/* BOOLS */
bool g_bHideProp[MAXPLAYERS+1];
bool g_bProtection[MAXPLAYERS+1];
/* COOKIES */
Handle g_hCookie_HideProp;
Handle g_hCookie_Protection;
/* CONVARS */
ConVar g_hCVar_Protection;
ConVar g_hCVar_ProtectionMinimal;
/* INTERGERS */
int g_iPropEntity = -1;
int g_iRotatingEntity = -1;
/* STRINGS */
char g_sSTEAM_ID_Winner[64];
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Plugin myinfo =
{
name = "Ranking",
author = "Neon",
description = "",
version = "1.0.0",
url = "https://steamcommunity.com/id/n3ontm"
};
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnPluginStart()
{
g_hCookie_HideProp = RegClientCookie("ranking_hideprop", "", CookieAccess_Private);
g_hCookie_Protection = RegClientCookie("ranking_protection", "", CookieAccess_Private);
g_hCVar_Protection = CreateConVar("sm_ranking_protection_enabled", "1", "", FCVAR_NONE, true, 0.0, true, 1.0);
g_hCVar_ProtectionMinimal = CreateConVar("sm_ranking_protection_minimal", "15", "", FCVAR_NONE, true, 1.0, true, 64.0);
RegConsoleCmd("sm_toggleprop", OnToggleProp);
RegConsoleCmd("sm_top1", OnToggleImmunity);
HookEvent("player_spawn", OnClientSpawn);
HookEvent("player_death", OnClientDeath);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action OnToggleProp(int client, int args)
{
g_bHideProp[client] = !g_bHideProp[client];
SetClientCookie(client, g_hCookie_HideProp, g_bHideProp[client] ? "1" : "");
CPrintToChat(client, "{cyan}[Ranking] {white}%s", g_bHideProp[client] ? "Prop Disabled" : "Prop Enabled");
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action OnToggleImmunity(int client, int args)
{
g_bProtection[client] = !g_bProtection[client];
SetClientCookie(client, g_hCookie_Protection, g_bProtection[client] ? "1" : "");
CPrintToChat(client, "{cyan}[Ranking] {white}%s", g_bProtection[client] ? "Immunity Disabled" : "Immunity Enabled");
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnMapStart()
{
AddFileToDownloadsTable("sound/unloze/holy.wav");
AddFileToDownloadsTable("models/unloze/crown_v2.mdl");
AddFileToDownloadsTable("models/unloze/crown_v2.phy");
AddFileToDownloadsTable("models/unloze/crown_v2.vvd");
AddFileToDownloadsTable("models/unloze/crown_v2.sw.vtx");
AddFileToDownloadsTable("models/unloze/crown_v2.dx80.vtx");
AddFileToDownloadsTable("models/unloze/crown_v2.dx90.vtx");
AddFileToDownloadsTable("materials/models/unloze/crown/crown.vmt");
AddFileToDownloadsTable("materials/models/unloze/crown/crown.vtf");
AddFileToDownloadsTable("materials/models/unloze/crown/crown_bump.vtf");
AddFileToDownloadsTable("materials/models/unloze/crown/crown_detail.vtf");
AddFileToDownloadsTable("materials/models/unloze/crown/crown_lightwarp.vtf");
PrecacheModel("models/unloze/crown_v2.mdl");
AddFileToDownloadsTable("sound/unloze/holy.wav");
PrecacheSound("unloze/holy.wav");
GetSteamID();
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void GetSteamID()
{
char sFile[PLATFORM_MAX_PATH];
char sLine[192];
BuildPath(Path_SM, sFile, sizeof(sFile), "configs/ranking/winner.cfg");
Handle hFile = OpenFile(sFile, "r");
if(hFile != INVALID_HANDLE)
{
while (!IsEndOfFile(hFile))
{
if (!ReadFileLine(hFile, sLine, sizeof(sLine)))
break;
TrimString(sLine);
if(strlen(sLine) > 0 && (StrContains(sLine, "STEAM") != -1))
{
Format(g_sSTEAM_ID_Winner, sizeof(g_sSTEAM_ID_Winner), "%s", sLine);
//PrintToChatAll("%s", g_sSTEAM_ID_Winner);
break;
}
}
CloseHandle(hFile);
}
else
{
LogError("[SM] File not found! (configs/ranking/winner.cfg)");
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientCookiesCached(int client)
{
char sBuffer[4];
GetClientCookie(client, g_hCookie_HideProp, sBuffer, sizeof(sBuffer));
if (sBuffer[0])
g_bHideProp[client] = true;
else
g_bHideProp[client] = false;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientDisconnect(int client)
{
g_bHideProp[client] = false;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientSpawn(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
int client = GetClientOfUserId(hEvent.GetInt("userid"));
char sSID[64];
GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID));
if (StrEqual(sSID, g_sSTEAM_ID_Winner) && !g_bHideProp[client])
{
CreateTimer(1.0, OnClientSpawnPost, client, TIMER_FLAG_NO_MAPCHANGE);
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action OnClientSpawnPost(Handle timer, int client)
{
if (!IsClientInGame(client) || IsFakeClient(client) || !IsPlayerAlive(client))
return;
if ((g_iPropEntity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
return;
SetEntityModel(g_iPropEntity, "models/unloze/crown_v2.mdl");
DispatchKeyValue(g_iPropEntity, "solid", "0");
DispatchKeyValue(g_iPropEntity, "modelscale", "1.5");
DispatchKeyValue(g_iPropEntity, "disableshadows", "1");
DispatchKeyValue(g_iPropEntity, "disablereceiveshadows", "1");
DispatchKeyValue(g_iPropEntity, "disablebonefollowers", "1");
float fVector[3];
float fAngles[3];
GetClientAbsOrigin(client, fVector);
GetClientAbsAngles(client, fAngles);
fVector[2] += 80.0;
fAngles[0] = 8.0;
fAngles[2] = 5.5;
TeleportEntity(g_iPropEntity, fVector, fAngles, NULL_VECTOR);
float fDirection[3];
fDirection[0] = 0.0;
fDirection[1] = 0.0;
fDirection[2] = 1.0;
TE_SetupSparks(fVector, fDirection, 1000, 200);
TE_SendToAll();
SetVariantString("!activator");
AcceptEntityInput(g_iPropEntity, "SetParent", client);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientDeath(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
int client = GetClientOfUserId(hEvent.GetInt("userid"));
char sSID[64];
GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID));
if (StrEqual(sSID, g_sSTEAM_ID_Winner) && !IsPlayerAlive(client))
{
if (g_iPropEntity != INVALID_ENT_REFERENCE && AcceptEntityInput(g_iPropEntity, "Kill"))
{
g_iPropEntity = INVALID_ENT_REFERENCE;
}
if (g_iRotatingEntity != INVALID_ENT_REFERENCE && AcceptEntityInput(g_iRotatingEntity, "Kill"))
{
g_iRotatingEntity = INVALID_ENT_REFERENCE;
}
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action ZR_OnClientInfect(&client, &attacker, &bool:motherInfect, &bool:respawnOverride, &bool:respawn)
{
if (g_hCVar_Protection.BoolValue && motherInfect && !g_bProtection[client])
{
char sSID[64];
GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID));
if ((GetClientCount() >= g_hCVar_ProtectionMinimal.IntValue) && StrEqual(sSID, g_sSTEAM_ID_Winner))
{
Handle hMessageInfection = StartMessageOne("HudMsg", client);
if (hMessageInfection)
{
if (GetUserMessageType() == UM_Protobuf)
{
PbSetInt(hMessageInfection, "channel", 50);
PbSetInt(hMessageInfection, "effect", 0);
PbSetColor(hMessageInfection, "clr1", {255, 255, 255, 255});
PbSetColor(hMessageInfection, "clr2", {255, 255, 255, 255});
PbSetVector2D(hMessageInfection, "pos", Float:{-1.0, 0.3});
PbSetFloat(hMessageInfection, "fade_in_time", 0.1);
PbSetFloat(hMessageInfection, "fade_out_time", 0.1);
PbSetFloat(hMessageInfection, "hold_time", 5.0);
PbSetFloat(hMessageInfection, "fx_time", 0.0);
PbSetString(hMessageInfection, "text", "You have been protected from being Mother Zombie\nsince you were the Rank #1 Player last Month!");
EndMessage();
}
else
{
BfWriteByte(hMessageInfection, 50);
BfWriteFloat(hMessageInfection, -1.0);
BfWriteFloat(hMessageInfection, 0.3);
BfWriteByte(hMessageInfection, 0);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 0);
BfWriteFloat(hMessageInfection, 0.1);
BfWriteFloat(hMessageInfection, 0.1);
BfWriteFloat(hMessageInfection, 5.0);
BfWriteFloat(hMessageInfection, 0.0);
BfWriteString(hMessageInfection, "You have been protected from being Mother Zombie\nsince you were the Rank #1 Player last Month!");
EndMessage();
}
}
CPrintToChat(client, "{cyan}[Ranking] {white}You have been protected from being Mother Zombie since he was the Rank #1 Player last Month!");
EmitSoundToClient(client, "unloze/holy.wav", .volume=1.0);
return Plugin_Handled;
}
}
return Plugin_Continue;
}

View File

@ -1,189 +0,0 @@
#include <sourcemod>
#include <mapchooser>
#include <basecomm>
#include <mapchooser_extended>
#pragma semicolon 1
#pragma newdecls required
char g_configPath[PLATFORM_MAX_PATH];
Menu g_mapMenu;
int g_Player_NominationDelay[MAXPLAYERS + 1];
ConVar g_Cvar_NominateDelay = null;
public Plugin myinfo = {
name = "Top 12 Nomination",
author = "Nicklas Vedsted",
description = "Allows very special people to nominate particular maps.",
version = "1.0.0",
url = "https://gflclan.com/"
};
public void OnPluginStart() {
BuildPath(Path_SM, g_configPath, PLATFORM_MAX_PATH, "configs/specialfriday.cfg");
buildMenu();
RegAdminCmd("sm_top12_nominate", Cmd_Nominate, ADMFLAG_RESERVATION | ADMFLAG_CUSTOM1 | ADMFLAG_CUSTOM3 | ADMFLAG_CUSTOM4 | ADMFLAG_CUSTOM5 | ADMFLAG_CUSTOM6, "Opens Top 12 Nominations.");
}
public void OnAllPluginsLoaded() {
g_Cvar_NominateDelay = FindConVar("sm_nominate_delay");
}
public Action Cmd_Nominate(int client, int args) {
if (!IsNominateAllowed(client)) return Plugin_Handled;
if (g_mapMenu.ItemCount == 0) {
ReplyToCommand(client, "[Top12] There are no maps that can be special nominated.");
return Plugin_Handled;
}
g_mapMenu.Display(client, MENU_TIME_FOREVER);
return Plugin_Handled;
}
public int Handler_MapSelectMenu(Menu menu, MenuAction action, int client, int position) {
switch (action) {
case MenuAction_Select: {
if(g_Player_NominationDelay[client] > GetTime()) {
PrintToChat(client, "[Top12] Please wait %d seconds before you can nominate again", g_Player_NominationDelay[client] - GetTime());
menu.DisplayAt(client, menu.Selection, MENU_TIME_FOREVER);
return 0;
}
char map[PLATFORM_MAX_PATH];
menu.GetItem(position, map, PLATFORM_MAX_PATH);
NominateResult result = NominateMap(map, false, client);
switch(result) {
case Nominate_AlreadyInVote: {
PrintToChat(client, "[Top12] Map is already nominated.");
return 0;
}
case Nominate_VoteFull: {
PrintToChat(client, "[Top12] There is not room for more nominations.");
return 0;
}
case Nominate_InvalidMap: {
PrintToChat(client, "[Top12] %s is not a valid map. Please contact the server manager in order to fix this.", map);
return 0;
}
case Nominate_Added: {
PrintToChatAll("[Top12] %N (special) nominated %s!", client, map);
}
case Nominate_Replaced: {
PrintToChatAll("[Top12] %N changed their nomination to %s.", client, map);
}
}
g_Player_NominationDelay[client] = GetTime() + getNominationDelay();
LogMessage("%N (special) nominated %s", client, map);
}
case MenuAction_DrawItem: {
char map[PLATFORM_MAX_PATH];
menu.GetItem(position, map, PLATFORM_MAX_PATH);
if(GetMapCooldown(map) || GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map, client) >= 0) {
return ITEMDRAW_DISABLED;
}
return ITEMDRAW_DEFAULT;
}
case MenuAction_DisplayItem: {
char map[PLATFORM_MAX_PATH];
menu.GetItem(position, map, sizeof(map));
char display[150];
int Cooldown = GetMapCooldown(map);
if (Cooldown) {
Format(display, sizeof(display), "%s (Recently Played %d)", map, Cooldown);
return RedrawMenuItem(display);
}
int TimeRestriction = GetMapTimeRestriction(map);
if(TimeRestriction) {
Format(display, sizeof(display), "%s (Time+%dH%dM)", map, RoundToFloor(float(TimeRestriction / 60)), TimeRestriction % 60);
return RedrawMenuItem(display);
}
int PlayerRestriction = GetMapPlayerRestriction(map);
if(PlayerRestriction != 0) {
if(PlayerRestriction < 0) {
Format(display, sizeof(display), "%s (Players+%d)", map, PlayerRestriction * -1);
} else {
Format(display, sizeof(display), "%s (Players-%d)", map, PlayerRestriction);
}
return RedrawMenuItem(display);
}
int GroupRestriction = GetMapGroupRestriction(map, client);
if(GroupRestriction >= 0) {
Format(display, sizeof(display), "%s (Group max: %d)", map, GroupRestriction);
return RedrawMenuItem(display);
}
}
}
return 0;
}
stock void buildMenu() {
g_mapMenu = new Menu(Handler_MapSelectMenu, MENU_ACTIONS_DEFAULT | MenuAction_DrawItem | MenuAction_DisplayItem);
g_mapMenu.SetTitle("Special Nominate A Map!");
SetMenuExitButton(g_mapMenu, true);
ArrayList maps = new ArrayList(ByteCountToCells(PLATFORM_MAX_PATH));
if (!FileExists(g_configPath)) {
PrintToServer("[Top12] specialfriday.cfg does not exists. No nominations has been added.");
return;
}
File configFile = OpenFile(g_configPath, "r");
char map[PLATFORM_MAX_PATH];
while (configFile.ReadLine(map, PLATFORM_MAX_PATH)) {
TrimString(map);
if (strlen(map) == 0 || map[0] == '#' || map[0] == '/')continue;
maps.PushString(map);
}
configFile.Close();
SortADTArray(maps, Sort_Ascending, Sort_String);
for (int i = 0; i < maps.Length; ++i) {
maps.GetString(i, map, PLATFORM_MAX_PATH);
g_mapMenu.AddItem(map, map);
}
}
stock bool IsNominateAllowed(int client) {
if(BaseComm_IsClientGagged(client))
return false;
CanNominateResult result = CanNominate();
switch(result)
{
case CanNominate_No_VoteInProgress:
{
ReplyToCommand(client, "[Top12] Vote is already in progress.");
return false;
}
case CanNominate_No_VoteComplete:
{
char map[PLATFORM_MAX_PATH];
GetNextMap(map, sizeof(map));
ReplyToCommand(client, "[Top12] The next map is %s.", map);
return false;
}
}
return true;
}
stock int getNominationDelay() {
if (g_Cvar_NominateDelay == null) {
return 3;
}
return g_Cvar_NominateDelay.IntValue;
}

View File

@ -1,71 +0,0 @@
"VertexlitGeneric"
{
"$baseTexture" "models/unloze/crown/crown"
"$bumpmap" "models/unloze/crown/crown_bump"
// "$normalalphaenvmapmask" 1
// "$env_map" "env_cubemap"
// "$envmaptint" "[.5 .5 .5]"
"$detail" "models/unloze/crown/crown_detail"
"$detailscale" "5"
"$detailblendfactor" .01
"$detailblendmode" 6
"$yellow" "0"
"$phong" "1"
"$phongexponent" "50"
"$phongboost" "8"
"$lightwarptexture" "models/unloze/crown/crown_lightwarp"
"$phongfresnelranges" "[.25 .5 1]"
//"$basemapalphaphongmask" "1"
"$blendtintbybasealpha" "1"
"$blendtintcoloroverbase" "0"
"$colortint_base" "{127 61 61}"
"$colortint_tmp" "[0 0 0]"
// Rim lighting parameters
"$rimlight" "1" // To enable rim lighting (requires phong)
"$rimlightexponent" "4" // Exponent for phong component of rim lighting
"$rimlightboost" "2" // Boost for ambient cube component of rim lighting
// Cloaking
"$cloakPassEnabled" "1"
"Proxies"
{
"invis"
{
}
"AnimatedTexture"
{
"animatedtexturevar" "$detail"
"animatedtextureframenumvar" "$detailframe"
"animatedtextureframerate" 30
}
"BurnLevel"
{
"resultVar" "$detailblendfactor"
}
"ItemTintColor"
{
"resultVar" "$colortint_tmp"
}
"SelectFirstIfNonZero"
{
"srcVar1" "$colortint_tmp"
"srcVar2" "$colortint_base"
"resultVar" "$color2"
}
"YellowLevel"
{
"resultVar" "$yellow"
}
"Multiply"
{
"srcVar1" "$color2"
"srcVar2" "$yellow"
"resultVar" "$color2"
}
}
}

View File

@ -1,752 +0,0 @@
#include <zombiereloaded>
#include <clientprefs>
#include <multicolors>
#include <sourcemod>
#include <sdktools>
#include "loghelper.inc"
#define SPECMODE_NONE 0
#define SPECMODE_FIRSTPERSON 4
#define SPECMODE_THIRDPERSON 5
#define SPECMODE_FREELOOK 6
/* BOOLS */
bool g_bHideCrown[MAXPLAYERS+1];
bool g_bHideDialog[MAXPLAYERS+1];
bool g_bProtection[MAXPLAYERS+1];
/* COOKIES */
Handle g_hCookie_HideCrown;
Handle g_hCookie_HideDialog;
Handle g_hCookie_Protection;
/* CONVARS */
ConVar g_hCVar_Protection;
ConVar g_hCVar_ProtectionMinimal1;
ConVar g_hCVar_ProtectionMinimal2;
ConVar g_hCVar_ProtectionMinimal3;
/* INTERGERS */
int g_iCrownEntity = -1;
int g_iDialogLevel = 100000;
int g_iPlayerWinner[3];
int g_iPlayerDamage[MAXPLAYERS+1];
int g_iPlayerDamageHits[MAXPLAYERS+1];
int g_iPlayerDamageFrom1K[MAXPLAYERS + 1];
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Plugin myinfo =
{
name = "Top Defenders",
author = "Neon & zaCade",
description = "Show Top Defenders after each round",
version = "1.0.0"
};
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
CreateNative("TopDefenders_GetClientDamage", Native_GetClientDamage);
CreateNative("TopDefenders_GetClientHits", Native_GetClientHits);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnPluginStart()
{
LoadTranslations("plugin.topdefenders.phrases");
g_hCVar_Protection = CreateConVar("sm_topdefenders_protection", "1", "", FCVAR_NONE, true, 0.0, true, 1.0);
g_hCVar_ProtectionMinimal1 = CreateConVar("sm_topdefenders_minimal_1", "15", "", FCVAR_NONE, true, 1.0, true, 64.0);
g_hCVar_ProtectionMinimal2 = CreateConVar("sm_topdefenders_minimal_2", "30", "", FCVAR_NONE, true, 1.0, true, 64.0);
g_hCVar_ProtectionMinimal3 = CreateConVar("sm_topdefenders_minimal_3", "45", "", FCVAR_NONE, true, 1.0, true, 64.0);
g_hCookie_HideCrown = RegClientCookie("topdefenders_hidecrown", "", CookieAccess_Private);
g_hCookie_HideDialog = RegClientCookie("topdefenders_hidedialog", "", CookieAccess_Private);
g_hCookie_Protection = RegClientCookie("topdefenders_protection", "", CookieAccess_Private);
CreateTimer(0.1, UpdateScoreboard, INVALID_HANDLE, TIMER_REPEAT);
CreateTimer(0.1, UpdateDialog, INVALID_HANDLE, TIMER_REPEAT);
RegConsoleCmd("sm_togglecrown", OnToggleCrown);
RegConsoleCmd("sm_toggledialog", OnToggleDialog);
RegConsoleCmd("sm_toggleimmunity", OnToggleImmunity);
HookEvent("round_start", OnRoundStart);
HookEvent("round_end", OnRoundEnding);
HookEvent("player_hurt", OnClientHurt);
HookEvent("player_spawn", OnClientSpawn);
HookEvent("player_death", OnClientDeath);
SetCookieMenuItem(MenuHandler_CookieMenu, 0, "Top Defenders");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action OnToggleCrown(int client, int args)
{
ToggleCrown(client);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action OnToggleDialog(int client, int args)
{
ToggleDialog(client);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action OnToggleImmunity(int client, int args)
{
ToggleImmunity(client);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void ToggleCrown(int client)
{
g_bHideCrown[client] = !g_bHideCrown[client];
SetClientCookie(client, g_hCookie_HideCrown, g_bHideCrown[client] ? "1" : "");
CPrintToChat(client, "{cyan}%t {white}%t", "Chat Prefix", g_bHideCrown[client] ? "Crown Disabled" : "Crown Enabled");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void ToggleDialog(int client)
{
g_bHideDialog[client] = !g_bHideDialog[client];
SetClientCookie(client, g_hCookie_HideDialog, g_bHideDialog[client] ? "1" : "");
CPrintToChat(client, "{cyan}%t {white}%t", "Chat Prefix", g_bHideDialog[client] ? "Dialog Disabled" : "Dialog Enabled");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void ToggleImmunity(int client)
{
g_bProtection[client] = !g_bProtection[client];
SetClientCookie(client, g_hCookie_Protection, g_bProtection[client] ? "1" : "");
CPrintToChat(client, "{cyan}%t {white}%t", "Chat Prefix", g_bProtection[client] ? "Immunity Disabled" : "Immunity Enabled");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void ShowSettingsMenu(int client)
{
Menu menu = new Menu(MenuHandler_MainMenu);
menu.SetTitle("%T", "Cookie Menu Title", client);
AddMenuItemTranslated(menu, "0", "%t: %t", "Crown", g_bHideCrown[client] ? "Disabled" : "Enabled");
AddMenuItemTranslated(menu, "1", "%t: %t", "Dialog", g_bHideDialog[client] ? "Disabled" : "Enabled");
AddMenuItemTranslated(menu, "2", "%t: %t", "Immunity", g_bProtection[client] ? "Disabled" : "Enabled");
menu.ExitBackButton = true;
menu.Display(client, MENU_TIME_FOREVER);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void MenuHandler_CookieMenu(int client, CookieMenuAction action, any info, char[] buffer, int maxlen)
{
switch(action)
{
case(CookieMenuAction_DisplayOption):
{
Format(buffer, maxlen, "%T", "Cookie Menu", client);
}
case(CookieMenuAction_SelectOption):
{
ShowSettingsMenu(client);
}
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public int MenuHandler_MainMenu(Menu menu, MenuAction action, int client, int selection)
{
switch(action)
{
case(MenuAction_Select):
{
switch(selection)
{
case(0): ToggleCrown(client);
case(1): ToggleDialog(client);
case(2): ToggleImmunity(client);
}
ShowSettingsMenu(client);
}
case(MenuAction_Cancel):
{
ShowCookieMenu(client);
}
case(MenuAction_End):
{
delete menu;
}
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnMapStart()
{
PrecacheSound("unloze/holy.wav");
PrecacheModel("models/unloze/crown_v2.mdl");
AddFileToDownloadsTable("sound/unloze/holy.wav");
AddFileToDownloadsTable("models/unloze/crown_v2.mdl");
AddFileToDownloadsTable("models/unloze/crown_v2.phy");
AddFileToDownloadsTable("models/unloze/crown_v2.vvd");
AddFileToDownloadsTable("models/unloze/crown_v2.sw.vtx");
AddFileToDownloadsTable("models/unloze/crown_v2.dx80.vtx");
AddFileToDownloadsTable("models/unloze/crown_v2.dx90.vtx");
AddFileToDownloadsTable("materials/models/unloze/crown/crown.vmt");
AddFileToDownloadsTable("materials/models/unloze/crown/crown.vtf");
AddFileToDownloadsTable("materials/models/unloze/crown/crown_bump.vtf");
AddFileToDownloadsTable("materials/models/unloze/crown/crown_detail.vtf");
AddFileToDownloadsTable("materials/models/unloze/crown/crown_lightwarp.vtf");
GetTeams();
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientCookiesCached(int client)
{
char sBuffer[4];
GetClientCookie(client, g_hCookie_HideCrown, sBuffer, sizeof(sBuffer));
if (sBuffer[0])
g_bHideCrown[client] = true;
else
g_bHideCrown[client] = false;
GetClientCookie(client, g_hCookie_HideDialog, sBuffer, sizeof(sBuffer));
if (sBuffer[0])
g_bHideDialog[client] = true;
else
g_bHideDialog[client] = false;
GetClientCookie(client, g_hCookie_Protection, sBuffer, sizeof(sBuffer));
if (sBuffer[0])
g_bProtection[client] = true;
else
g_bProtection[client] = false;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientDisconnect(int client)
{
g_iPlayerDamage[client] = 0;
g_iPlayerDamageHits[client] = 0;
g_iPlayerDamageFrom1K[client] = 0;
g_bHideCrown[client] = false;
g_bHideDialog[client] = false;
g_bProtection[client] = false;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public int SortDefendersList(int[] elem1, int[] elem2, const int[][] array, Handle hndl)
{
if (elem1[1] > elem2[1]) return -1;
if (elem1[1] < elem2[1]) return 1;
return 0;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action UpdateScoreboard(Handle timer)
{
int iSortedList[MAXPLAYERS+1][2];
int iSortedCount;
for (int client = 1; client <= MaxClients; client++)
{
if (!IsClientInGame(client))
continue;
SetEntProp(client, Prop_Data, "m_iDeaths", 0);
if (!g_iPlayerDamage[client])
continue;
iSortedList[iSortedCount][0] = client;
iSortedList[iSortedCount][1] = g_iPlayerDamage[client];
iSortedCount++;
}
SortCustom2D(iSortedList, iSortedCount, SortDefendersList);
for (int rank = 0; rank < iSortedCount; rank++)
{
SetEntProp(iSortedList[rank][0], Prop_Data, "m_iDeaths", rank + 1);
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action UpdateDialog(Handle timer)
{
if (g_iDialogLevel <= 0)
return;
int iSortedList[MAXPLAYERS+1][2];
int iSortedCount;
for (int client = 1; client <= MaxClients; client++)
{
if (!IsClientInGame(client) || !g_iPlayerDamage[client])
continue;
iSortedList[iSortedCount][0] = client;
iSortedList[iSortedCount][1] = g_iPlayerDamage[client];
iSortedCount++;
}
SortCustom2D(iSortedList, iSortedCount, SortDefendersList);
for (int rank = 0; rank < iSortedCount; rank++)
{
switch(rank)
{
case(0): SendDialog(iSortedList[rank][0], "#%d (D: %d | P: -%d)", g_iDialogLevel, 1, rank + 1, iSortedList[rank][1], iSortedList[rank][1] - iSortedList[rank + 1][1]);
case(1): SendDialog(iSortedList[rank][0], "#%d (D: %d | N: +%d)", g_iDialogLevel, 1, rank + 1, iSortedList[rank][1], iSortedList[rank - 1][1] - iSortedList[rank][1]);
default: SendDialog(iSortedList[rank][0], "#%d (D: %d | N: +%d | F: +%d)", g_iDialogLevel, 1, rank + 1, iSortedList[rank][1], iSortedList[rank - 1][1] - iSortedList[rank][1], iSortedList[0][1] - iSortedList[rank][1]);
}
}
g_iDialogLevel--;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
g_iDialogLevel = 100000;
for (int client = 1; client <= MaxClients; client++)
{
g_iPlayerDamage[client] = 0;
g_iPlayerDamageHits[client] = 0;
g_iPlayerDamageFrom1K[client] = 0;
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnRoundEnding(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
g_iPlayerWinner = {-1, -1, -1};
int iSortedList[MAXPLAYERS+1][3];
int iSortedCount;
for (int client = 1; client <= MaxClients; client++)
{
if (!IsClientInGame(client) || !g_iPlayerDamage[client])
continue;
iSortedList[iSortedCount][0] = client;
iSortedList[iSortedCount][1] = g_iPlayerDamage[client];
iSortedList[iSortedCount][2] = g_iPlayerDamageHits[client];
iSortedCount++;
}
SortCustom2D(iSortedList, iSortedCount, SortDefendersList);
for (int rank = 0; rank < iSortedCount; rank++)
{
LogMessage("%d. %L - %d damage in %d hits", rank + 1, iSortedList[rank][0], iSortedList[rank][1], iSortedList[rank][2])
}
if (iSortedCount)
{
char sBuffer[512];
Format(sBuffer, sizeof(sBuffer), "TOP DEFENDERS:");
Format(sBuffer, sizeof(sBuffer), "%s\n*************************", sBuffer);
if (iSortedList[0][0])
{
Format(sBuffer, sizeof(sBuffer), "%s\n1. %N - %d damage in %d hits", sBuffer, iSortedList[0][0], iSortedList[0][1], iSortedList[0][2]);
LogPlayerEvent(iSortedList[0][0], "triggered", "top_defender");
g_iPlayerWinner[0] = GetSteamAccountID(iSortedList[0][0]);
}
if (iSortedList[1][0])
{
Format(sBuffer, sizeof(sBuffer), "%s\n2. %N - %d damage in %d hits", sBuffer, iSortedList[1][0], iSortedList[1][1], iSortedList[1][2]);
LogPlayerEvent(iSortedList[1][0], "triggered", "second_defender");
g_iPlayerWinner[1] = GetSteamAccountID(iSortedList[1][0]);
}
if (iSortedList[2][0])
{
Format(sBuffer, sizeof(sBuffer), "%s\n3. %N - %d damage in %d hits", sBuffer, iSortedList[2][0], iSortedList[2][1], iSortedList[2][2]);
LogPlayerEvent(iSortedList[2][0], "triggered", "third_defender");
g_iPlayerWinner[2] = GetSteamAccountID(iSortedList[2][0]);
}
Format(sBuffer, sizeof(sBuffer), "%s\n*************************", sBuffer);
Handle hMessage = StartMessageAll("HudMsg");
if (hMessage)
{
if (GetUserMessageType() == UM_Protobuf)
{
PbSetInt(hMessage, "channel", 50);
PbSetInt(hMessage, "effect", 0);
PbSetColor(hMessage, "clr1", {255, 255, 255, 255});
PbSetColor(hMessage, "clr2", {255, 255, 255, 255});
PbSetVector2D(hMessage, "pos", Float:{0.02, 0.45});
PbSetFloat(hMessage, "fade_in_time", 0.1);
PbSetFloat(hMessage, "fade_out_time", 0.1);
PbSetFloat(hMessage, "hold_time", 5.0);
PbSetFloat(hMessage, "fx_time", 0.0);
PbSetString(hMessage, "text", sBuffer);
EndMessage();
}
else
{
BfWriteByte(hMessage, 50);
BfWriteFloat(hMessage, 0.02);
BfWriteFloat(hMessage, 0.25);
BfWriteByte(hMessage, 0);
BfWriteByte(hMessage, 128);
BfWriteByte(hMessage, 255);
BfWriteByte(hMessage, 255);
BfWriteByte(hMessage, 255);
BfWriteByte(hMessage, 255);
BfWriteByte(hMessage, 255);
BfWriteByte(hMessage, 255);
BfWriteByte(hMessage, 0);
BfWriteFloat(hMessage, 0.1);
BfWriteFloat(hMessage, 0.1);
BfWriteFloat(hMessage, 5.0);
BfWriteFloat(hMessage, 0.0);
BfWriteString(hMessage, sBuffer);
EndMessage();
}
}
if(GetEngineVersion() == Engine_CSGO)
{
int iSplits
char sSplits[16][512];
if((iSplits = ExplodeString(sBuffer, "\n", sSplits, sizeof(sSplits), sizeof(sSplits[]))) != 0)
{
for (int iSplit; iSplit < iSplits; iSplit++)
{
PrintToChatAll(sSplits[iSplit]);
}
}
}
else
PrintToChatAll(sBuffer);
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientHurt(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
int client = GetClientOfUserId(hEvent.GetInt("attacker"));
int victim = GetClientOfUserId(hEvent.GetInt("userid"));
if (client < 1 || client > MaxClients || victim < 1 || victim > MaxClients)
return;
if (client == victim || (IsPlayerAlive(client) && ZR_IsClientZombie(client)))
return;
int iDamage = hEvent.GetInt("dmg_health");
g_iPlayerDamage[client] += iDamage;
g_iPlayerDamageHits[client] += 1;
g_iPlayerDamageFrom1K[client] += iDamage;
if (g_iPlayerDamageFrom1K[client] >= 1000)
{
g_iPlayerDamageFrom1K[client] -= 1000;
LogPlayerEvent(client, "triggered", "damage_zombie");
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientSpawn(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
int client = GetClientOfUserId(hEvent.GetInt("userid"));
if (g_iPlayerWinner[0] == GetSteamAccountID(client) && !g_bHideCrown[client])
{
CreateTimer(7.0, OnClientSpawnPost, client, TIMER_FLAG_NO_MAPCHANGE);
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action OnClientSpawnPost(Handle timer, int client)
{
if (!IsClientInGame(client) || IsFakeClient(client) || !IsPlayerAlive(client))
return;
if ((g_iCrownEntity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
return;
SetEntityModel(g_iCrownEntity, "models/unloze/crown_v2.mdl");
DispatchKeyValue(g_iCrownEntity, "solid", "0");
DispatchKeyValue(g_iCrownEntity, "modelscale", "1.5");
DispatchKeyValue(g_iCrownEntity, "disableshadows", "1");
DispatchKeyValue(g_iCrownEntity, "disablereceiveshadows", "1");
DispatchKeyValue(g_iCrownEntity, "disablebonefollowers", "1");
float fVector[3];
float fAngles[3];
GetClientAbsOrigin(client, fVector);
GetClientAbsAngles(client, fAngles);
fVector[2] += 80.0;
fAngles[0] = 8.0;
fAngles[2] = 5.5;
TeleportEntity(g_iCrownEntity, fVector, fAngles, NULL_VECTOR);
float fDirection[3];
fDirection[0] = 0.0;
fDirection[1] = 0.0;
fDirection[2] = 1.0;
TE_SetupSparks(fVector, fDirection, 1000, 200);
TE_SendToAll();
SetVariantString("!activator");
AcceptEntityInput(g_iCrownEntity, "SetParent", client);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnClientDeath(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
int client = GetClientOfUserId(hEvent.GetInt("userid"));
if (g_iPlayerWinner[0] == GetSteamAccountID(client) && !IsPlayerAlive(client))
{
if (g_iCrownEntity != INVALID_ENT_REFERENCE && AcceptEntityInput(g_iCrownEntity, "Kill"))
{
g_iCrownEntity = INVALID_ENT_REFERENCE;
}
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action ZR_OnClientInfect(&client, &attacker, &bool:motherInfect, &bool:respawnOverride, &bool:respawn)
{
if (g_hCVar_Protection.BoolValue && motherInfect && !g_bProtection[client])
{
if ((g_iPlayerWinner[0] == GetSteamAccountID(client) && GetClientCount() >= g_hCVar_ProtectionMinimal1.IntValue) ||
(g_iPlayerWinner[1] == GetSteamAccountID(client) && GetClientCount() >= g_hCVar_ProtectionMinimal2.IntValue) ||
(g_iPlayerWinner[2] == GetSteamAccountID(client) && GetClientCount() >= g_hCVar_ProtectionMinimal3.IntValue))
{
Handle hMessageInfection = StartMessageOne("HudMsg", client);
if (hMessageInfection)
{
if (GetUserMessageType() == UM_Protobuf)
{
PbSetInt(hMessageInfection, "channel", 50);
PbSetInt(hMessageInfection, "effect", 0);
PbSetColor(hMessageInfection, "clr1", {255, 255, 255, 255});
PbSetColor(hMessageInfection, "clr2", {255, 255, 255, 255});
PbSetVector2D(hMessageInfection, "pos", Float:{-1.0, 0.3});
PbSetFloat(hMessageInfection, "fade_in_time", 0.1);
PbSetFloat(hMessageInfection, "fade_out_time", 0.1);
PbSetFloat(hMessageInfection, "hold_time", 5.0);
PbSetFloat(hMessageInfection, "fx_time", 0.0);
PbSetString(hMessageInfection, "text", "You have been protected from being Mother Zombie\nsince you were the Top Defender last round!");
EndMessage();
}
else
{
BfWriteByte(hMessageInfection, 50);
BfWriteFloat(hMessageInfection, -1.0);
BfWriteFloat(hMessageInfection, 0.3);
BfWriteByte(hMessageInfection, 0);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 255);
BfWriteByte(hMessageInfection, 0);
BfWriteFloat(hMessageInfection, 0.1);
BfWriteFloat(hMessageInfection, 0.1);
BfWriteFloat(hMessageInfection, 5.0);
BfWriteFloat(hMessageInfection, 0.0);
BfWriteString(hMessageInfection, "You have been protected from being Mother Zombie\nsince you were the Top Defender last round!");
EndMessage();
}
}
CPrintToChat(client, "{cyan}%t {white}%s", "Chat Prefix", "You have been protected from being Mother Zombie since you were the Top Defender last round!");
EmitSoundToClient(client, "unloze/holy.wav", .volume=1.0);
return Plugin_Handled;
}
}
return Plugin_Continue;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public int Native_GetClientDamage(Handle hPlugin, int numParams)
{
int client = GetNativeCell(1);
if (client < 1 || client > MaxClients)
{
return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client);
}
if (!IsClientInGame(client))
{
return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client);
}
return g_iPlayerDamage[client];
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public int Native_GetClientHits(Handle hPlugin, int numParams)
{
int client = GetNativeCell(1);
if (client < 1 || client > MaxClients)
{
return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client);
}
if (!IsClientInGame(client))
{
return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client);
}
return g_iPlayerDamageHits[client];
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
void AddMenuItemTranslated(Menu menu, const char[] info, const char[] display, any ...)
{
char buffer[128];
VFormat(buffer, sizeof(buffer), display, 4);
menu.AddItem(info, buffer);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
void SendDialog(int client, const char[] display, const int level, const int time, any ...)
{
char buffer[128];
VFormat(buffer, sizeof(buffer), display, 5);
KeyValues kv = new KeyValues("dialog", "title", buffer);
kv.SetColor("color", 255, 255, 255, 255);
kv.SetNum("level", level);
kv.SetNum("time", time);
if (!g_bHideDialog[client])
{
CreateDialog(client, kv, DialogType_Msg);
}
for (int spec = 1; spec <= MaxClients; spec++)
{
if (!IsClientInGame(spec) || !IsClientObserver(spec) || g_bHideDialog[spec])
continue;
int specMode = GetClientSpectatorMode(spec);
int specTarget = GetClientSpectatorTarget(spec);
if ((specMode == SPECMODE_FIRSTPERSON || specMode == SPECMODE_THIRDPERSON) && specTarget == client)
{
CreateDialog(spec, kv, DialogType_Msg);
}
}
delete kv;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
int GetClientSpectatorMode(int client)
{
return GetEntProp(client, Prop_Send, "m_iObserverMode");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
int GetClientSpectatorTarget(int client)
{
return GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
}

View File

@ -1,29 +0,0 @@
#if defined _TopDefenders_OnRoundEnd
#endinput
#endif
#define _TopDefenders_OnRoundEnd
/**
* Called when TopDefenders are being printed out.
*
* @param iPlayers The sorted array of the Defenders' Client IDs. (iPlayers[0] is the TopDefender)
* @param iDamage The sorted array of the Defenders' Damages. (iDamage[0] is the TopDefender's Damage)
* @param iHits The sorted array of the Defenders' Hits. (iHits[0] is the TopDefender's Hits)
*/
forward void TopDefenders_OnRoundEnd(int iPlayers[MAXPLAYERS+1], int iDamage[MAXPLAYERS+1], int iHits[MAXPLAYERS+1]);
/**
* Returns the current damage of a client
*
* @param client Client index.
* @return The current damage of the client.
*/
native int TopDefenders_GetClientDamage(int client);
/**
* Returns the current hits of a client
*
* @param client Client index.
* @return The current hits of the client.
*/
native int TopDefenders_GetClientHits(int client);

View File

@ -1,63 +0,0 @@
"Phrases"
{
"Chat Prefix"
{
"en" "[TopDefenders]"
}
"Cookie Menu"
{
"en" "Top Defenders"
}
"Cookie Menu Title"
{
"en" "Top Defenders Settings"
}
"Enabled"
{
"en" "Enabled"
}
"Disabled"
{
"en" "Disabled"
}
"Crown"
{
"en" "Crown"
}
"Crown Enabled"
{
"en" "You will now spawn with a crown again"
}
"Crown Disabled"
{
"en" "You will no longer spawn with a crown"
}
"Dialog"
{
"en" "Dialog"
}
"Dialog Enabled"
{
"en" "You will now see the dialog again"
}
"Dialog Disabled"
{
"en" "You will no longer see the dialog"
}
"Immunity"
{
"en" "Immunity"
}
"Immunity Enabled"
{
"en" "You will now be protected from being mother zombie"
}
"Immunity Disabled"
{
"en" "You will no longer be protected from being mother zombie"
}
"protected"
{
"en" "You have been protected from being mother zombie, since you where top defender last round."
}
}

View File

@ -1,61 +0,0 @@
#include <sourcemod>
#pragma semicolon 1
public Plugin:myinfo =
{
name = "Players count in hostname",
author = "D1maxa",
description = "Showing number of players in name of server",
version = "1.11",
url = "http://forums.alliedmods.net/showthread.php?t=126060"
};
new g_NumClients=0;
new Handle:hostname = INVALID_HANDLE;
new Handle:sv_visiblemaxplayers = INVALID_HANDLE;
new Handle:formatted_hostname = INVALID_HANDLE;
public OnPluginStart()
{
hostname = FindConVar("hostname");
sv_visiblemaxplayers = FindConVar("sv_visiblemaxplayers");
formatted_hostname=CreateConVar("sm_formatted_hostname", "My Server %d/%d", "Formatted string for dynamic hostname",FCVAR_PLUGIN);
}
public OnMapStart()
{
g_NumClients=0;
}
public OnConfigsExecuted()
{
SetNumberOfPlayersInHostname();
}
public OnClientConnected(client)
{
if(!IsFakeClient(client))
{
g_NumClients++;
SetNumberOfPlayersInHostname();
}
}
public OnClientDisconnect(client)
{
if(!IsFakeClient(client))
{
g_NumClients--;
SetNumberOfPlayersInHostname();
}
}
SetNumberOfPlayersInHostname()
{
decl String:my_buf[64];
decl String:f_hostname[64];
GetConVarString(formatted_hostname,f_hostname,sizeof(f_hostname));
Format(my_buf,sizeof(my_buf),f_hostname,g_NumClients,GetConVarInt(sv_visiblemaxplayers));
SetConVarString(hostname,my_buf);
ServerCommand("heartbeat");
}