Raised This Month: $ Target: $400
 0% 

Health Display.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mr.Noobie
BANNED
Join Date: Apr 2009
Old 08-24-2009 , 05:52   Health Display.
Reply With Quote #1

How to match this plugin:

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
#include <fakemeta>

#define PLUGIN_NAME "[ZP] Survivor Health"
#define PLUGIN_VERS "1.0"
#define PLUGIN_AUTH "hi!"

#define TASK_HEALTH 1234554321
new g_iHudSync

public plugin_init() 
{
 
register_plugin(PLUGIN_NAMEPLUGIN_VERSPLUGIN_AUTH)
 
 
//
 
g_iHudSync CreateHudSyncObj()
 
 
// Fwd's
 
RegisterHam(Ham_Spawn"player""Fwd_PlayerSpawn_Post"1)
 
RegisterHam(Ham_Killed"player""Fwd_PlayerKilled_Pre"0)
        
register_forward(FM_ClientDisconnect"client_disconnect")
}

public 
Fwd_PlayerSpawn_Post(id)
{
 if (
task_exists(id+TASK_HEALTH))
  
remove_task(id+TASK_HEALTH)
}

public 
Fwd_PlayerKilled_Pre(victimattackershouldgib)
{
 if (
task_exists(victim+TASK_HEALTH))
  
remove_task(victim+TASK_HEALTH)
}

public 
client_disconnect(id)
{
 if (
task_exists(id+TASK_HEALTH))
  
remove_task(id+TASK_HEALTH)
}

public 
zp_round_started(modeid)
{
 if (
mode != MODE_SURVIVOR)
  return
  
 if (!
zp_get_user_survivor(id))
  return
  
 
set_task(1.0"Task_ShowHealth"id+TASK_HEALTH__"b")
}

public 
Task_ShowHealth(id)
{
 
id -= TASK_HEALTH
 
 
if (!zp_get_user_survivor(id))
  
remove_task(id+TASK_HEALTH)
 
 
set_hudmessage(00225, -1.00.201.01.00.10.2, -1)
 
ShowSyncHudMsg(0g_iHudSync"Survivor Health: %d"get_user_health(id))

With this :

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
#include <fakemeta>

#define PLUGIN_NAME "[ZP] Survivor Health"
#define PLUGIN_VERS "1.0"
#define PLUGIN_AUTH "hi!"

#define TASK_HEALTH 1234554321
new g_iHudSync

public plugin_init() 
{
 
register_plugin(PLUGIN_NAMEPLUGIN_VERSPLUGIN_AUTH)
 
 
//
 
g_iHudSync CreateHudSyncObj()
 
 
// Fwd's
 
RegisterHam(Ham_Spawn"player""Fwd_PlayerSpawn_Post"1)
 
RegisterHam(Ham_Killed"player""Fwd_PlayerKilled_Pre"0)
        
register_forward(FM_ClientDisconnect"client_disconnect")
}

public 
Fwd_PlayerSpawn_Post(id)
{
 if (
task_exists(id+TASK_HEALTH))
  
remove_task(id+TASK_HEALTH)
}

public 
Fwd_PlayerKilled_Pre(victimattackershouldgib)
{
 if (
task_exists(victim+TASK_HEALTH))
  
remove_task(victim+TASK_HEALTH)
}

public 
client_disconnect(id)
{
 if (
task_exists(id+TASK_HEALTH))
  
remove_task(id+TASK_HEALTH)
}

public 
zp_round_started(modeid)
{
 if (
mode != MODE_NEMESIS)
  return
  
 if (!
zp_get_user_nemesis(id))
  return
  
 
set_task(1.0"Task_ShowHealth"id+TASK_HEALTH__"b")
}

public 
Task_ShowHealth(id)
{
 
id -= TASK_HEALTH
 
 
if (!zp_get_user_nemesis(id))
  
remove_task(id+TASK_HEALTH)
 
 
set_hudmessage(00225, -1.00.201.01.00.10.2, -1)
 
ShowSyncHudMsg(0g_iHudSync"Nemesis Health: %d"get_user_health(id))

Mr.Noobie is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 08-24-2009 , 09:35   Re: Health Display.
Reply With Quote #2

What?
BOYSplayCS is offline
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 08-24-2009 , 12:13   Re: Health Display.
Reply With Quote #3

You want to join both? Oo
__________________
IneedHelp is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-24-2009 , 16:12   Re: Health Display.
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
#include <fakemeta>

#define PLUGIN_NAME "[ZP] Survivor Health"
#define PLUGIN_VERS "1.0"
#define PLUGIN_AUTH "hi!"

#define TASK_HEALTH 1234554321
new g_iHudSync

enum GameTypes
{
    
GAME_NONE,
    
    
GAME_SURVIVOR,
    
GAME_NEMESIS
};

new const 
g_iGameModesGameTypes ] =
{
    
0,
    
    
MODE_SURVIVOR,
    
MODE_NEMESIS
};

new const 
g_szGameNamesGameTypes ][ ] =
{
    
"",
    
    
"Survivor",
    
"Nemesis"
};

enum RGB
{
    
RGB
};

new const 
g_iGameColorsGameTypes ][ RGB ] =
{
    { 
00},
    
    { 
00255 },
    { 
2550}
};

new 
GameTypes:g_iGamePlay;

GameTypes:GetModeiMode )
{
    for( new 
GameTypes:GameTypes:1GameTypesi++ )
    {
        if( 
g_iGameModes] == iMode )
        {
            return 
i;
        }
    }
    
    return 
GAME_NONE;
}

UserMatchesModeclient )
{
    switch( 
g_iGamePlay )
    {
        case 
GAME_SURVIVOR:
        {
            return 
zp_get_user_survivorclient );
        }
        case 
GAME_NEMESIS:
        {
            return 
zp_get_user_nemesisclient );
        }
    }
    
    return 
0;
}

public 
plugin_init() 
{
 
register_plugin(PLUGIN_NAMEPLUGIN_VERSPLUGIN_AUTH)
 
 
//
 
g_iHudSync CreateHudSyncObj()
 
 
// Fwd's
 
RegisterHam(Ham_Spawn"player""Fwd_PlayerSpawn_Post"1)
 
RegisterHam(Ham_Killed"player""Fwd_PlayerKilled_Pre"0)
        
register_forward(FM_ClientDisconnect"client_disconnect")
}

public 
Fwd_PlayerSpawn_Post(id)
{
 if (
task_exists(id+TASK_HEALTH))
  
remove_task(id+TASK_HEALTH)
}

public 
Fwd_PlayerKilled_Pre(victimattackershouldgib)
{
 if (
task_exists(victim+TASK_HEALTH))
  
remove_task(victim+TASK_HEALTH)
}

public 
client_disconnect(id)
{
 if (
task_exists(id+TASK_HEALTH))
  
remove_task(id+TASK_HEALTH)
}

public 
zp_round_started(modeid)
{
 
g_iGamePlay GetModemode )
 if( !
g_iGamePlay )
  return
  
 if( !
UserMatchesModeid ) )
  return
  
 
set_task(1.0"Task_ShowHealth"id+TASK_HEALTH__"b")
}

public 
Task_ShowHealth(id)
{
 
id -= TASK_HEALTH
 
 
if( !g_iGamePlay
 
|| !UserMatchesModeid ) )
 {
  
remove_task(id+TASK_HEALTH)
  return
 }
 
 
set_hudmessage(g_iGameColorsg_iGamePlay ][ ], g_iGameColorsg_iGamePlay ][ ], g_iGameColorsg_iGamePlay ][ ], -1.00.201.01.00.10.2, -1)
 
ShowSyncHudMsg(idg_iHudSync"%s Health: %d"g_szGameNamesg_iGamePlay ], get_user_health(id))

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 08-25-2009 at 10:27.
Exolent[jNr] is offline
Mr.Noobie
BANNED
Join Date: Apr 2009
Old 08-25-2009 , 06:30   Re: Health Display.
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
#include <fakemeta>
 
