projects-jenz/set_tickrate_nextmap/scripting/set_tickrate_for_nextmap.sp
2025-07-27 02:38:30 +02:00

47 lines
1.2 KiB
SourcePawn

#pragma semicolon 1
#define PLUGIN_AUTHOR "jenz"
#define PLUGIN_VERSION "1.0"
#include <sourcemod>
#include <mapchooser_extended>
//https://github.com/Mikusch/SM-TickrateChanger/tree/main
public Plugin myinfo =
{
name = "tickrate_command_caller",
author = PLUGIN_AUTHOR,
description = "set tickrate based on what nextmap is",
version = PLUGIN_VERSION,
url = "www.unloze.com"
};
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnMapVoteEnd(const char[] map)
{
new Handle:fileHandle = OpenFile("maps_66_tick.txt", "r" );
char lineBuffer[256];
bool changeTick = false;
while(!IsEndOfFile(fileHandle) && ReadFileLine(fileHandle, lineBuffer, sizeof(lineBuffer)))
{
TrimString(lineBuffer);
if (StrEqual(map, lineBuffer, false))
{
changeTick = true;
break;
}
}
CloseHandle(fileHandle);
if (changeTick)
{
ServerCommand("sm_tickrate 66");
}
else
{
ServerCommand("sm_tickrate 100");
}
}