From 6a6fb216f0e4e05ff2081d4a5efbf83804c5c4ba Mon Sep 17 00:00:00 2001 From: BotoX Date: Sun, 26 Feb 2017 01:20:01 +0100 Subject: [PATCH] Remove unused plugins --- .../scripting/RandomTriggerTouch.sp | 136 ---------- .../scripting/include/CSSFixes.inc | 1 - .../gamedata/voiceannounce_ex.games.txt | 201 -------------- voiceannounce_ex/scripting/include/dhooks.inc | 1 - .../scripting/include/voiceannounce_ex.inc | 57 ---- .../scripting/voiceannounce_ex.sp | 253 ------------------ 6 files changed, 649 deletions(-) delete mode 100644 RandomTriggerTouch/scripting/RandomTriggerTouch.sp delete mode 120000 RandomTriggerTouch/scripting/include/CSSFixes.inc delete mode 100644 voiceannounce_ex/gamedata/voiceannounce_ex.games.txt delete mode 120000 voiceannounce_ex/scripting/include/dhooks.inc delete mode 100644 voiceannounce_ex/scripting/include/voiceannounce_ex.inc delete mode 100644 voiceannounce_ex/scripting/voiceannounce_ex.sp diff --git a/RandomTriggerTouch/scripting/RandomTriggerTouch.sp b/RandomTriggerTouch/scripting/RandomTriggerTouch.sp deleted file mode 100644 index 334d5ab3..00000000 --- a/RandomTriggerTouch/scripting/RandomTriggerTouch.sp +++ /dev/null @@ -1,136 +0,0 @@ -#include -#include -#include -#include - -#pragma semicolon 1 -#pragma newdecls required - -Handle g_hCBaseEntity_Touch; -bool g_bIgnoreHook = false; - -#define TOUCHED_MAX (MAXPLAYERS + 1) -int g_aTouched[TOUCHED_MAX]; -int g_aaTouchedList[TOUCHED_MAX][MAXPLAYERS + 1]; -int g_aTouchedListSize[TOUCHED_MAX]; - -public Plugin myinfo = -{ - name = "Randomize Trigger Touch", - author = "BotoX", - description = "Randomize Touches on trigger_multiple", - version = "1.0" -} - -public void OnPluginStart() -{ - Handle hGameConf = LoadGameConfigFile("sdkhooks.games"); - if(hGameConf == INVALID_HANDLE) - { - SetFailState("Couldn't load sdkhooks.games game config!"); - return; - } - - if(GameConfGetOffset(hGameConf, "Touch") == -1) - { - CloseHandle(hGameConf); - SetFailState("Couldn't get Touch offset from game config!"); - return; - } - - // void CBaseEntity::Touch( CBaseEntity *pOther ) - StartPrepSDKCall(SDKCall_Entity); - if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "Touch")) - { - CloseHandle(hGameConf); - SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"Touch\" failed!"); - return; - } - PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_Pointer); - g_hCBaseEntity_Touch = EndPrepSDKCall(); - - // Late load - int entity = INVALID_ENT_REFERENCE; - while((entity = FindEntityByClassname(entity, "trigger_multiple")) != INVALID_ENT_REFERENCE) - { - SDKHook(entity, SDKHook_Touch, OnTouch); - } -} - -public void OnRunThinkFunctionsPost(bool simulating) -{ - g_bIgnoreHook = true; - for(int i = 0; i < sizeof(g_aTouched); i++) - { - if(!g_aTouched[i]) - break; - - if(!IsValidEntity(g_aTouched[i])) - continue; - - // Fisher-Yates Shuffle - for(int j = g_aTouchedListSize[i] - 1; j >= 1; j--) - { - int k = GetRandomInt(0, j); - int t = g_aaTouchedList[i][j]; - g_aaTouchedList[i][j] = g_aaTouchedList[i][k]; - g_aaTouchedList[i][k] = t; - } - - for(int j = 0; j < g_aTouchedListSize[i]; j++) - { - if(IsValidEntity(g_aaTouchedList[i][j])) - SDKCall(g_hCBaseEntity_Touch, g_aTouched[i], g_aaTouchedList[i][j]); - } - - g_aTouched[i] = 0; - g_aTouchedListSize[i] = 0; - } - g_bIgnoreHook = false; -} - -public void OnEntityCreated(int entity, const char[] classname) -{ - if(StrEqual(classname, "trigger_multiple")) - { - SDKHook(entity, SDKHook_Touch, OnTouch); - } -} - -public Action OnTouch(int touched, int toucher) -{ - if(toucher > MAXPLAYERS || g_bIgnoreHook) - return Plugin_Continue; - - int i; - for(i = 0; i < sizeof(g_aTouched); i++) - { - if(!g_aTouched[i] || g_aTouched[i] == touched) - break; - } - - if(i == sizeof(g_aTouched)) - return Plugin_Continue; - - g_aTouched[i] = touched; - - for(int j = 0; j < g_aTouchedListSize[i]; j++) - { - if(g_aaTouchedList[i][j] == toucher) - return Plugin_Handled; - } - - g_aaTouchedList[i][g_aTouchedListSize[i]++] = toucher; - - return Plugin_Handled; -} - -stock int GetHighestClientIndex() -{ - for(int i = MaxClients; i >= 1; i--) - { - if(IsValidEntity(i)) - return i; - } - return 0; -} diff --git a/RandomTriggerTouch/scripting/include/CSSFixes.inc b/RandomTriggerTouch/scripting/include/CSSFixes.inc deleted file mode 120000 index aa0b4998..00000000 --- a/RandomTriggerTouch/scripting/include/CSSFixes.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/CSSFixes.inc \ No newline at end of file diff --git a/voiceannounce_ex/gamedata/voiceannounce_ex.games.txt b/voiceannounce_ex/gamedata/voiceannounce_ex.games.txt deleted file mode 100644 index 1f02a172..00000000 --- a/voiceannounce_ex/gamedata/voiceannounce_ex.games.txt +++ /dev/null @@ -1,201 +0,0 @@ -"Games" -{ - "#default" - { - "#supported" - { - "engine" "orangebox_valve" - "engine" "css" - "engine" "csgo" - } - - "Addresses" - { - "CBaseServer" - { - "windows" - { - "signature" "CVEngineServer::CreateFakeClient" - "read" "8" - } - "linux" - { - "signature" "sv" - } - "mac" - { - "signature" "sv" - } - } - } - - "Signatures" - { - "CVEngineServer::CreateFakeClient" - { - "library" "engine" - "windows" "\x55\x8B\xEC\xFF\x75\x08\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x75\x04" - } - - "sv" - { - "library" "engine" - "linux" "@sv" - "mac" "@sv" - } - } - } - - "#default" - { - "#supported" - { - "engine" "orangebox" - "engine" "left4dead" - "engine" "left4dead2" - } - - "Addresses" - { - "CBaseServer" - { - "windows" - { - "signature" "CVEngineServer::CreateFakeClient" - "read" "6" - } - "linux" - { - "signature" "sv" - } - "mac" - { - "signature" "sv" - } - } - } - - "Signatures" - { - "CVEngineServer::CreateFakeClient" - { - "library" "engine" - "windows" "\x8B\x44\x24\x04\x50\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0" - } - - "sv" - { - "library" "engine" - "linux" "@sv" - "mac" "@sv" - } - } - } - - "#default" - { - "#supported" - { - "engine" "orangebox" - "engine" "orangebox_valve" - "engine" "css" - } - - "Offsets" - { - "CBaseServer::GetClient" - { - "windows" "6" - "linux" "7" - "mac" "7" - } - - "CBaseClient::GetPlayerSlot" - { - "windows" "14" - "linux" "15" - "mac" "15" - } - - "CGameClient::ProcessVoiceData" - { - "windows" "7" - "linux" "8" - "mac" "8" - } - } - } - - "#default" - { - "#supported" - { - "engine" "left4dead" - "engine" "left4dead2" - "engine" "csgo" - } - - "Offsets" - { - "CBaseServer::GetClient" - { - "windows" "6" - "linux" "7" - "mac" "7" - } - - "CBaseClient::GetPlayerSlot" - { - "windows" "14" - "linux" "15" - "mac" "15" - } - - "CGameClient::ProcessVoiceData" - { - "windows" "8" - "linux" "9" - "mac" "9" - } - } - } - - "csgo" - { - "Offsets" - { - "OnVoiceTransmit" - { - "windows" "513" - "linux" "514" - "mac" "514" - } - } - } - - "left4dead" - { - "Offsets" - { - "OnVoiceTransmit" - { - "windows" "461" - "linux" "462" - "mac" "462" - } - } - } - - "left4dead2" - { - "Offsets" - { - "OnVoiceTransmit" - { - "windows" "485" - "linux" "486" - "mac" "486" - } - } - } -} diff --git a/voiceannounce_ex/scripting/include/dhooks.inc b/voiceannounce_ex/scripting/include/dhooks.inc deleted file mode 120000 index 8b56a6fb..00000000 --- a/voiceannounce_ex/scripting/include/dhooks.inc +++ /dev/null @@ -1 +0,0 @@ -../../../includes/dhooks.inc \ No newline at end of file diff --git a/voiceannounce_ex/scripting/include/voiceannounce_ex.inc b/voiceannounce_ex/scripting/include/voiceannounce_ex.inc deleted file mode 100644 index b922896e..00000000 --- a/voiceannounce_ex/scripting/include/voiceannounce_ex.inc +++ /dev/null @@ -1,57 +0,0 @@ -#if defined _voiceannounceex_included_ - #endinput -#endif -#define _voiceannounceex_included_ - -public SharedPlugin:__pl_voiceannounceex = -{ - name = "voiceannounce_ex", - file = "voiceannounce_ex.smx", - #if defined REQUIRE_PLUGIN - required = 1, - #else - required = 0, - #endif -}; - -public __pl_voiceannounceex_SetNTVOptional() -{ - MarkNativeAsOptional("IsClientSpeaking"); -} - -/** - * - * Checks whether a client is speaking or not. - * - * @param client The client index to check against. - * - * @error Client is not valid, ingame, or client is a bot. - * - * @return True if client is speaking, false otherwise. - * - */ - -native bool:IsClientSpeaking(client); - -/** - * - * Called when a client is speaking. - * - * @param client The index of the client that is speaking. - * - * @return True to allow the client to talk, false otherwise. - * - */ - -forward bool:OnClientSpeakingEx(client); - -/** - * - * Called when a client end of speaking. - * - * @param client The index of the client. - * - * @noreturn - * - */ -forward OnClientSpeakingEnd(client); \ No newline at end of file diff --git a/voiceannounce_ex/scripting/voiceannounce_ex.sp b/voiceannounce_ex/scripting/voiceannounce_ex.sp deleted file mode 100644 index ff53efd6..00000000 --- a/voiceannounce_ex/scripting/voiceannounce_ex.sp +++ /dev/null @@ -1,253 +0,0 @@ -#pragma semicolon 1 - -#include -#include -#include -#include - -#define PLUGIN_VERSION "2.0.0" - -new Handle:g_hProcessVoice = INVALID_HANDLE; -new Handle:g_hOnClientTalking = INVALID_HANDLE; -new Handle:g_hOnClientTalkingEnd = INVALID_HANDLE; -new bool:g_bLateLoad = false; - -new g_iHookID[MAXPLAYERS+1] = { -1, ... }; -new Handle:g_hClientMicTimers[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; - -new bool:g_bIsCSGO; -new Handle:g_hCSGOVoice; - -public Plugin:myinfo = -{ - name = "VoiceAnnounceEx", - author = "Franc1sco franug, Mini and GoD-Tony", - description = "Feature for developers to check/control client mic usage.", - version = PLUGIN_VERSION, - url = "https://forums.alliedmods.net" -} - -public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) -{ - if(GetEngineVersion() == Engine_CSGO) - g_bIsCSGO = true; - else - g_bIsCSGO = false; - - CreateNative("IsClientSpeaking", Native_IsClientTalking); - - RegPluginLibrary("voiceannounce_ex"); - - g_bLateLoad = late; - return APLRes_Success; -} - -public Native_IsClientTalking(Handle:plugin, numParams) -{ - new client = GetNativeCell(1); - - if (client > MaxClients || client <= 0) - { - ThrowNativeError(SP_ERROR_NATIVE, "Client is not valid."); - return false; - } - - if (!IsClientInGame(client)) - { - ThrowNativeError(SP_ERROR_NATIVE, "Client is not in-game."); - return false; - } - - if (IsFakeClient(client)) - { - ThrowNativeError(SP_ERROR_NATIVE, "Cannot do mic checks on fake clients."); - return false; - } - - return (g_hClientMicTimers[client] == INVALID_HANDLE) ? false : true; -} - -public OnPluginStart() -{ - //CreateConVar("voiceannounce_ex_version", PLUGIN_VERSION, "plugin", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD); - new Offset; - if(g_bIsCSGO) - { - Offset = GameConfGetOffset(GetConfig(), "OnVoiceTransmit"); - - if(Offset == -1) - SetFailState("Failed to get offset"); - - g_hCSGOVoice = DHookCreate(Offset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, CSGOVoicePost); - } - else - { - Offset = GameConfGetOffset(GetConfig(), "CGameClient::ProcessVoiceData"); - - g_hProcessVoice = DHookCreate(Offset, HookType_Raw, ReturnType_Void, ThisPointer_Address, Hook_ProcessVoiceData); - DHookAddParam(g_hProcessVoice, HookParamType_ObjectPtr); - } - - g_hOnClientTalking = CreateGlobalForward("OnClientSpeakingEx", ET_Single, Param_Cell); - g_hOnClientTalkingEnd = CreateGlobalForward("OnClientSpeakingEnd", ET_Ignore, Param_Cell); - - if(g_bLateLoad) - { - for(new i = 1; i <= MaxClients; i++) - { - if(IsClientInGame(i) && !IsFakeClient(i)) - OnClientPutInServer(i); - } - } -} - -public OnClientPutInServer(client) -{ - if (!IsFakeClient(client)) - { - if(g_bIsCSGO) - DHookEntity(g_hCSGOVoice, true, client); - else - g_iHookID[client] = DHookRaw(g_hProcessVoice, true, GetIMsgHandler(client)); - - if(g_hClientMicTimers[client] != INVALID_HANDLE) - KillTimer(g_hClientMicTimers[client]); - - g_hClientMicTimers[client] = INVALID_HANDLE; - } -} - -public OnClientDisconnect(client) -{ - if(g_bIsCSGO) - { - if(g_iHookID[client] != -1) - { - DHookRemoveHookID(g_iHookID[client]); - g_iHookID[client] = -1; - } - } - - if(g_hClientMicTimers[client] != INVALID_HANDLE) - KillTimer(g_hClientMicTimers[client]); - - g_hClientMicTimers[client] = INVALID_HANDLE; -} - -public MRESReturn:Hook_ProcessVoiceData(Address:pThis, Handle:hParams) -{ - new Address:pIClient = pThis - Address:4; - new client = GetPlayerSlot(pIClient) + 1; - - if(g_hClientMicTimers[client] != INVALID_HANDLE) - { - KillTimer(g_hClientMicTimers[client]); - g_hClientMicTimers[client] = CreateTimer(0.3, Timer_ClientMicUsage, GetClientUserId(client)); - } - - if(g_hClientMicTimers[client] == INVALID_HANDLE && IsClientInGame(client)) - g_hClientMicTimers[client] = CreateTimer(0.3, Timer_ClientMicUsage, GetClientUserId(client)); - - new bool:returnBool = true; - Call_StartForward(g_hOnClientTalking); - Call_PushCell(client); - Call_Finish(_:returnBool); - - if(!returnBool) - return MRES_Supercede; - - return MRES_Ignored; -} - -public MRESReturn:CSGOVoicePost(client, Handle:hReturn) -{ - if(g_hClientMicTimers[client] != INVALID_HANDLE) - { - KillTimer(g_hClientMicTimers[client]); - g_hClientMicTimers[client] = CreateTimer(0.3, Timer_ClientMicUsage, GetClientUserId(client)); - } - - if(g_hClientMicTimers[client] == INVALID_HANDLE && IsClientInGame(client)) - g_hClientMicTimers[client] = CreateTimer(0.3, Timer_ClientMicUsage, GetClientUserId(client)); - - - new bool:returnBool = true; - Call_StartForward(g_hOnClientTalking); - Call_PushCell(client); - Call_Finish(_:returnBool); - - if(!returnBool) - return MRES_Supercede; - - return MRES_Ignored; -} - -public Action:Timer_ClientMicUsage(Handle:timer, any:userid) -{ - new client = GetClientOfUserId(userid); - g_hClientMicTimers[client] = INVALID_HANDLE; - - Call_StartForward(g_hOnClientTalkingEnd); - Call_PushCell(client); - Call_Finish(); -} - -/* -* Internal Functions -* Credits go to GoD-Tony -*/ -stock Handle:GetConfig() -{ - static Handle:hGameConf = INVALID_HANDLE; - - if(hGameConf == INVALID_HANDLE) - hGameConf = LoadGameConfigFile("voiceannounce_ex.games"); - - return hGameConf; -} - -stock Address:GetBaseServer() -{ - static Address:pBaseServer = Address_Null; - - if(pBaseServer == Address_Null) - pBaseServer = GameConfGetAddress(GetConfig(), "CBaseServer"); - - return pBaseServer; -} - -stock Address:GetIClient(slot) -{ - static Handle:hGetClient = INVALID_HANDLE; - - if(hGetClient == INVALID_HANDLE) - { - StartPrepSDKCall(SDKCall_Raw); - PrepSDKCall_SetFromConf(GetConfig(), SDKConf_Virtual, "CBaseServer::GetClient"); - PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain); - PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain); - hGetClient = EndPrepSDKCall(); - } - - return Address:SDKCall(hGetClient, GetBaseServer(), slot); -} - -stock GetPlayerSlot(Address:pIClient) -{ - static Handle:hPlayerSlot = INVALID_HANDLE; - - if(hPlayerSlot == INVALID_HANDLE) - { - StartPrepSDKCall(SDKCall_Raw); - PrepSDKCall_SetFromConf(GetConfig(), SDKConf_Virtual, "CBaseClient::GetPlayerSlot"); - PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain); - hPlayerSlot = EndPrepSDKCall(); - } - - return SDKCall(hPlayerSlot, pIClient); -} - -stock Address:GetIMsgHandler(client) -{ - return GetIClient(client - 1) + Address:4; -}