This commit is contained in:
neon 2019-02-27 16:37:28 +01:00
parent ee09b14f28
commit d1360f717e

View File

@ -9,9 +9,6 @@
/* CONVARS */ /* CONVARS */
ConVar g_hCVar_Delay; ConVar g_hCVar_Delay;
Handle g_hTriggerTimer = INVALID_HANDLE;
Handle g_hTriggerResetTimer = INVALID_HANDLE;
/* BOOLS */ /* BOOLS */
bool g_bZMwasKnifed[MAXPLAYERS+1]; bool g_bZMwasKnifed[MAXPLAYERS+1];
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -22,7 +19,7 @@ public Plugin myinfo =
name = "UNLOZE Knife Madness", name = "UNLOZE Knife Madness",
author = "Neon", author = "Neon",
description = "UNLOZE Knife Madness", description = "UNLOZE Knife Madness",
version = "1.0", version = "1.1",
url = "https://steamcommunity.com/id/n3ontm" url = "https://steamcommunity.com/id/n3ontm"
}; };
@ -35,8 +32,6 @@ public void OnPluginStart()
HookEvent("player_spawn", OnClientSpawn); HookEvent("player_spawn", OnClientSpawn);
HookEvent("player_hurt", OnClientHurt); HookEvent("player_hurt", OnClientHurt);
HookEvent("round_start", OnRoundStart);
HookEvent("round_end", OnRoundEnd);
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -81,182 +76,6 @@ public void OnClientHurt(Event hEvent, const char[] sEvent, bool bDontBroadcast)
pack.WriteCell(GetClientUserId(victim)); pack.WriteCell(GetClientUserId(victim));
} }
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
g_hTriggerTimer = CreateTimer(GetRandomFloat(12.0, 50.0), SpecialTrigger, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
if (g_hTriggerTimer != INVALID_HANDLE && CloseHandle(g_hTriggerTimer))
g_hTriggerTimer = INVALID_HANDLE;
if (g_hTriggerResetTimer != INVALID_HANDLE && CloseHandle(g_hTriggerResetTimer))
g_hTriggerResetTimer = INVALID_HANDLE;
ResetTriggers();
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action SpecialTrigger(Handle timer)
{
g_hTriggerTimer = CreateTimer(GetRandomFloat(15.0, 45.0), SpecialTrigger, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
EmitGameSoundToAll("Bot.Stuck1");
int iRandom = GetRandomInt(0, 8);
if (iRandom == 0)
{
ServerCommand("sv_gravity 300");
CPrintToChatAll("{unique}[Knife Madness] {white}Low gravity activated!");
}
else if (iRandom == 1)
{
for (int client = 1; client <= MaxClients; client++)
{
if (IsValidClient(client, false) && IsPlayerAlive(client))
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 3.0);
}
CPrintToChatAll("{unique}[Knife Madness] {white}Speed activated!");
}
if (iRandom == 2)
{
ServerCommand("sm plugins load disabled/autobhop");
CPrintToChatAll("{unique}[Knife Madness] {white}Auto-Bhop activated!");
}
if (iRandom == 3)
{
for (int client = 1; client <= MaxClients; client++)
{
if (IsValidClient(client, false) && IsPlayerAlive(client))
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", GetRandomFloat(0.2, 5.0));
}
CPrintToChatAll("{unique}[Knife Madness] {white}Random speed for everyone!");
}
if (iRandom == 4)
{
ServerCommand("sv_friction 0.1");
CPrintToChatAll("{unique}[Knife Madness] {white}Slippery ground!");
}
if (iRandom == 5)
{
ServerCommand("sv_accelerate -5");
ServerCommand("sv_airaccelerate -1");
CPrintToChatAll("{unique}[Knife Madness] {white}Inverted controls!");
}
if (iRandom == 6)
{
CPrintToChatAll("{unique}[Knife Madness] {white}Seems like we chillin...");
}
if (iRandom == 7)
{
for (int client = 1; client <= MaxClients; client++)
{
if (!(IsValidClient(client, false) && IsPlayerAlive(client)))
continue;
for(int j = 0; j < 5; j++)
{
int w = -1;
while ((w = GetPlayerWeaponSlot(client, j)) != -1)
{
if(IsValidEntity(w) && IsValidEdict(w))
{
RemovePlayerItem(client, w);
AcceptEntityInput(w, "Kill");
}
}
}
}
CPrintToChatAll("{unique}[Knife Madness] {white}Time for a break...");
}
if (iRandom == 8)
{
iRandom = GetRandomInt(0, 1);
if (iRandom == 0)
CPrintToChatAll("{unique}[Knife Madness] {white}Zombies lost their knives...");
else if (iRandom == 1)
CPrintToChatAll("{unique}[Knife Madness] {white}Humans lost their knives...");
for (int client = 1; client <= MaxClients; client++)
{
if (!(IsValidClient(client, false) && IsPlayerAlive(client)))
continue;
if (iRandom == 0)
{
if (ZR_IsClientHuman(client))
continue;
}
else if (iRandom == 1)
{
if (ZR_IsClientZombie(client))
continue;
}
for(int j = 0; j < 5; j++)
{
int w = -1;
while ((w = GetPlayerWeaponSlot(client, j)) != -1)
{
if(IsValidEntity(w) && IsValidEdict(w))
{
RemovePlayerItem(client, w);
AcceptEntityInput(w, "Kill");
}
}
}
}
}
g_hTriggerResetTimer = CreateTimer(10.0, ResetTriggerTimer, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action ResetTriggerTimer(Handle timer)
{
g_hTriggerResetTimer = INVALID_HANDLE;
EmitGameSoundToAll("Bot.Stuck2");
ResetTriggers();
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void ResetTriggers()
{
for (int client = 1; client <= MaxClients; client++)
{
if (IsValidClient(client, false) && IsPlayerAlive(client))
{
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
int w = -1;
w = GetPlayerWeaponSlot(client, 2);
if(!(IsValidEntity(w) && IsValidEdict(w)))
GivePlayerItem(client, "weapon_knife");
}
}
ServerCommand("sm plugins unload disabled/autobhop");
ServerCommand("sv_accelerate 5");
ServerCommand("sv_airaccelerate 10");
ServerCommand("sv_friction 4");
ServerCommand("sv_gravity 800");
}
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose: