/* * 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 #include #define REPLAY_FORMAT_V2 "{SHAVITREPLAYFORMAT}{V2}" #pragma semicolon 1 #pragma dynamic 131072 #pragma newdecls required // game type EngineVersion gEV_Type = Engine_Unknown; // cache int gI_ReplayTick[STYLE_LIMIT]; int gI_ReplayBotClient[STYLE_LIMIT]; ArrayList gA_Frames[STYLE_LIMIT] = {null, ...}; float gF_StartTick[STYLE_LIMIT]; ReplayStatus gRS_ReplayStatus[STYLE_LIMIT]; int gI_FrameCount[STYLE_LIMIT]; int gI_PlayerFrames[MAXPLAYERS+1]; ArrayList gA_PlayerFrames[MAXPLAYERS+1]; bool gB_Record[MAXPLAYERS+1]; bool gB_Late = false; int gI_DefaultTeamSlots = 0; // 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; ConVar gCV_DefaultTeam = null; // cached cvars bool gB_Enabled = true; float gF_ReplayDelay = 5.0; float gF_TimeLimit = 5400.0; int gI_NameStyle = 1; int gI_DefaultTeam = 3; // timer settings int gI_Styles = 0; char gS_StyleStrings[STYLE_LIMIT][STYLESTRINGS_SIZE][128]; any gA_StyleSettings[STYLE_LIMIT][STYLESETTINGS_SIZE]; // chat settings char gS_ChatStrings[CHATSETTINGS_SIZE][128]; public Plugin myinfo = { name = "[shavit] Replay Bot", author = "shavit", 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"); gB_Late = late; return APLRes_Success; } public void OnPluginStart() { LoadTranslations("shavit-replay.phrases"); // 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]