Raised This Month: $ Target: $400
 0% 

[ES] Health/Armor in Scoreboard Bug


  
 
 
Thread Tools Display Modes
Author Message
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-15-2009 , 17:17   [ES] Health/Armor in Scoreboard Bug
#1

Bueno, les comento lo que hace este plugin y dsp les digo mi problema...

El plugin convierte los frags y deaths del scoreboard (al apretar TAB) en Health y Armor (Vida y Chaleco). Se actualiza al respawnear... se actualiza al recibir daņo, se actualiza al comprar armor...

Y tambien hace que al matar a alguien o al morir no cuenten los frags y deaths.... solo muestra la vida y el armor.

El unico problema (por lo menos el unico que note al testearlo)... es que al matar a alguien, el armor se va a 0 (cuando en realidad no tengo 0, tengo mas)... Si dsp de eso recibo daņo o respawneo, el armor se vuelve a actualizar bien... pero weno la idea es que no pase eso de que se vaya a 0...

PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN    "Health/Armor in Scoreboard"
#define AUTHOR    "Alucard"
#define VERSION    "1.0"

new HealthArmorTeams

new g_msgArmorTypeg_msgHealthg_msgScoreInfo

new p_dead

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
p_dead register_cvar("ha_dead""1")

    
register_clcmd("kill""HookCmdKill")
    
    
RegisterHam(Ham_Spawn"player""HookSpawn"1)
    
    
register_event("DeathMsg""DeathMsg""a")

    
g_msgArmorType get_user_msgid("ArmorType")
    
g_msgHealth get_user_msgid("Health")
    
g_msgScoreInfo get_user_msgid("ScoreInfo")
    
    
register_message(g_msgHealth"HookGeneral")
    
register_message(g_msgArmorType"HookGeneral")
}

public 
HookCmdKill(id)
{
    
set_user_frags(id0)
    
cs_set_user_deaths(id0)
}

public 
HookSpawn(id)
{
    
Health get_user_health(id)
    
Armor get_user_armor(id)
    
    
set_user_frags(idHealth)
    
cs_set_user_deaths(idArmor)
}

public 
HookGeneral(msg_idmsg_destid)
{
    
Health get_user_health(id)
    
Armor get_user_armor(id)
    
Teams get_user_team(id)
    
    if(
get_pcvar_num(p_dead) )
    {
        if(
Health 0)
        {
            
Health 0
            Armor 
0
        
}
        
message_begin(MSG_ALL,g_msgScoreInfo)
        
write_byte(id)  
        
write_short(Health
        
write_short(Armor
        
write_short(0
        
write_short(Teams
        
message_end()
    }
}


public 
DeathMsg()
{
    new 
Killer read_data(1)
    
//new Victim = read_data(2)
    
    
Health get_user_health(Killer)
    
Armor get_user_armor(Killer)
    
    
set_user_frags(KillerHealth 1)
    
cs_set_user_deaths(KillerArmor)

A ver si alguien sabe como puedo resolver esto... tmb pido ayuda para optimizarlo, estoy casi seguro que se puede optimizar bastante el plugin...

Cabe aclarar tmb que lo del HookCmdKill lo agregue al final y no lo probe... y no estoy seguro si el comando "kill" es hookeable, aunque supongo que si. Podria haber usado el forward client_connect, pero si se puede hookear es mejor de esta forma asi no tengo que incluir el modulo engine.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...

Last edited by Alucard^; 09-15-2009 at 21:12.
Alucard^ is offline
Send a message via Skype™ to Alucard^
L//
Senior Member
Join Date: Aug 2008
Location: Not found
Old 09-15-2009 , 20:30   Re: [ES] Health/Armor in Scoreboard Bug
#2

Arregla el orden de esto

PHP Code:
    register_message(g_msgHealth"HookGeneral")
    
register_message(g_msgArmorType"HookGeneral")

    
g_msgArmorType get_user_msgid("ArmorType")
    
g_msgHealth get_user_msgid("Health")
    
g_msgScoreInfo get_user_msgid("ScoreInfo"
cambialo a ...
PHP Code:
    g_msgArmorType get_user_msgid("ArmorType")
    
g_msgHealth get_user_msgid("Health")
    
g_msgScoreInfo get_user_msgid("ScoreInfo")

    
register_message(g_msgHealth"HookGeneral")
    
register_message(g_msgArmorType"HookGeneral"
Sino no estarias registrando los mensajes correctamente. Proba cambiando eso, si no funciona, lo sigo mirando
__________________
L// is offline
Send a message via MSN to L//
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-15-2009 , 21:12   Re: [ES] Health/Armor in Scoreboard Bug
#3

Jaja, justamente eso lo cambie cuando lo postie, solo por que me parecia mas comodo leerlo asi :E pero lo testie de la forma que pusiste al final... asi que ese no es el problema =(

Igual gracias ;)

PD: Ahi cambie lo que dijiste.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
L//
Senior Member
Join Date: Aug 2008
Location: Not found
Old 09-15-2009 , 21:54   Re: [ES] Health/Armor in Scoreboard Bug
#4

Mira... no lo pude testear, asi que nose si anda.

PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN    "Health/Armor in Scoreboard"
#define AUTHOR    "Alucard (EDITADO por L//)"
#define VERSION    "1.0"

new healtharmor

new g_msgArmorTypeg_msgHealthg_msgScoreInfo

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_ClientKill"fw_clientkill")
    
    
RegisterHam(Ham_Killed"player""fw_playerkilled")
    
RegisterHam(Ham_Spawn"player""HookSpawn"1)

    
g_msgArmorType get_user_msgid("ArmorType")
    
g_msgHealth get_user_msgid("Health")
    
g_msgScoreInfo get_user_msgid("ScoreInfo")
    
    
register_message(g_msgHealth"HookGeneral")
    
register_message(g_msgArmorType"HookGeneral")
}

// Client Kill Forward
public fw_clientkill(id)
{
    
set_user_frags(id0)
    
cs_set_user_deaths(id0)
    
    
update_scoreboard(id00)
    
    return 
FMRES_IGNORED
}

public 
HookSpawn(id)
{
    
health get_user_health(id)
    
armor get_user_armor(id)    
    
    
set_user_frags(idhealth)
    
cs_set_user_deaths(idarmor)
    
    
update_scoreboard(idhealtharmor)
}

public 
HookGeneral(msg_idmsg_destid)
{
    
health get_user_health(id)
    
armor get_user_armor(id)
    
    if(
health 0)
    {
        
health 0
        armor 
0
    
}
    
    
update_scoreboard(idhealtharmor)
}

// Ham Player Killed Forward
public fw_playerkilled(victimattackershouldgib)
{
    
health get_user_health(attacker)
    
armor get_user_armor(attacker)        
    
    
set_user_frags(attackerhealth)
    
cs_set_user_deaths(attackerarmor)
    
    
set_user_frags(victim0)
    
cs_set_user_deaths(victim0)
    
    
update_scoreboard(attackerhealtharmor)
    
update_scoreboard(victim00)
}

update_scoreboard(idhealtarmor)
{
    
message_begin(MSG_BROADCASTg_msgScoreInfo)
    
write_byte(id)                 // id
    
write_short(healt)                 // frags
    
write_short(armor)                 // deaths
    
write_short(0)                    // class?
    
write_short(get_user_team(id))     // team
    
message_end()

__________________
L// is offline
Send a message via MSN to L//
Kiske
Veteran Member
Join Date: May 2009
Old 09-16-2009 , 08:36   Re: [ES] Health/Armor in Scoreboard Bug
#5

El problema del Plugin es que va a ser Confuso si no editas donde dice SCORE
Porque donde diga SCORE dira la Vida, y donde diga DEATHS dira el Escudo
__________________

Kiske is offline
Send a message via Skype™ to Kiske
Old 09-16-2009, 08:41
Kiske
This message has been deleted by Kiske. Reason: DP!
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-16-2009 , 12:30   Re: [ES] Health/Armor in Scoreboard Bug
#6

@kiske

Si pero hasta lo que yo, no se puede editar eso y nah no mo molesta igual... con un simple client_print podes avisar de que tratan los frags y deaths en el plugin... eso dsp lo agrego. Este tipo de plugins es para mods donde los frags no interesan, como por ej el surf o kz.

@ L//

No funca =( El mismo problema... al matar se me pone 0 el armor. Y ahora con este plugin al matar a alguien me suma 1 frag.

Realmente no entiendo porque me pone en 0 el armor. Si justamente le seteo los deaths como el armor al matar.

PHP Code:
cs_set_user_deaths(idArmor
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Starsailor
horrible hahah
Join Date: Aug 2008
Location: Buenos Aires
Old 09-16-2009 , 12:46   Re: [ES] Health/Armor in Scoreboard Bug
#7

Proba este:

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

#define PLUGIN    "Health/Armor in Scoreboard"
#define AUTHOR    "Alucard"
#define VERSION    "1.0"

new HealthArmorTeams

new g_msgScoreInfo

new p_dead

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
p_dead register_cvar("ha_dead""1")
    
    
register_forward(FM_CmdStart,"FwdCmdStart")
    
    
g_msgScoreInfo get_user_msgid("ScoreInfo")
}

public 
FwdCmdStart(iduc_handleseed)
{
    if(
get_uc(uc_handleUC_Buttons) & IN_SCORE)
    {
        
UpdateScoreboard(id)
    }
    
}

public 
UpdateScoreboard(id)
{
    if(!
get_pcvar_num(p_dead))
    {
        return 
FMRES_IGNORED
    
}
    
    
Health get_user_health(id)
    
Armor get_user_armor(id)
    
Teams get_user_team(id)
    
    if(!
is_user_alive(id))
    {
        
Health 0
        Armor 
0
    
}
    
    
message_begin(MSG_ALL,g_msgScoreInfo)
    
write_byte(id)  
    
write_short(Health
    
write_short(Armor
    
write_short(0
    
write_short(Teams
    
message_end()
    
    return 
FMRES_IGNORED

No se si es la forma mas eficiente de hacerlo, pero en mi server anduvo bien
__________________
Find my plugins here..

Ex - Spanish Moderator.

Last edited by Starsailor; 09-16-2009 at 12:54.
Starsailor is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-16-2009 , 14:11   Re: [ES] Health/Armor in Scoreboard Bug
#8

Muchas Gracias Starsailor... tu metodo me sirvio....

Igualmente, gracias a todos.

http://forums.alliedmods.net/showthread.php?t=103809
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
 



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 06:45.


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