From 106e04ae7ef2680140fa5a365a38d394d78aa0bd Mon Sep 17 00:00:00 2001 From: BotoX Date: Sat, 25 Feb 2017 23:20:07 +0100 Subject: [PATCH] Fix too high values for GlowColors rainbow --- GlowColors/scripting/GlowColors.sp | 16 +++++++++++++--- Spectate/scripting/Spectate.sp | 3 +-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/GlowColors/scripting/GlowColors.sp b/GlowColors/scripting/GlowColors.sp index da459560..d48f8caa 100644 --- a/GlowColors/scripting/GlowColors.sp +++ b/GlowColors/scripting/GlowColors.sp @@ -48,8 +48,8 @@ public void OnPluginStart() RegAdminCmd("sm_rainbow", Command_Rainbow, ADMFLAG_CUSTOM1, "Enable rainbow glowcolors. sm_rainbow [frequency]"); - HookEvent("player_spawn", Event_ApplyGlowcolor, EventHookMode_Post); - HookEvent("player_team", Event_ApplyGlowcolor, EventHookMode_Post); + HookEvent("player_spawn", Event_ApplyGlowColor, EventHookMode_Post); + HookEvent("player_team", Event_ApplyGlowColor, EventHookMode_Post); g_Cvar_MinBrightness = CreateConVar("sm_glowcolor_minbrightness", "100", "Lowest brightness value for glowcolor.", 0, true, 0.0, true, 255.0); @@ -267,6 +267,8 @@ public Action Command_Rainbow(int client, int args) char sArg[32]; GetCmdArg(1, sArg, sizeof(sArg)); Frequency = StringToFloat(sArg); + if(Frequency > 100.0) + Frequency = 100.0; } if(!Frequency || (args < 1 && g_aRainbowFrequency[client])) @@ -315,13 +317,21 @@ public int MenuHandler_GlowColorsMenu(Menu menu, MenuAction action, int param1, } } -public void Event_ApplyGlowcolor(Event event, const char[] name, bool dontBroadcast) +public void Event_ApplyGlowColor(Event event, const char[] name, bool dontBroadcast) { int client = GetClientOfUserId(GetEventInt(event, "userid")); if(!client) return; RequestFrame(view_as(ApplyGlowColor), client); + CreateTimer(5.0, Timer_ApplyGlowColor, GetClientSerial(client), TIMER_FLAG_NO_MAPCHANGE); +} + +public Action Timer_ApplyGlowColor(Handle timer, int serial) +{ + int client = GetClientFromSerial(serial); + if(client) + ApplyGlowColor(client); } public int ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn) diff --git a/Spectate/scripting/Spectate.sp b/Spectate/scripting/Spectate.sp index da82a7b3..264468ce 100644 --- a/Spectate/scripting/Spectate.sp +++ b/Spectate/scripting/Spectate.sp @@ -1,11 +1,10 @@ #pragma semicolon 1 +#pragma newdecls required #include #include #include -#pragma newdecls required - public Plugin myinfo = { name = "Spectate",