/* * shavit's Timer - Replay Bot * by: shavit * * This file is part of shavit's Timer. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, version 3.0, as published by the * Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see . * */ #include #include #include #include #undef REQUIRE_PLUGIN #define USES_STYLE_NAMES #define USES_SHORT_STYLE_NAMES #define USES_STYLE_PROPERTIES #include #pragma semicolon 1 #pragma dynamic 131072 #pragma newdecls required // game type EngineVersion gEV_Type = Engine_Unknown; // cache int gI_ReplayTick[MAX_STYLES]; int gI_ReplayBotClient[MAX_STYLES]; ArrayList gA_Frames[MAX_STYLES] = {null, ...}; float gF_StartTick[MAX_STYLES]; ReplayStatus gRS_ReplayStatus[MAX_STYLES]; int gI_FrameCount[MAX_STYLES]; int gI_PlayerFrames[MAXPLAYERS+1]; ArrayList gA_PlayerFrames[MAXPLAYERS+1]; bool gB_Record[MAXPLAYERS+1]; // server specific float gF_Tickrate = 0.0; char gS_Map[256]; int gI_ExpectedBots = 0; ConVar bot_quota = null; // how do i call this bool gB_HideNameChange = false; bool gB_DontCallTimer = false; // plugin cvars ConVar gCV_Enabled = null; ConVar gCV_ReplayDelay = null; ConVar gCV_TimeLimit = null; ConVar gCV_NameStyle = null; public Plugin myinfo = { name = "[shavit] Replay Bot", author = "shavit, ofir", description = "A replay bot for shavit's bhop timer.", version = SHAVIT_VERSION, url = "https://github.com/shavitush/bhoptimer" } public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) { CreateNative("Shavit_GetReplayBotFirstFrame", Native_GetReplayBotFirstFrame); CreateNative("Shavit_GetReplayBotIndex", Native_GetReplayBotIndex); CreateNative("Shavit_GetReplayBotCurrentFrame", Native_GetReplayBotIndex); CreateNative("Shavit_IsReplayDataLoaded", Native_IsReplayDataLoaded); // registers library, check "bool LibraryExists(const char[] name)" in order to use with other plugins RegPluginLibrary("shavit-replay"); return APLRes_Success; } public void OnPluginStart() { // game specific gEV_Type = GetEngineVersion(); gF_Tickrate = (1.0 / GetTickInterval()); // late load for(int i = 1; i <= MaxClients; i++) { if(IsValidClient(i) && !IsFakeClient(i)) { OnClientPutInServer(i); } } // plugin convars gCV_Enabled = CreateConVar("shavit_replay_enabled", "1", "Enable replay bot functionality?", 0, true, 0.0, true, 1.0); gCV_ReplayDelay = CreateConVar("shavit_replay_delay", "5.0", "Time to wait before restarting the replay after it finishes playing.", 0, true, 0.0, true, 10.0); gCV_TimeLimit = CreateConVar("shavit_replay_timelimit", "5400.0", "Maximum amount of time (in seconds) to allow saving to disk.\nDefault is 5400.0 (1:30 hours)\n0 - Disabled"); gCV_NameStyle = CreateConVar("shavit_replay_namestyle", "1", "Replay bot naming style\n0 - [SHORT STYLE]