#define PLUGIN_NAME "[ZP] Survivor Health"
#define PLUGIN_VERS "1.0"
#define PLUGIN_AUTH "hi!"
 
#define TASK_HEALTH 1234554321
new g_iHudSync
 
enum GameTypes
{
    
GAME_NONE,
 
    
GAME_SURVIVOR,
    
GAME_NEMESIS
};
 
new const 
g_iGameModesGameTypes ] =
{
    
0,
 
    
MODE_SURVIVOR,
    
MODE_NEMESIS
};
 
new const 
g_szGameNamesGameTypes ][ ] =
{
    
"",
 
    
"Survivor",
    
"Nemesis"
};
 
new 
GameTypes:g_iGamePlay;
 
GameTypes:GetModeiMode )
{
    for( new 
GameTypes:GameTypes:1GameTypesi++ )
    {
        if( 
g_iGameModes] == iMode )
        {
            return 
i;
        }
    }
 
    return 
GAME_NONE;
}
 
UserMatchesModeclient )
{
    switch( 
g_iGamePlay )
    {
        case 
GAME_SURVIVOR:
        {
            return 
zp_get_user_survivorclient );
        }
        case 
GAME_NEMESIS:
        {
            return 
zp_get_user_nemesisclient );
        }
    }
 
    return 
0;
}
 
public 
plugin_init() 
{
 
register_plugin(PLUGIN_NAMEPLUGIN_VERSPLUGIN_AUTH)
 
 
//
 
g_iHudSync CreateHudSyncObj()
 
 
// Fwd's
 
RegisterHam(Ham_Spawn"player""Fwd_PlayerSpawn_Post"1)
 
RegisterHam(Ham_Killed"player""Fwd_PlayerKilled_Pre"0)
        
register_forward(FM_ClientDisconnect"client_disconnect")
}
 
public 
Fwd_PlayerSpawn_Post(id)
{
 if (
task_exists(id+TASK_HEALTH))
  
remove_task(id+TASK_HEALTH)
}
 
public 
Fwd_PlayerKilled_Pre(victimattackershouldgib)
{
 if (
task_exists(victim+TASK_HEALTH))
  
remove_task(victim+TASK_HEALTH)
}
 
public 
client_disconnect(id)
{
 if (
task_exists(id+TASK_HEALTH))
  
remove_task(id+TASK_HEALTH)
}
 
public 
zp_round_started(modeid)
{
 
g_iGamePlay GetModemode )
 if( !
g_iGamePlay )
  return
 
 if( !
UserMatchesModeid ) )
  return
 
 
set_task(1.0"Task_ShowHealth"id+TASK_HEALTH__"b")
}
 
public 
Task_ShowHealth(id)
{
 
id -= TASK_HEALTH
 
 
if( !g_iGamePlay
 
|| !UserMatchesModeid ) )
 {
  
remove_task(id+TASK_HEALTH)
  return
 }
 
 
set_hudmessage(00225, -1.00.201.01.00.10.2, -1)
 
ShowSyncHudMsg(idg_iHudSync"%s Health: %d"g_szGameNamesg_iGamePlay ], get_user_health(id))

Is it possible to make the hud message for nemesis in red ?

Or blue for survivor ?
Mr.Noobie is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-25-2009 , 10:28   Re: Health Display.
Reply With Quote #6

Done.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Mr.Noobie
BANNED
Join Date: Apr 2009
Old 08-30-2009 , 03:46   Re: Health Display.
Reply With Quote #7

Quote:
Originally Posted by Exolent[jNr] View Post
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
#include <fakemeta>
 
#define PLUGIN_NAME "[ZP] Survivor Health"
#define PLUGIN_VERS "1.0"
#define PLUGIN_AUTH "hi!"
 
#define TASK_HEALTH 1234554321
new g_iHudSync
 
