diff --git a/addons/sourcemod/scripting/FunModes.sp b/addons/sourcemod/scripting/FunModes.sp index 2c4b569..e8ab963 100644 --- a/addons/sourcemod/scripting/FunModes.sp +++ b/addons/sourcemod/scripting/FunModes.sp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #undef REQUIRE_PLUGIN #tryinclude @@ -29,7 +29,9 @@ bool g_bIsRLGLEnabled; bool g_bRoundEnd; bool g_bEnableDetecting; bool g_bIsDoubleJumpOn; +bool g_bIsDamageGameOn; bool g_bPlugin_DynamicChannels = false; +bool g_bMotherZombie = false; #define HealBeacon_Tag "{gold}[FunModes-HealBeacon]{lightgreen}" #define BeaconMode_HealBeacon 0 @@ -51,6 +53,8 @@ bool g_bPlugin_DynamicChannels = false; #define Beacon_Sound "buttons/blip1.wav" +#define DamageGame_Tag "{gold}[FunModes-DamageGame]{lightgreen}" + /* Arraylist to save client indexes of the heal beaconed players */ ArrayList g_aHBPlayers; @@ -173,12 +177,17 @@ ConVar g_cvDoubleJumpMaxJumps; ConVar g_cvDoubleJumpHumansEnable; ConVar g_cvDoubleJumpZombiesEnable; +/* DamageGame CONVARS */ +ConVar g_cvDamageGameTimer; +ConVar g_cvDamageGameDamage; + enum ConVarType { CONVAR_TYPE_HEALBEACON = 0, CONVAR_TYPE_VIPMode = 1, CONVAR_TYPE_RLGL = 2, - CONVAR_TYPE_DOUBLEJUMP = 3 + CONVAR_TYPE_DOUBLEJUMP = 3, + CONVAR_TYPE_DAMAGEGAME = 4 }; ConVarType g_iCurrentConVarType; @@ -190,6 +199,7 @@ Handle g_hVIPBeaconTimer[MAXPLAYERS + 1] = { null, ... }; Handle g_hRLGLTimer = null; Handle g_hRLGLDetectTimer; Handle g_hRLGLWarningTime; +Handle g_hDamageGameTimer; bool g_bIsVIP[MAXPLAYERS + 1]; @@ -208,13 +218,14 @@ bool g_bEvent_PlayerSpawn; #include "Fun_Modes/RedLightGreenLight.sp" #include "Fun_Modes/DoubleJump.sp" #include "Fun_Modes/InvertedControls.sp" +#include "Fun_Modes/DamageGame.sp" public Plugin myinfo = { name = "FunModes", author = "Dolly", description = "bunch of fun modes for ze mode", - version = "1.4.8", + version = "1.4.9", url = "https://nide.gg" } @@ -235,12 +246,13 @@ public void OnPluginStart() PluginStart_RLGL(); PluginStart_DoubleJump(); PluginStart_IC(); + PluginStart_DamageGame(); AutoExecConfig(); for(int i = 1; i <= MaxClients; i++) { - if(IsValidClient(i)) + if (IsValidClient(i)) OnClientPutInServer(i); } @@ -252,8 +264,10 @@ public void OnPluginStart() } /* Events Hooks functions */ -void FunModes_HookEvent(bool &modeBool, const char[] name, EventHook callback) { - if(!modeBool) { +void FunModes_HookEvent(bool &modeBool, const char[] name, EventHook callback) +{ + if (!modeBool) + { modeBool = true; HookEvent(name, callback); } @@ -324,16 +338,30 @@ public void OnMapEnd() g_hRoundStart_Timer[1] = null; g_hDamageTimer = null; g_hHealTimer = null; + + /* DamageGame Timers */ + g_hDamageGameTimer = null; } public void OnClientPutInServer(int client) { - if(!g_bIsVIPModeOn || IsFakeClient(client) || IsClientSourceTV(client)) + if (!g_bIsDamageGameOn && !g_bIsVIPModeOn) return; + if (IsFakeClient(client)) + return; + SDKHook(client, SDKHook_OnTakeDamagePost, OnTakeDamagePost); } +void OnTakeDamagePost(int victim, int attacker, int inflictor, float damage, int damagetype) +{ + if (g_bIsVIPModeOn) + VIPMode_OnTakeDamagePost(victim, attacker); + + if (g_bIsDamageGameOn) + DamageGame_OnTakeDamagePost(victim, attacker, damage); +} /* *** EVENTS HOOKS CALLBACKS *** */ @@ -341,6 +369,7 @@ public void OnClientPutInServer(int client) void Event_RoundStart(Event event, const char[] name, bool dontBroadcast) { g_bRoundEnd = false; + g_bMotherZombie = false; RequestFrame(RoundStart_Frame); } @@ -350,6 +379,7 @@ void RoundStart_Frame() RoundStart_Fog(); RoundStart_VIPMode(); RoundStart_RLGL(); + RoundStart_DamageGame(); } void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast) @@ -358,6 +388,7 @@ void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast) PlayerDeath_HealBeacon(userid); PlayerDeath_VIPMode(userid); + PlayerDeath_DamageGame(userid); } void Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast) @@ -371,7 +402,7 @@ void Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast) void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) { - if(!g_FogData.fogEnable) + if (!g_FogData.fogEnable) return; int userid = event.GetInt("userid"); @@ -382,12 +413,15 @@ void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast) { g_bRoundEnd = true; + g_bMotherZombie = false; } public void OnClientDisconnect(int client) { ClientDisconnect_HealBeacon(client); ClientDisconnect_VIPMode(client); + ClientDisconnect_DamageGame(client); + ClientDisconnect_RLGL(client); } float GetDistanceBetween(int origin, int target) @@ -411,12 +445,12 @@ stock void BeaconPlayer(int client, int mode) GetClientAbsOrigin(client, fvec); fvec[2] += 10; - if(mode == BeaconMode_HealBeacon) + if (mode == BeaconMode_HealBeacon) { TE_SetupBeamRingPoint(fvec, (g_BeaconPlayersData[client].distance - 10.0), g_BeaconPlayersData[client].distance, g_LaserSprite, g_HaloSprite, 0, 15, 0.1, 10.0, 0.0, g_BeaconPlayersData[client].color, 10, 0); TE_SendToAll(); } - else if(mode == BeaconMode_VIP) + else if (mode == BeaconMode_VIP) { TE_SetupBeamRingPoint(fvec, 10.0, 375.0, g_LaserSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, g_ColorCyan, 10, 0); TE_SendToAll(); @@ -440,7 +474,7 @@ stock void BeaconPlayer(int client, int mode) Action Cmd_Cvars(int client, int args) { - if(!client) + if (!client) return Plugin_Handled; Menu menu = new Menu(Menu_MainCvars); @@ -450,6 +484,7 @@ Action Cmd_Cvars(int client, int args) menu.AddItem("1", "- VIP Mode Cvars"); menu.AddItem("2", "- RedLightGreenLight Cvars"); menu.AddItem("3", "- DoubleJump Cvars"); + menu.AddItem("4", "- DamageGame Cvars"); menu.ExitButton = true; menu.Display(client, MENU_TIME_FOREVER); @@ -466,27 +501,7 @@ Action Cmd_Cvars(int client, int args) } case MenuAction_Select: { - ConVarType type; - switch(param2) - { - case 0: - { - type = CONVAR_TYPE_HEALBEACON; - } - case 1: - { - type = CONVAR_TYPE_VIPMode; - } - case 2: - { - type = CONVAR_TYPE_RLGL; - } - case 3: - { - type = CONVAR_TYPE_DOUBLEJUMP; - } - } - + ConVarType type = view_as(param2); DisplayConVarsListMenu(param1, type); } } @@ -517,7 +532,7 @@ int Menu_DisplayConVars(Menu menu, MenuAction action, int param1, int param2) case MenuAction_Cancel: { - if(param2 == MenuCancel_ExitBack) + if (param2 == MenuCancel_ExitBack) Cmd_Cvars(param1, 0); } @@ -561,7 +576,7 @@ void ShowConVarInfo(int client, ConVarInfo info, ConVarType type) int valsCount; for (int i = 0; i < sizeof(info.values); i++) { - if(info.values[i] == ',') + if (info.values[i] == ',') valsCount++; } @@ -576,7 +591,7 @@ void ShowConVarInfo(int client, ConVarInfo info, ConVarType type) for (int i = 0; i < valsCount; i++) { any val = GetValFromCvar(null, info.type, dataEx[i]); - if(val == currentVal) { + if (val == currentVal) { currentValExists = true; } @@ -586,7 +601,7 @@ void ShowConVarInfo(int client, ConVarInfo info, ConVarType type) menu.AddItem(data, dataEx[i], val == currentVal ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT); } - if(!currentValExists) + if (!currentValExists) { char val[10]; info.cvar.GetString(val, sizeof(val)); @@ -606,7 +621,7 @@ int Menu_ShowConVarInfo(Menu menu, MenuAction action, int param1, int param2) case MenuAction_Cancel: { - if(param2 == MenuCancel_ExitBack) + if (param2 == MenuCancel_ExitBack) DisplayConVarsListMenu(param1, g_iCurrentConVarType); } @@ -639,35 +654,35 @@ int Menu_ShowConVarInfo(Menu menu, MenuAction action, int param1, int param2) void SetCvarVal(ConVar cvar, const char[] type, const char[] valStr) { - if(strcmp(type, "int") == 0) + if (strcmp(type, "int") == 0) cvar.IntValue = StringToInt(valStr); - else if(strcmp(type, "float") == 0) + else if (strcmp(type, "float") == 0) cvar.FloatValue = StringToFloat(valStr); - else if(strcmp(type, "bool") == 0) + else if (strcmp(type, "bool") == 0) cvar.BoolValue = view_as(StringToInt(valStr)); } any GetValFromCvar(ConVar cvar = null, const char[] type, const char[] valStr = "") { - if(strcmp(type, "int") == 0) + if (strcmp(type, "int") == 0) { - if(cvar != null) + if (cvar != null) return cvar.IntValue; else return StringToInt(valStr); } - else if(strcmp(type, "float") == 0) + else if (strcmp(type, "float") == 0) { - if(cvar != null) + if (cvar != null) return cvar.FloatValue; else return StringToFloat(valStr); } - else if(strcmp(type, "bool") == 0) + else if (strcmp(type, "bool") == 0) { - if(cvar != null) + if (cvar != null) return cvar.BoolValue; else return view_as(StringToInt(valStr)); @@ -691,6 +706,9 @@ int GetConVarInfoSize(ConVarType type) case CONVAR_TYPE_DOUBLEJUMP: return sizeof(g_cvInfoDoubleJump); + + case CONVAR_TYPE_DAMAGEGAME: + return sizeof(g_cvInfoDamageGame); } return 1; @@ -751,6 +769,19 @@ void CopyStructArray(ConVarType type, ConVarInfo[] info, int len) info[i] = infoEx; } } + + case CONVAR_TYPE_DAMAGEGAME: + { + for (int i = 0; i < len; i++) + { + ConVarInfo infoEx; + infoEx.cvar = g_cvInfoDamageGame[i].cvar; + strcopy(infoEx.values, sizeof(ConVarInfo::values), g_cvInfoDamageGame[i].values); + strcopy(infoEx.type, sizeof(ConVarInfo::type), g_cvInfoDamageGame[i].type); + + info[i] = infoEx; + } + } } } @@ -774,6 +805,10 @@ void GetTypeTitle(ConVarType type, char[] title, int maxlen) { FormatEx(title, maxlen, "DoubleJump Cvars List"); } + case CONVAR_TYPE_DAMAGEGAME: + { + FormatEx(title, maxlen, "DamageGame Cvars List"); + } } return; @@ -794,6 +829,9 @@ void GetTypeConVarsList(Menu menu, ConVarType type) case CONVAR_TYPE_DOUBLEJUMP: DisplayThisConVars(menu, g_cvInfoDoubleJump, sizeof(g_cvInfoDoubleJump), type); + + case CONVAR_TYPE_DAMAGEGAME: + DisplayThisConVars(menu, g_cvInfoDamageGame, sizeof(g_cvInfoDamageGame), type); } } @@ -858,4 +896,19 @@ stock void SendHudText(int client, const char[] sMessage, bool isFar = false, in ClearSyncHud(client, g_hHudMsg); ShowSyncHudText(client, g_hHudMsg, "%s", sMessage); } +} + +public void ZR_OnClientInfected(int client, int attacker, bool motherInfect) +{ + if (g_bIsVIPModeOn) + VIPMode_OnClientInfected(client); + + if (g_bIsRLGLEnabled && g_bEnableDetecting) + RLGL_OnClientInfected(client); + + if (g_bMotherZombie) + return; + + if (motherInfect) + g_bMotherZombie = true; } \ No newline at end of file diff --git a/addons/sourcemod/scripting/Fun_Modes/DamageGame.sp b/addons/sourcemod/scripting/Fun_Modes/DamageGame.sp new file mode 100644 index 0000000..043346e --- /dev/null +++ b/addons/sourcemod/scripting/Fun_Modes/DamageGame.sp @@ -0,0 +1,170 @@ +#pragma semicolon 1 +#pragma newdecls required + +int g_iDealtDamage[MAXPLAYERS + 1] = {-1, ...}; + +ConVarInfo g_cvInfoDamageGame[2] = +{ + {null, "15.0,20.0,30.0,40.0", "float"}, + {null, "5.0,10.0,15.0,20.0", "float"} +}; + +/* CALLED on Plugin Start */ +stock void PluginStart_DamageGame() +{ + /* ADMIN COMMANDS */ + RegAdminCmd("sm_fm_damage", Cmd_DamageGame, ADMFLAG_CONVARS, "Enable/Disable Damage Game mode."); + RegAdminCmd("sm_fm_damagegame", Cmd_DamageGame, ADMFLAG_CONVARS, "Enable/Disable Damage Game mode."); + RegAdminCmd("sm_fm_dg", Cmd_DamageGame, ADMFLAG_CONVARS, "Enable/Disable Damage Game mode."); + + /* CONVARS */ + g_cvDamageGameTimer = CreateConVar("sm_damagegame_time_interval", "15.0", "Damage Game Timer Interval"); + g_cvDamageGameDamage = CreateConVar("sm_damagegame_damage", "15.0", "The amount of damage to apply to players who don't shoot zombies"); + + DamageGame_SetCvarsInfo(); +} + +void DamageGame_SetCvarsInfo() +{ + ConVar cvars[sizeof(g_cvInfoDamageGame)]; + cvars[0] = g_cvDamageGameTimer; + cvars[1] = g_cvDamageGameDamage; + + for (int i = 0; i < sizeof(g_cvInfoDamageGame); i++) + g_cvInfoDamageGame[i].cvar = cvars[i]; +} + +Action Cmd_DamageGame(int client, int args) +{ + g_bIsDamageGameOn = !g_bIsDamageGameOn; + CPrintToChatAll("%s Damage Game is now {olive}%s.", DamageGame_Tag, (g_bIsDamageGameOn) ? "Enabled" : "Disabled"); + + if (g_bIsDamageGameOn) + { + /* Events Hooks */ + FunModes_HookEvent(g_bEvent_RoundStart, "round_start", Event_RoundStart); + FunModes_HookEvent(g_bEvent_RoundEnd, "round_end", Event_RoundEnd); + FunModes_HookEvent(g_bEvent_PlayerDeath, "player_death", Event_PlayerDeath); + + for (int i = 1; i <= MaxClients; i++) + { + if (!IsClientConnected(i)) + continue; + + OnClientPutInServer(i); + } + + DamageGame_StartTimers(); + + CPrintToChatAll("%s Humans with lowest damage dealt to zombies will get damaged every %.2f seconds!", DamageGame_Tag, g_cvDamageGameTimer.FloatValue); + } + else + { + delete g_hDamageGameTimer; + } + + return Plugin_Handled; +} + +void DamageGame_StartTimers() +{ + delete g_hDamageGameTimer; + g_hDamageGameTimer = CreateTimer(g_cvDamageGameTimer.FloatValue, Timer_DamageGame, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE); +} + +Action Timer_DamageGame(Handle timer) +{ + if (!g_bMotherZombie || g_bRoundEnd) + return Plugin_Handled; + + int lowestDamage = 999999, count, clients[MAXPLAYERS + 1]; + + for (int i = 1; i <= MaxClients; i++) + { + int thisDamage = 0; + if (g_iDealtDamage[i] < 0) + { + if (!IsClientInGame(i) || !IsPlayerAlive(i) || ZR_IsClientZombie(i)) + continue; + + g_iDealtDamage[i] = 0; + } + else + { + thisDamage = g_iDealtDamage[i]; + } + + if (thisDamage >= 0 && thisDamage < lowestDamage) + { + lowestDamage = thisDamage; + } + } + + if (lowestDamage == 999999) + return Plugin_Continue; + + for (int i = 1; i <= MaxClients; i++) + { + if (lowestDamage == g_iDealtDamage[i]) + { + clients[count] = i; + count++; + } + } + + // We got the players who dealt the lowest damage, Lets damage THEM! + for (int i = 0; i < count; i++) + { + int client = clients[i]; + int health = GetClientHealth(client); + int newHealth = health - g_cvDamageGameDamage.IntValue; + if (newHealth <= 0) + ForcePlayerSuicide(client); + else + SetEntityHealth(client, newHealth); + + CPrintToChat(client, "%s You have been damaged for being a bad defender", DamageGame_Tag); + CPrintToChatAll("%s %N {olive}got damaged for being a bad defender!", DamageGame_Tag, client); + } + + return Plugin_Continue; +} + +stock void RoundStart_DamageGame() +{ + if (!g_bIsDamageGameOn) + return; + + for (int i = 1; i <= MaxClients; i++) + g_iDealtDamage[i] = -1; + + DamageGame_StartTimers(); +} + +stock void PlayerDeath_DamageGame(int userid) +{ + if (!g_bIsDamageGameOn) + return; + + int client = GetClientOfUserId(userid); + if (!client) + return; + + g_iDealtDamage[client] = -1; +} + +stock void ClientDisconnect_DamageGame(int client) +{ + g_iDealtDamage[client] = -1; +} + +stock void DamageGame_OnTakeDamagePost(int victim, int attacker, float damage) +{ + if (!(IsPlayerAlive(victim) && ZR_IsClientZombie(victim))) + return; + + if (!(0 < attacker <= MaxClients && IsPlayerAlive(attacker) && ZR_IsClientHuman(attacker))) + return; + + g_iDealtDamage[attacker] += RoundToNearest(damage); +} \ No newline at end of file diff --git a/addons/sourcemod/scripting/Fun_Modes/RedLightGreenLight.sp b/addons/sourcemod/scripting/Fun_Modes/RedLightGreenLight.sp index feab77d..9ad44d5 100644 --- a/addons/sourcemod/scripting/Fun_Modes/RedLightGreenLight.sp +++ b/addons/sourcemod/scripting/Fun_Modes/RedLightGreenLight.sp @@ -9,7 +9,10 @@ char countDownPath[PLATFORM_MAX_PATH]; -ConVarInfo g_cvInfoRLGL[7] = { +float g_fOriginalSpeed[MAXPLAYERS + 1]; + +ConVarInfo g_cvInfoRLGL[7] = +{ {null, "0.1,0.3,0.5,0.8", "float"}, {null, "2.0,5.0,10.0,15.0", "float"}, {null, "20.0,30.0,40.0,60.0", "float"}, @@ -71,19 +74,35 @@ stock void MapStart_RLGL() { } } -stock void RoundStart_RLGL() { +stock void RoundStart_RLGL() +{ delete g_hRLGLWarningTime; delete g_hRLGLTimer; delete g_hRLGLDetectTimer; - if(g_bIsRLGLEnabled) + if (g_bIsRLGLEnabled) StartRLGLTimer(); } +stock void RLGL_OnClientInfected(int client) +{ + float speed = g_cvRLGLZombiesSpeed.FloatValue; + if (speed <= 0.0) + return; + + g_fOriginalSpeed[client] = GetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue"); + SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", speed); +} + +stock void ClientDisconnect_RLGL(int client) +{ + g_fOriginalSpeed[client] = 0.0; +} + void ApplyFade(const char[] sColor) { int color[4]; - if(StrEqual(sColor, "Red", false)) + if (strcmp(sColor, "Red", false) == 0) { color[0] = 255; color[1] = 0; @@ -100,22 +119,22 @@ void ApplyFade(const char[] sColor) int count = 0; int allHumans[MAXPLAYERS + 1]; - for(int i = 1; i <= MaxClients; i++) + for (int i = 1; i <= MaxClients; i++) { - if(!IsClientInGame(i) || IsFakeClient(i)) + if (!IsClientInGame(i) || IsFakeClient(i)) continue; allHumans[count] = i; count++; } - if(count == 0) + if (count == 0) return; int flags = (FFADE_OUT); Handle message = StartMessage("Fade", allHumans, count, 1); - if(GetUserMessageType() == UM_Protobuf) + if (GetUserMessageType() == UM_Protobuf) { Protobuf pb = UserMessageToProtobuf(message); pb.SetInt("duration", 500); @@ -146,7 +165,7 @@ Action Cmd_RLGL(int client, int args) delete g_hRLGLTimer; delete g_hRLGLDetectTimer; - if(g_bIsRLGLEnabled) + if (g_bIsRLGLEnabled) { FunModes_HookEvent(g_bEvent_RoundStart, "round_start", Event_RoundStart); StartRLGLTimer(); @@ -157,7 +176,7 @@ Action Cmd_RLGL(int client, int args) Action RLGL_Timer(Handle timer) { - if(!g_bIsRLGLEnabled) + if (!g_bIsRLGLEnabled) return Plugin_Stop; g_hRLGLWarningTime = CreateTimer(1.0, RLGL_Warning_Timer, _, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT); @@ -185,25 +204,25 @@ Action RLGL_Warning_Timer(Handle timer) bool playSnd = FileExists(sndPath2); sndPath2[0] = '\0'; - for(int i = 1; i <= MaxClients; i++) + for (int i = 1; i <= MaxClients; i++) { - if(!IsClientInGame(i)) + if (!IsClientInGame(i)) continue; SendHudText(i, sMessage, _, 0); - if(playSnd) { + if (playSnd) { EmitSoundToClient(i, sndPath); } } timePassed++; - if(timePassed > g_cvRLGLWarningTime.IntValue) + if (timePassed > g_cvRLGLWarningTime.IntValue) { ApplyFade("Red"); g_bEnableDetecting = true; float speed = g_cvRLGLZombiesSpeed.FloatValue; - if(speed > 0.0) { + if (speed > 0.0) { SetZombiesSpeed(speed); } @@ -222,7 +241,7 @@ Action RLGL_Warning_Timer(Handle timer) Action RLGL_Detect_Timer(Handle timer) { - if(!g_bIsRLGLEnabled || !g_bEnableDetecting) + if (!g_bIsRLGLEnabled || !g_bEnableDetecting) { g_hRLGLDetectTimer = null; return Plugin_Stop; @@ -230,17 +249,17 @@ Action RLGL_Detect_Timer(Handle timer) char sMessage[256]; FormatEx(sMessage, sizeof(sMessage), "STOP MOVING ITS A RED LIGHT!!!"); - for(int i = 1; i <= MaxClients; i++) + for (int i = 1; i <= MaxClients; i++) { - if(!IsClientInGame(i) || !IsPlayerAlive(i) || GetClientTeam(i) != CS_TEAM_CT) + if (!IsClientInGame(i) || !IsPlayerAlive(i) || GetClientTeam(i) != CS_TEAM_CT) continue; MoveType moveType = GetEntityMoveType(i); - if(moveType == MOVETYPE_NOCLIP || moveType == MOVETYPE_NONE) + if (moveType == MOVETYPE_NOCLIP || moveType == MOVETYPE_NONE) continue; int buttons = GetClientButtons(i); - if(buttons & (IN_WALK | IN_BACK | IN_FORWARD | IN_RIGHT | IN_LEFT | IN_JUMP)) + if (buttons & (IN_WALK | IN_BACK | IN_FORWARD | IN_RIGHT | IN_LEFT | IN_JUMP)) { SDKHooks_TakeDamage(i, 0, 0, g_cvRLGLDamage.FloatValue); SendHudText(i, sMessage, _, 1); @@ -262,9 +281,9 @@ Action RLGL_Detect_Time_Timer(Handle timer) char sMessage[256]; FormatEx(sMessage, sizeof(sMessage), "YOU CAN MOVE NOW, ITS A GREEN LIGHT!"); - for(int i = 1; i <= MaxClients; i++) + for (int i = 1; i <= MaxClients; i++) { - if(!IsClientInGame(i) || !IsPlayerAlive(i) || GetClientTeam(i) != CS_TEAM_CT) + if (!IsClientInGame(i) || !IsPlayerAlive(i) || GetClientTeam(i) != CS_TEAM_CT) continue; SendHudText(i, sMessage, _, 2); @@ -276,10 +295,18 @@ Action RLGL_Detect_Time_Timer(Handle timer) stock void SetZombiesSpeed(float val) { for (int i = 1; i <= MaxClients; i++) { - if(!IsClientInGame(i) || !IsPlayerAlive(i) || GetClientTeam(i) != CS_TEAM_T) + if (!IsClientInGame(i) || !IsPlayerAlive(i) || GetClientTeam(i) != CS_TEAM_T) continue; - - SetEntPropFloat(i, Prop_Data, "m_flLaggedMovementValue", val); + + g_fOriginalSpeed[i] = (val == 1.0) ? 0.0 : GetEntPropFloat(i, Prop_Data, "m_flLaggedMovementValue"); + float thisVal = (val == 1.0) ? g_fOriginalSpeed[i] : val; + + if (thisVal == 0.0) + thisVal = 1.0; + + SetEntPropFloat(i, Prop_Data, "m_flLaggedMovementValue", thisVal); + CPrintToChat(i, RLGL_Tag ... " Your speed has been changed to {olive}%.2f", thisVal); + CPrintToChat(i, RLGL_Tag ... " This is a part of {olive}Red Light Green Light.{white} An admin decided to have this kicker."); } } @@ -288,7 +315,7 @@ stock void StartRLGLTimer() float time = 10.0; float timeMax = g_cvRLGLDetectTimerRepeatMax.FloatValue; float timeMin = g_cvRLGLDetectTimerRepeatMin.FloatValue; - if(timeMax <= 0.0) + if (timeMax <= 0.0) time = timeMin; else time = GetRandomFloat(timeMin, timeMax); diff --git a/addons/sourcemod/scripting/Fun_Modes/VIPMode.sp b/addons/sourcemod/scripting/Fun_Modes/VIPMode.sp index 47d8fc3..3be761f 100644 --- a/addons/sourcemod/scripting/Fun_Modes/VIPMode.sp +++ b/addons/sourcemod/scripting/Fun_Modes/VIPMode.sp @@ -37,14 +37,13 @@ void VIPMode_SetCvarsInfo() g_cvInfoVIP[i].cvar = cvars[i]; } -public void OnTakeDamagePost(int victim, int attacker, int inflictor, float damage, int damagetype) +stock void VIPMode_OnTakeDamagePost(int victim, int attacker) { - if(!g_bIsVIPModeOn || !g_cvVIPModeLaser.BoolValue) + if(!g_cvVIPModeLaser.BoolValue) return; - if(!g_bIsVIP[victim]) { + if(!g_bIsVIP[victim]) return; - } if(!IsValidEntity(attacker)) return; @@ -85,9 +84,9 @@ public void OnTakeDamagePost(int victim, int attacker, int inflictor, float dama return; } -public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn) +stock void VIPMode_OnClientInfected(int client) { - if(!g_bIsVIPModeOn || !g_cvVIPModeLaser.BoolValue) + if(!g_cvVIPModeLaser.BoolValue) return; if(!g_bIsVIP[client]) diff --git a/sourceknight.yaml b/sourceknight.yaml index 327d919..0e6f9f7 100644 --- a/sourceknight.yaml +++ b/sourceknight.yaml @@ -24,6 +24,13 @@ project: - source: /scripting/include dest: /addons/sourcemod/scripting/include + - name: zombiereloaded + type: git + repo: https://github.com/srcdslab/sm-plugin-zombiereloaded + unpack: + - source: /src/addons/sourcemod/scripting/include + dest: /addons/sourcemod/scripting/include + root: / output: /addons/sourcemod/plugins targets: