Raised This Month: $32 Target: $400
 8% 

[L4D2] Health Glows


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Captain Stubin
Member
Join Date: Jun 2017
Old 12-13-2018 , 04:55   [L4D2] Health Glows
Reply With Quote #1

Hello when i am compile a file healthglow.sp the following errors appear. How to fix them ?

source healthy glow.sp :

PHP Code:
/**
 * =============================================================================
 * L4D Health Glow (C)2011 Buster "Mr. Zero" Nielsen
 * =============================================================================
 *
 * This program is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU General Public License, version 3.0, as 
 * published by the Free Software Foundation.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along 
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * As a special exception, AlliedModders LLC gives you permission to link the
 * code of this program (as well as its derivative works) to "Half-Life 2,"
 * the "Source Engine," the "SourcePawn JIT," and any Game MODs that run on 
 * software by the Valve Corporation.  You must obey the GNU General Public
 * License in all respects for all other code used.  Additionally, 
 * AlliedModders LLC grants this exception to all derivative works.  
 * AlliedModders LLC defines further exceptions, found in LICENSE.txt 
 * (as of this writing, version JULY-31-2007), or 
 * <http://www.sourcemod.net/license.php>.
 */

/*
 * ==================================================
 *                    Preprocessor
 * ==================================================
 */

#define GLOW_HEALTH_HIGH 100 // Not used but just for completeness sake
#define GLOW_HEALTH_MED 40
#define GLOW_HEALTH_LOW 25

/*
 * L4D2_IsSurvivorGlowDisabled is used to "detect" whether realism mode is active.
 * As in no survivor glows in realism, means "less health glows" by this plugin.
 *
 * Minimum range ensures that glows are not shown when survivors are inside each other.
 * Also hides the players own glow from themself when in third person shoulder mode.
 */

#define GLOW_HEALTH_HIGH_TYPE L4D2_IsSurvivorGlowDisabled() ? L4D2Glow_None : L4D2Glow_OnUse
#define GLOW_HEALTH_HIGH_RANGE 64
#define GLOW_HEALTH_HIGH_MINRANGE 22
#define GLOW_HEALTH_HIGH_COLOR_R 0
#define GLOW_HEALTH_HIGH_COLOR_G 100
#define GLOW_HEALTH_HIGH_COLOR_B 0
#define GLOW_HEALTH_HIGH_FLASHING false

#define GLOW_HEALTH_MED_TYPE L4D2Glow_OnUse
#define GLOW_HEALTH_MED_RANGE L4D2_IsSurvivorGlowDisabled() ? 64 : 80
#define GLOW_HEALTH_MED_MINRANGE 22
#define GLOW_HEALTH_MED_COLOR_R 95
#define GLOW_HEALTH_MED_COLOR_G 95
#define GLOW_HEALTH_MED_COLOR_B 0
#define GLOW_HEALTH_MED_FLASHING false

#define GLOW_HEALTH_LOW_TYPE L4D2Glow_OnUse
#define GLOW_HEALTH_LOW_RANGE L4D2_IsSurvivorGlowDisabled() ? 64 : 96
#define GLOW_HEALTH_LOW_MINRANGE 22
#define GLOW_HEALTH_LOW_COLOR_R 135
#define GLOW_HEALTH_LOW_COLOR_G 0
#define GLOW_HEALTH_LOW_COLOR_B 0
#define GLOW_HEALTH_LOW_FLASHING false

#define GLOW_HEALTH_THIRDSTRIKE_TYPE L4D2_IsSurvivorGlowDisabled() ? L4D2Glow_OnUse : L4D2Glow_Constant
#define GLOW_HEALTH_THIRDSTRIKE_RANGE L4D2_IsSurvivorGlowDisabled() ? 96 : 0
#define GLOW_HEALTH_THIRDSTRIKE_MINRANGE 22
#define GLOW_HEALTH_THIRDSTRIKE_COLOR_R 100
#define GLOW_HEALTH_THIRDSTRIKE_COLOR_G 100
#define GLOW_HEALTH_THIRDSTRIKE_COLOR_B 100
#define GLOW_HEALTH_THIRDSTRIKE_FLASHING false

/*
 * ==================================================
 *                     Variables
 * ==================================================
 */

/*
 * --------------------
 *       Private
 * --------------------
 */

static          bool:   g_bIsGlowing[MAXPLAYERS 1];
static          
bool:   g_bIsIT[MAXPLAYERS 1];

static                  
g_iMaxIncaps 2;
static          
bool:   g_bIsGlowDisabled false;

static          
bool:   g_bIsPluginEnding false;

/*
 * ==================================================
 *                     Forwards
 * ==================================================
 */

/**
 * Called on plugin start.
 *
 * @noreturn
 */
public _HealthGlow_OnPluginStart()
{
    
HookConVarChange(FindConVar("survivor_max_incapacitated_count"), _HG_OnIncapMax_ConVarChange);
    
HookConVarChange(FindConVar("sv_disable_glow_survivors"), _HG_OnGlowDisable_ConVarChange);

    
/* SI grab events */
    
HookEvent("pounce_end"_HG_UpdateGlow_Victim_Event);
    
HookEvent("tongue_release"_HG_UpdateGlow_Victim_Event);
    
HookEvent("jockey_ride_end"_HG_UpdateGlow_Victim_Event);
    
HookEvent("charger_carry_end"_HG_UpdateGlow_Victim_Event);
    
HookEvent("charger_pummel_end"_HG_UpdateGlow_Victim_Event);

    
HookEvent("lunge_pounce"_HG_UpdateGlow_Victim_Event);
    
HookEvent("tongue_grab"_HG_UpdateGlow_Victim_Event);
    
HookEvent("jockey_ride"_HG_UpdateGlow_Victim_Event);
    
HookEvent("charger_carry_start"_HG_UpdateGlow_Victim_Event);
    
HookEvent("charger_pummel_start"_HG_UpdateGlow_Victim_Event);

    
/* SI Boomer events */
    
HookEvent("player_now_it"_HG_UpdateGlow_NowIT_Event);
    
HookEvent("player_no_longer_it"_HG_UpdateGlow_NoLongerIt_Event);

    
/* Survivor related events */
    
HookEvent("revive_success"_HG_UpdateGlow_Subject_Event);
    
HookEvent("heal_success"_HG_UpdateGlow_Subject_Event);
    
HookEvent("player_incapacitated_start"_HG_UpdateGlow_UserId_Event);
    
HookEvent("player_ledge_grab"_HG_UpdateGlow_UserId_Event);
    
HookEvent("player_death"_HG_UpdateGlow_UserId_Event);
    
HookEvent("defibrillator_used"_HG_UpdateGlow_Subject_Event);
    
HookEvent("player_hurt"_HG_UpdateGlow_UserId_Event);

    
HookEvent("player_bot_replace"_HG_BotReplacePlayer_Event);
    
HookEvent("bot_player_replace"_HG_PlayerReplaceBot_Event);
}

/**
 * Called on plugin end.
 *
 * @noreturn
 */
public _HealthGlow_OnPluginEnd()
{
    
g_bIsPluginEnding true;

    
FOR_EACH_SURVIVOR(client)
    {
        
L4D2_RemoveEntGlow(client);
    }
}

public 
_HG_OnAllPluginsLoaded()
{
    
g_iMaxIncaps GetConVarInt(FindConVar("survivor_max_incapacitated_count"));
    
g_bIsGlowDisabled GetConVarBool(FindConVar("sv_disable_glow_survivors"));

    
FOR_EACH_SURVIVOR(client)
    {
        
UpdateSurvivorHealthGlow(client);
    }

    
/* For people using admin cheats and other stuff that changes survivor 
     * health */
    
CreateTimer(5.0_HG_UpdateGlows_Timer_TIMER_REPEAT);
}

public 
_HG_OnIncapMax_ConVarChange(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
g_iMaxIncaps GetConVarInt(convar);
}

public 
_HG_OnGlowDisable_ConVarChange(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
g_bIsGlowDisabled GetConVarBool(convar);
}

public 
Action:_HG_UpdateGlows_Timer(Handle:timer)
{
    if (
g_bIsPluginEnding) return Plugin_Stop;

    
FOR_EACH_SURVIVOR(client)
    {
        
UpdateSurvivorHealthGlow(client);
    }

    return 
Plugin_Continue;
}

public 
_HG_UpdateGlow_UserId_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (
client <= || !IsClientInGame(client) || L4DTeam:GetClientTeam(client) != L4DTeam_Survivor) return;
    
UpdateSurvivorHealthGlow(client);
}

public 
_HG_UpdateGlow_Subject_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"subject"));
    if (
client <= || !IsClientInGame(client) || L4DTeam:GetClientTeam(client) != L4DTeam_Survivor) return;
    
UpdateSurvivorHealthGlow(client);
}

public 
_HG_UpdateGlow_Victim_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"victim"));
    if (
client <= || !IsClientInGame(client) || L4DTeam:GetClientTeam(client) != L4DTeam_Survivor) return;
    
UpdateSurvivorHealthGlow(client);
}

public 
_HG_UpdateGlow_NowIT_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (
client <= || !IsClientInGame(client) || L4DTeam:GetClientTeam(client) != L4DTeam_Survivor) return;
    
g_bIsIT[client] = true;
    
UpdateSurvivorHealthGlow(client);
}

public 
_HG_UpdateGlow_NoLongerIt_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (
client <= || !IsClientInGame(client) || L4DTeam:GetClientTeam(client) != L4DTeam_Survivor) return;
    
g_bIsIT[client] = false;
    
UpdateSurvivorHealthGlow(client);
}

/**
 * Called when player replace bot event is fired.
 *
 * @param event         Handle to event.
 * @param name          String containing the name of the event.
 * @param dontBroadcast True if event was not broadcast to clients, false otherwise.
 * @noreturn
 */
public _HG_PlayerReplaceBot_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"player"));
    if (!
client || L4DTeam:GetClientTeam(client) != L4DTeam_Survivor) return;

    new 
bot GetClientOfUserId(GetEventInt(event"bot"));

    
UpdateSurvivorHealthGlow(client);
    
UpdateSurvivorHealthGlow(bot);
}

/**
 * Called when bot replace player event is fired.
 *
 * @param event         Handle to event.
 * @param name          String containing the name of the event.
 * @param dontBroadcast True if event was not broadcast to clients, false otherwise.
 * @noreturn
 */
public _HG_BotReplacePlayer_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"player"));
    if (!
client || L4DTeam:GetClientTeam(client) != L4DTeam_Survivor) return;

    new 
bot GetClientOfUserId(GetEventInt(event"bot"));

    
UpdateSurvivorHealthGlow(client);
    
UpdateSurvivorHealthGlow(bot);
}

/*
 * ==================================================
 *                     Public API
 * ==================================================
 */

stock UpdateSurvivorHealthGlow(client)
{
    if (
g_bIsPluginEnding || !client || !IsClientInGame(client)) return;

    if (
L4DTeam:GetClientTeam(client) != L4DTeam_Survivor || // If client isn't survivor
        
!IsPlayerAlive(client) ||                            // or isn't alive
        
L4D_IsPlayerIncapacitated(client) ||                 // or incapacitated
        
L4D2_GetInfectedAttacker(client) > ||              // or infected player is pining survivor
        
g_bIsIT[client] ||                                   // or is IT (boomer vomit)
        
!L4D2_IsPlayerSurvivorGlowEnable(client))            // or survivor glow is disabled on JUST this player
    
{
        if (
g_bIsGlowing[client])
        {
            
g_bIsGlowing[client] = false;
            
L4D2_RemoveEntGlow(client);
        }
        return;
    }

    new 
health GetClientHealth(client);
    new 
bool:lastLife L4D_GetPlayerReviveCount(client) >= L4D_GetMaxReviveCount();

    new 
L4D2GlowType:type;
    new 
color[3];
    new 
range;
    new 
minRange;
    new 
bool:flashing;
    
GetHealthGlowForClient(healthlastLifetyperangeminRangecolorflashing);

    
L4D2_SetEntGlow(clienttyperangeminRangecolorflashing);
    
g_bIsGlowing[client] = true;
}