enum GameTypes
{
    
GAME_NONE,
 
    
GAME_SURVIVOR,
    
GAME_NEMESIS
};
 
new const 
g_iGameModesGameTypes ] =
{
    
0,
 
    
MODE_SURVIVOR,
    
MODE_NEMESIS
};
 
new const 
g_szGameNamesGameTypes ][ ] =
{
    
"",
 
    
"Survivor",
    
"Nemesis"
};
 
enum RGB
{
    
RGB
};
 
new const 
g_iGameColorsGameTypes ][ RGB ] =
{
    { 
00},
 
    { 
00255 },
    { 
2550}
};
 
new 
GameTypes:g_iGamePlay;
 
GameTypes:GetModeiMode )
{
    for( new 
GameTypes:GameTypes:1GameTypesi++ )
    {
        if( 
g_iGameModes] == iMode )
        {
            return 
i;
        }
    }
 
    return 
GAME_NONE;
}
 
UserMatchesModeclient )
{
    switch( 
g_iGamePlay )
    {
        case 
GAME_SURVIVOR:
        {
            return 
zp_get_user_survivorclient );
        }
        case 
GAME_NEMESIS:
        {
            return 
zp_get_user_nemesisclient );
        }
    }
 
    return 
0;
}
 
public 
plugin_init() 
{
 
register_plugin(PLUGIN_NAMEPLUGIN_VERSPLUGIN_AUTH)
 
 
//
 
g_iHudSync CreateHudSyncObj()
 
 
// Fwd's
 
RegisterHam(Ham_Spawn"player""Fwd_PlayerSpawn_Post"1)
 
RegisterHam(Ham_Killed"player""Fwd_PlayerKilled_Pre"0)
        
register_forward(FM_ClientDisconnect"client_disconnect")
}
 
public 
Fwd_PlayerSpawn_Post(id)
{
 if (
task_exists(id+TASK_HEALTH))
  
remove_task(id+TASK_HEALTH)
}
 
public 
Fwd_PlayerKilled_Pre(victimattackershouldgib)
{
 if (
task_exists(victim+TASK_HEALTH))
  
remove_task(victim+TASK_HEALTH)
}
 
public 
client_disconnect(id)
{
 if (
task_exists(id+TASK_HEALTH))
  
remove_task(id+TASK_HEALTH)
}
 
public 
zp_round_started(modeid)
{
 
g_iGamePlay GetModemode )
 if( !
g_iGamePlay )
  return
 
 if( !
UserMatchesModeid ) )
  return
 
 
set_task(1.0"Task_ShowHealth"id+TASK_HEALTH__"b")
}
 
public 
Task_ShowHealth(id)
{
 
id -= TASK_HEALTH
 
 
if( !g_iGamePlay
 
|| !UserMatchesModeid ) )
 {
  
remove_task(id+TASK_HEALTH)
  return
 }
 
 
set_hudmessage(g_iGameColorsg_iGamePlay ][ ], g_iGameColorsg_iGamePlay ][ ], g_iGameColorsg_iGamePlay ][ ], -1.00.201.01.00.10.2, -1)
 
ShowSyncHudMsg(idg_iHudSync"%s Health: %d"g_szGameNamesg_iGamePlay ], get_user_health(id))


There is still a problem with this. The health display doesn't apear sometime.
Mr.Noobie is offline
hzqst
Senior Member
Join Date: Jul 2008
Old 08-30-2009 , 04:51   Re: Health Display.
Reply With Quote #8

use a certain channel for your plugin and try to stop the 3rd plugins with message displaying
hzqst is offline
Mr.Noobie
BANNED
Join Date: Apr 2009
Old 08-30-2009 , 06:19   Re: Health Display.
Reply With Quote #9

Quote:
Originally Posted by hzqst View Post
use a certain channel for your plugin and try to stop the 3rd plugins with message displaying
Yeah did. still same
Mr.Noobie is offline
Old 09-03-2009, 12:07
Mr.Noobie
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
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 15:06.


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