diff --git a/FullUpdate/gamedata/FullUpdate2.games.txt b/FullUpdate/gamedata/FullUpdate2.games.txt new file mode 100644 index 00000000..b768667d --- /dev/null +++ b/FullUpdate/gamedata/FullUpdate2.games.txt @@ -0,0 +1,20 @@ +"Games" +{ + "#default" + { + "#supported" + { + "engine" "orangebox" + "engine" "orangebox_valve" + "engine" "css" + } + + "Offsets" + { + "CBaseClient::UpdateAcknowledgedFramecount" + { + "linux" "44" + } + } + } +} diff --git a/FullUpdate/scripting/FullUpdate.sp b/FullUpdate/scripting/FullUpdate.sp new file mode 100644 index 00000000..0536f532 --- /dev/null +++ b/FullUpdate/scripting/FullUpdate.sp @@ -0,0 +1,106 @@ +#pragma semicolon 1 +#pragma newdecls required + +#include +#include +#include + +Handle g_hCBaseClient_UpdateAcknowledgedFramecount; +int g_iLastFullUpdate[MAXPLAYERS + 1] = { 0, ... }; + +public Plugin myinfo = +{ + name = "FullUpdate", + author = "BotoX", + description = "Serverside cl_fullupdate", + version = "1.0" +} + +public void OnPluginStart() +{ + Handle hGameConf = LoadGameConfigFile("FullUpdate2.games"); + if(hGameConf == INVALID_HANDLE) + { + SetFailState("Couldn't load FullUpdate2.games game config!"); + return; + } + + // void CBaseClient::UpdateAcknowledgedFramecount() + StartPrepSDKCall(SDKCall_Raw); + + if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "CBaseClient::UpdateAcknowledgedFramecount")) + { + CloseHandle(hGameConf); + SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"CBaseClient::UpdateAcknowledgedFramecount\" failed!"); + return; + } + CloseHandle(hGameConf); + + PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain); + + g_hCBaseClient_UpdateAcknowledgedFramecount = EndPrepSDKCall(); + + RegConsoleCmd("sm_fullupdate", Command_FullUpdate); + RegConsoleCmd("cl_fullupdate", Command_FullUpdate); + RegConsoleCmd("fullupdate", Command_FullUpdate); +} + +public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) +{ + CreateNative("ClientFullUpdate", Native_FullUpdate); + RegPluginLibrary("FullUpdate"); + + return APLRes_Success; +} + +public void OnClientConnected(int client) +{ + g_iLastFullUpdate[client] = 0; +} + +bool FullUpdate(int client) +{ + if(g_iLastFullUpdate[client] + 1 > GetTime()) + return false; + + // The IClient vtable is +4 from the IGameEventListener2 (CBaseClient) vtable due to multiple inheritance. + Address pIClient = GetClientIClient(client) - view_as
(4); + if(!pIClient) + return false; + + SDKCall(g_hCBaseClient_UpdateAcknowledgedFramecount, pIClient, -1); + + g_iLastFullUpdate[client] = GetTime(); + return true; +} + +public int Native_FullUpdate(Handle plugin, int numParams) +{ + int client = GetNativeCell(1); + + if(client > MaxClients || client <= 0) + { + ThrowNativeError(SP_ERROR_NATIVE, "Client is not valid."); + return 0; + } + + if(!IsClientInGame(client)) + { + ThrowNativeError(SP_ERROR_NATIVE, "Client is not in-game."); + return 0; + } + + if(IsFakeClient(client)) + { + ThrowNativeError(SP_ERROR_NATIVE, "Client is fake-client."); + return 0; + } + + return FullUpdate(client); +} + +public Action Command_FullUpdate(int client, int args) +{ + FullUpdate(client); + return Plugin_Handled; +} diff --git a/FullUpdate/scripting/include/FullUpdate.inc b/FullUpdate/scripting/include/FullUpdate.inc new file mode 100644 index 00000000..0b026c81 --- /dev/null +++ b/FullUpdate/scripting/include/FullUpdate.inc @@ -0,0 +1,24 @@ +#if defined _FullUpdate_Included + #endinput +#endif +#define _FullUpdate_Included + +native bool ClientFullUpdate(int client); + +public SharedPlugin __pl_FullUpdate = +{ + name = "FullUpdate", + file = "FullUpdate.smx", +#if defined REQUIRE_PLUGIN + required = 1, +#else + required = 0, +#endif +}; + +#if !defined REQUIRE_PLUGIN +public __pl_FullUpdate_SetNTVOptional() +{ + MarkNativeAsOptional("ClientFullUpdate"); +} +#endif diff --git a/ThirdPerson/scripting/ThirdPerson.sp b/ThirdPerson/scripting/ThirdPerson.sp new file mode 100644 index 00000000..4ca5a9b4 --- /dev/null +++ b/ThirdPerson/scripting/ThirdPerson.sp @@ -0,0 +1,97 @@ +#pragma semicolon 1 +#pragma newdecls required + +#include +#include +#include + +bool g_bThirdPerson[MAXPLAYERS + 1] = { false, ... }; + +// Spectator Movement modes (from smlib) +enum Obs_Mode +{ + OBS_MODE_NONE = 0, // not in spectator mode + OBS_MODE_DEATHCAM, // special mode for death cam animation + OBS_MODE_FREEZECAM, // zooms to a target, and freeze-frames on them + OBS_MODE_FIXED, // view from a fixed camera position + OBS_MODE_IN_EYE, // follow a player in first person view + OBS_MODE_CHASE, // follow a player in third person view + OBS_MODE_POI, // PASSTIME point of interest - game objective, big fight, anything interesting; added in the middle of the enum due to tons of hard-coded "