forked from UNLOZE/sm-plugins
AntiLagSwitch & DamageProxy :D
This commit is contained in:
@@ -17,6 +17,8 @@ public Plugin myinfo =
|
||||
Handle g_hProcessUsercmds;
|
||||
Handle g_hRunNullCommand;
|
||||
|
||||
int g_LastProcessed[MAXPLAYERS + 1];
|
||||
|
||||
public void OnPluginStart()
|
||||
{
|
||||
Handle hGameConf = LoadGameConfigFile("AntiLagSwitch.games");
|
||||
@@ -59,11 +61,29 @@ public void OnPluginStart()
|
||||
public void OnClientPutInServer(int client)
|
||||
{
|
||||
DHookEntity(g_hProcessUsercmds, true, client);
|
||||
g_LastProcessed[client] = GetGameTickCount();
|
||||
}
|
||||
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
g_LastProcessed[client] = 0;
|
||||
}
|
||||
|
||||
public void OnGameFrame()
|
||||
{
|
||||
int minimum = GetGameTickCount() - 33;
|
||||
for(int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if(IsClientInGame(client) && (IsFakeClient(client) || g_LastProcessed[client] < minimum))
|
||||
{
|
||||
RunNullCommand(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MRESReturn Hook_ProcessUsercmds(int client, Handle hParams)
|
||||
{
|
||||
|
||||
g_LastProcessed[client] = GetGameTickCount();
|
||||
}
|
||||
|
||||
int RunNullCommand(int client)
|
||||
|
||||
Reference in New Issue
Block a user