AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Need a small help with HEALTH INSTEAD OF DEATHS plugin (https://forums.alliedmods.net/showthread.php?t=124517)

fiendshard 04-17-2010 14:13

Need a small help with HEALTH INSTEAD OF DEATHS plugin
 
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

wrecked_ 04-17-2010 14:17

Re: Need a small help with HEALTH INSTEAD OF DEATHS plugin
 
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.

fiendshard 04-17-2010 14:37

Re: Need a small help with HEALTH INSTEAD OF DEATHS plugin
 
No luck so far, have tried couple of combinations, none happened to work out.

Thanks anyway for effort

orange 04-18-2010 03:19

Re: Need a small help with HEALTH INSTEAD OF DEATHS plugin
 
pretty sweet idea


All times are GMT -4. The time now is 18:20.

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