Fix too high values for GlowColors rainbow

This commit is contained in:
BotoX 2017-02-25 23:20:07 +01:00
parent caa37dc3fc
commit 106e04ae7e
2 changed files with 14 additions and 5 deletions

View File

@ -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<RequestFrameCallback>(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)

View File

@ -1,11 +1,10 @@
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#pragma newdecls required
public Plugin myinfo =
{
name = "Spectate",