/*
 * ==================================================
 *                    Private API
 * ==================================================
 */

static GetHealthGlowForClient(healthbool:lastLife, &L4D2GlowType:type, &range, &minRangecolor[3], &bool:flashing)
{
    if (
lastLife)
    {
        
type GLOW_HEALTH_THIRDSTRIKE_TYPE;
        
range GLOW_HEALTH_THIRDSTRIKE_RANGE;
        
minRange GLOW_HEALTH_THIRDSTRIKE_MINRANGE;
        
color = {GLOW_HEALTH_THIRDSTRIKE_COLOR_RGLOW_HEALTH_THIRDSTRIKE_COLOR_GGLOW_HEALTH_THIRDSTRIKE_COLOR_B};
        
flashing GLOW_HEALTH_THIRDSTRIKE_FLASHING;
        return;
    }

    if (
health <= GLOW_HEALTH_LOW)
    {
        
type GLOW_HEALTH_LOW_TYPE;
        
range GLOW_HEALTH_LOW_RANGE;
        
minRange GLOW_HEALTH_LOW_MINRANGE;
        
color = {GLOW_HEALTH_LOW_COLOR_RGLOW_HEALTH_LOW_COLOR_GGLOW_HEALTH_LOW_COLOR_B};
        
flashing GLOW_HEALTH_MED_FLASHING;
    }
    else if (
health <= GLOW_HEALTH_MED)
    {
        
type GLOW_HEALTH_MED_TYPE;
        
range GLOW_HEALTH_MED_RANGE;
        
minRange GLOW_HEALTH_MED_MINRANGE;
        
color = {GLOW_HEALTH_MED_COLOR_RGLOW_HEALTH_MED_COLOR_GGLOW_HEALTH_MED_COLOR_B};
        
flashing GLOW_HEALTH_MED_FLASHING;
    }
    else
    {
        
type GLOW_HEALTH_HIGH_TYPE;
        
range GLOW_HEALTH_HIGH_RANGE;
        
minRange GLOW_HEALTH_HIGH_MINRANGE;
        
color = {GLOW_HEALTH_HIGH_COLOR_RGLOW_HEALTH_HIGH_COLOR_GGLOW_HEALTH_HIGH_COLOR_B};
        
flashing GLOW_HEALTH_HIGH_FLASHING;
    }
}

static 
L4D_GetMaxReviveCount()
{
    return 
g_iMaxIncaps;
}

