diff --git a/gamedata/funcommands.games.txt b/gamedata/funcommands.games.txt index 4ce5acd7..6cedca34 100644 --- a/gamedata/funcommands.games.txt +++ b/gamedata/funcommands.games.txt @@ -15,6 +15,13 @@ "SoundFinal" "weapons/cguard/charging.wav" "SoundBoom" "weapons/explode3.wav" "SoundFreeze" "physics/glass/glass_impact_bullet4.wav" + + "ExternalBeaconColor" "128,128,128,255" + "Team1BeaconColor" "75,255,75,255" + "Team2BeaconColor" "255,75,75,255" + "Team3BeaconColor" "75,75,255,255" + "Team4BeaconColor" "255,128,0,255" + "TeamUnknownBeaconColor" "255,255,255,255" } } @@ -72,6 +79,9 @@ "SpriteExplosion" "sprites/floorfire4_.vmt" "SpriteGlow" "sprites/blueflare1.vmt" "SpriteHalo" "sprites/glow01.vmt" + + "Team2BeaconColor" "75,75,255,255" + "Team3BeaconColor" "255,75,75,255" } } } \ No newline at end of file diff --git a/plugins/funcommands.sp b/plugins/funcommands.sp index fa6c2053..f69d0bd2 100644 --- a/plugins/funcommands.sp +++ b/plugins/funcommands.sp @@ -67,13 +67,18 @@ int g_GlowSprite = -1; int g_ExplosionSprite = -1; // Basic color arrays for temp entities -int redColor[4] = {255, 75, 75, 255}; int orangeColor[4] = {255, 128, 0, 255}; -int greenColor[4] = {75, 255, 75, 255}; int blueColor[4] = {75, 75, 255, 255}; int whiteColor[4] = {255, 255, 255, 255}; int greyColor[4] = {128, 128, 128, 255}; +int g_ExternalBeaconColor[4]; +int g_Team1BeaconColor[4]; +int g_Team2BeaconColor[4]; +int g_Team3BeaconColor[4]; +int g_Team4BeaconColor[4]; +int g_TeamUnknownBeaconColor[4]; + // UserMessageId for Fade. UserMsg g_FadeUserMsgId; @@ -239,6 +244,36 @@ public void OnMapStart() g_HaloSprite = PrecacheModel(buffer); } + if (gameConfig.GetKeyValue("ExternalBeaconColor", buffer, sizeof(buffer)) && buffer[0]) + { + g_ExternalBeaconColor = ParseColor(buffer); + } + + if (gameConfig.GetKeyValue("Team1BeaconColor", buffer, sizeof(buffer)) && buffer[0]) + { + g_Team1BeaconColor = ParseColor(buffer); + } + + if (gameConfig.GetKeyValue("Team2BeaconColor", buffer, sizeof(buffer)) && buffer[0]) + { + g_Team2BeaconColor = ParseColor(buffer); + } + + if (gameConfig.GetKeyValue("Team3BeaconColor", buffer, sizeof(buffer)) && buffer[0]) + { + g_Team3BeaconColor = ParseColor(buffer); + } + + if (gameConfig.GetKeyValue("Team4BeaconColor", buffer, sizeof(buffer)) && buffer[0]) + { + g_Team4BeaconColor = ParseColor(buffer); + } + + if (gameConfig.GetKeyValue("TeamUnknownBeaconColor", buffer, sizeof(buffer)) && buffer[0]) + { + g_TeamUnknownBeaconColor = ParseColor(buffer); + } + delete gameConfig; } @@ -297,3 +332,17 @@ void AddTranslatedMenuItem(Menu menu, const char[] opt, const char[] phrase, int Format(buffer, sizeof(buffer), "%T", phrase, client); menu.AddItem(opt, buffer); } + +int[] ParseColor(const char[] buffer) +{ + char sColor[16][4]; + ExplodeString(buffer, ",", sColor, sizeof(sColor), sizeof(sColor[])); + + int iColor[4]; + iColor[0] = StringToInt(sColor[0]); + iColor[1] = StringToInt(sColor[1]); + iColor[2] = StringToInt(sColor[2]); + iColor[3] = StringToInt(sColor[3]); + + return iColor; +} diff --git a/plugins/funcommands/beacon.sp b/plugins/funcommands/beacon.sp index 1136b1bb..869adc32 100644 --- a/plugins/funcommands/beacon.sp +++ b/plugins/funcommands/beacon.sp @@ -85,8 +85,6 @@ public Action Timer_Beacon(Handle timer, any value) KillBeacon(client); return Plugin_Stop; } - - int team = GetClientTeam(client); float vec[3]; GetClientAbsOrigin(client, vec); @@ -94,22 +92,21 @@ public Action Timer_Beacon(Handle timer, any value) if (g_BeamSprite > -1 && g_HaloSprite > -1) { - TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0); + int teamBeaconColor[4]; + + switch (GetClientTeam(client)) + { + case 1: teamBeaconColor = g_Team1BeaconColor; + case 2: teamBeaconColor = g_Team2BeaconColor; + case 3: teamBeaconColor = g_Team3BeaconColor; + case 4: teamBeaconColor = g_Team4BeaconColor; + default: teamBeaconColor = g_TeamUnknownBeaconColor; + } + + TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, g_ExternalBeaconColor, 10, 0); TE_SendToAll(); - - if (team == 2) - { - TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, redColor, 10, 0); - } - else if (team == 3) - { - TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, blueColor, 10, 0); - } - else - { - TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, greenColor, 10, 0); - } - + + TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, teamBeaconColor, 10, 0); TE_SendToAll(); }