Raised This Month: $51 Target: $400
 12% 

Need a small help with HEALTH INSTEAD OF DEATHS plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fiendshard
Senior Member
Join Date: Dec 2009
Location: In Water
Old 04-17-2010 , 14:13   Need a small help with HEALTH INSTEAD OF DEATHS plugin
Reply With Quote #1

Hello to everone,
This is amxx plugin that makes scoreboard display health of players instead of deaths. However, there is one problem: when player is dead, his death column shows number of deaths, instead of 0 like death man's health.

Could someone help and correct the code to show zero when a player is dead?

Here is code:
Code:
#include <amxmodx>

#define PLUGIN    "Health in Deaths"
#define AUTHOR    "Alucard"
#define VERSION    "1.4"

#define MAX_FRAGS 32000
#define SET_FRAGS 32000

enum _:ScoreInfo_Args {
    PlayerID = 1,
    Frags,
    Deaths,
    ClassID,
    TeamID
}

new g_msgScoreInfo

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    g_msgScoreInfo = get_user_msgid("ScoreInfo")
    
    register_message(g_msgScoreInfo, "Message_ScoreInfo")
    
    register_event("Health", "EventHealth", "b")
}

public Message_ScoreInfo(iMsgId, iMsgType, iMsgEnt)
{
    set_msg_arg_int(Deaths, ARG_SHORT, get_user_health(get_msg_arg_int(PlayerID)) )
}

Send_ScoreInfo(id, iHealth)
{
    if(iHealth > MAX_FRAGS)
        iHealth = SET_FRAGS
    
    message_begin(MSG_BROADCAST, g_msgScoreInfo)
    write_byte(id) 
    write_short(get_user_frags(id))
    write_short(iHealth)
    write_short(0)
    write_short(get_user_team(id))
    message_end()
}

public EventHealth(id)
    Send_ScoreInfo(id, read_data(1) )

Thank you
fiendshard is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 04-17-2010 , 14:17   Re: Need a small help with HEALTH INSTEAD OF DEATHS plugin
Reply With Quote #2

Code:
write_short(is_user_alive( id ) ? iHealth : 0)
Don't know if it would differ, but that type of thinking has solved a couple problems for me in the past. Give it a shot.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
fiendshard
Senior Member
Join Date: Dec 2009
Location: In Water
Old 04-17-2010 , 14:37   Re: Need a small help with HEALTH INSTEAD OF DEATHS plugin
Reply With Quote #3

No luck so far, have tried couple of combinations, none happened to work out.

Thanks anyway for effort
fiendshard is offline
orange
Senior Member
Join Date: Dec 2005
Old 04-18-2010 , 03:19   Re: Need a small help with HEALTH INSTEAD OF DEATHS plugin
Reply With Quote #4

pretty sweet idea
__________________
orange is offline
Old 04-20-2010, 07:30
fiendshard
This message has been deleted by YamiKaitou. Reason: bump
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 11:11.


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