static 
bool:L4D2_IsSurvivorGlowDisabled()
{
    return 
g_bIsGlowDisabled;

Captain Stubin is offline
Captain Stubin
Member
Join Date: Jun 2017
Old 12-13-2018 , 04:56   Re: [L4D2] Health Glows
Reply With Quote #2

Errors
PHP Code:
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(154) : error 017undefined symbol "FOR_EACH_SURVIVOR"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(156) : error 017undefined symbol "L4D2_RemoveEntGlow"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(165) : error 017undefined symbol "FOR_EACH_SURVIVOR"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(167) : error 017undefined symbol "client"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(189) : error 017undefined symbol "FOR_EACH_SURVIVOR"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(191) : error 017undefined symbol "client"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(200) : error 017undefined symbol "L4DTeam_Survivor"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(207) : error 017undefined symbol "L4DTeam_Survivor"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(214) : error 017undefined symbol "L4DTeam_Survivor"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(221) : error 017undefined symbol "L4DTeam_Survivor"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(229) : error 017undefined symbol "L4DTeam_Survivor"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(245) : error 017undefined symbol "L4DTeam_Survivor"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(264) : error 017undefined symbol "L4DTeam_Survivor"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(282) : error 017undefined symbol "L4DTeam_Survivor"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(292) : error 017undefined symbol "L4D2_RemoveEntGlow"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(298) : error 017undefined symbol "L4D_GetPlayerReviveCount"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(307) : error 017undefined symbol "L4D2_SetEntGlow"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(321) : error 017undefined symbol "L4D2Glow_OnUse"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(321) : warning 213tag mismatch
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(331) : error 017undefined symbol "L4D2Glow_OnUse"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(331) : warning 213tag mismatch
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(339) : error 017undefined symbol "L4D2Glow_OnUse"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(339) : warning 213tag mismatch
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(347) : error 017undefined symbol "L4D2Glow_None"
/home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(347) : warning 213tag mismatch 
Captain Stubin is offline
desire worker
Junior Member
Join Date: Dec 2018
Location: Umbrella Corporation
Old 12-13-2018 , 10:11   Re: [L4D2] Health Glows
Reply With Quote #3

most of your errors says "undefined symbol".

that means you did not defined specific values properly.

for example, let me bring your _HealthGlow_OnPluginEnd() function
Code:
public _HealthGlow_OnPluginEnd() 
{ 
    g_bIsPluginEnding = true; 

    FOR_EACH_SURVIVOR(client) 
    { 
        L4D2_RemoveEntGlow(client); 
    } 
}
you used client value in this function

but you haven`t defined client yet.

seems like you wanna use L4D2_RemoveEntGlow to whole survivors

than your code might be

Code:
public _HealthGlow_OnPluginEnd() 
{ 
    g_bIsPluginEnding = true; 

    for (new client = 1; client <= GetMaxClients(); client++)
    { 
        L4D2_RemoveEntGlow(client); 
    } 
}
now you see client value is defined in for loop.

if you think you have defined whole value already?

than I think you are misunderstanding the range of variables.

please read any materials about difference between Local variables and Global variables.

Last edited by desire worker; 12-13-2018 at 10:16. Reason: misspellings
desire worker is offline
Captain Stubin
Member
Join Date: Jun 2017
Old 12-13-2018 , 10:45   Re: [L4D2] Health Glows
Reply With Quote #4

Thank you that responded I replaced the data values on your above and errors disappeared. And what values should be replaced in ?
PHP Code:
 /home/groups/sourcemod/upload_tmp/phpr2VSjs.sp(200) : error 017undefined symbol "L4DTeam_Survivor"

Last edited by Captain Stubin; 12-14-2018 at 01:05.
Captain Stubin is offline
Mr. Zero
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 12-13-2018 , 17:00   Re: [L4D2] Health Glows
Reply With Quote #5

Here are the missing includes. Google code shut down long time ago and thus the old stock is no longer available. Sorry about that.

The Health Glow plugin is rather old, it could use an update at some point.
Attached Files
File Type: zip l4dstocks.zip (18.8 KB, 70 views)
Mr. Zero is offline
Captain Stubin
Member
Join Date: Jun 2017
Old 12-14-2018 , 01:02   Re: [L4D2] Health Glows
Reply With Quote #6

Quote:
Originally Posted by Mr. Zero View Post
Here are the missing includes. Google code shut down long time ago and thus the old stock is no longer available. Sorry about that.

The Health Glow plugin is rather old, it could use an update at some point.
Hello be kind help to correct these errors in the code
Captain Stubin is offline
Mr. Zero
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 12-14-2018 , 20:10   Re: [L4D2] Health Glows
Reply With Quote #7

Not tested.
Attached Files
File Type: zip healthglows_release.zip (51.8 KB, 80 views)
Mr. Zero is offline
Captain Stubin
Member
Join Date: Jun 2017
Old 12-15-2018 , 02:47   Re: [L4D2] Health Glows
Reply With Quote #8

Quote:
Originally Posted by Mr. Zero View Post
Not tested.
Hello compilation errors no more. But you need to redo the source code and add the helpers libraries. sp and macros.sp without them plugin (aura backlight does not work ).
and attach directly the healthy glow source code.sp I need it as I will compile substituting their values for colour of the aura.

Last edited by Captain Stubin; 12-15-2018 at 03:08.
Captain Stubin is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode