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

[TUT] Recording Damage/Hits Per-Round and Displaying It


Post New Thread Reply   
 
Thread Tools Display Modes
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-12-2010 , 17:09   Re: [TUT] Recording Damage/Hits Per-Round and Displaying It
Reply With Quote #21

Use the method that I use in round start, like I said.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
flamin
BANNED
Join Date: Jul 2009
Location: Los Teques
Old 03-12-2010 , 17:57   Re: [TUT] Recording Damage/Hits Per-Round and Displaying It
Reply With Quote #22

Ok i have done what I have said and look the code as place

PHP Code:
public plugin_init()
{
    
register_plugin(plugin_name,plugin_version,plugin_author);

    
register_dictionary("yap.txt")
    
register_dictionary("yap_aux.txt")

    
pug_cvar_help register_cvar("pug_help","http://")
    
pug_cvar_admin_help register_cvar("pug_adminhelp","http://")

    
register_pug_admincmd("help","cmd_cmdlist",_,"Lista de todos los comandos PUG")

    
register_pug_clcmd("hp","cmd_hpteam",_,"Muestra el hp de los oponentes")

    
register_pug_clcmd("dmg","cmd_dmg",_,"Muestra el daņo que causastes y el que te causo el oponente")
    
register_pug_clcmd("rdmg","cmd_dmg",_,"Muestra el daņo que causastes y el que te causo el oponente")
    
register_logevent"LEV_RoundStart"2"1=Round_Start" )

    
register_pug_admincmd("svrestart","cmd_restart",PUG_CMD_LVL,"Solo para ADMIN")

    
//parse_header("BOE-E",pug_header,5)
}

// Rukia: We need to reset the dmg and hits when a client connects, disconnects, and rounds start
new pug_dmg[33][33]
new 
pug_hits[33][33]

public 
client_connect(id
{
    
arrayset(pug_dmg[id], 033); 
    
arrayset(pug_hits[id], 033);
}

public 
client_disconnect(id)
{
    for (new 
033i++)
    {
        
pug_dmg[i][id] = 0;
        
pug_hits[i][id] = 0;
    }
}

public 
pug_round_start()
{
    for (new 
033; ++i)
    {
        
arrayset(pug_dmg[i], 033)    
        
arrayset(pug_hits[i], 033)    
    }
}

public 
pug_round_start_failed()
{
    for (new 
033; ++i)
    {
        
arrayset(pug_dmg[i], 033)    
        
arrayset(pug_hits[i], 033)    
    }
}

// Rukia: Assume that the mod specific plugin has loaded the correct module, or provided this for us
public  client_damage attackervictimamountwpnindexhitplaceTA )
{
    
//if (attacker == victim) return;

    
pug_dmg[attacker][victim] += amount
    pug_hits
[attacker][victim] += 1
}

#define RESET_DELAY    15.0
new bool:b_CanTypeWhileAlive

public LEV_RoundStart()
{
    
#if defined RESET_DELAY
        
set_taskRESET_DELAY"TASK_ResetStats" )
    
#else
        
TASK_ResetStats()
    
#endif
    
    
b_CanTypeWhileAlive true
}

public 
TASK_ResetStats()
{
    new 
iPlayers[32]
    new 
iNum
    
new player
    
new id
    
    get_players
iPlayersiNum )
    
    for( new 
0iNumi++ )
    {
        
player iPlayers[i]
        
        for( new 
0iNumj++ )
        {
            
id iPlayers[j]
            
            if( 
id == player )
            {
                continue;
            }
            
            
pug_dmg[id][player] = 0
            
            pug_hits
[id][player] = 0
        
}
    }
    
    
b_CanTypeWhileAlive false
}

public 
cmd_dmg(id)
{
    if( 
is_user_alive(id) && id != && !b_CanTypeWhileAlive pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED");
    else
    {
        static 
Players[32], name[32]
        new 
playerCountiplayer
        get_players
(PlayersplayerCount"ch")

        new 
tmp_hitstmp_dmgtmp_rhitstmp_rdmgcheck
        
for (i=0i<playerCounti++)
        {
            
player Players[i]
            
tmp_hits pug_hits[id][player]
            
tmp_rhits pug_hits[player][id]

            if( 
tmp_hits || tmp_rhits )
            {
                
check 1
                tmp_dmg 
pug_dmg[id][player]
                
tmp_rdmg pug_dmg[player][id]

                if(
player == idclient_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG_SELF",tmp_dmg,tmp_hits)
                else
                {
                    
get_user_name(player,name31)
                    
client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG",tmp_dmg,tmp_hits,tmp_rdmg,tmp_rhitsname)
                }
            }
          }

        
tmp_hits pug_hits[id][0]
        
tmp_rhits pug_hits[0][id]
        if( 
tmp_hits || tmp_rhits )
        {
            
tmp_dmg pug_dmg[id][0]
            
tmp_rdmg pug_dmg[0][id]
            
client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG","WorldSpawn",tmp_hits,tmp_dmg)
        }
        else if(!
checkclient_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_NODMG")
    }
    return 
PLUGIN_HANDLED

When i am dead can execute the command perfectly but when reborn in a new round and run the command to view the damage of the round last
look picture!
Attached Thumbnails
Click image for larger version

Name:	shit.JPG
Views:	246
Size:	61.5 KB
ID:	61381  
flamin is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-12-2010 , 18:03   Re: [TUT] Recording Damage/Hits Per-Round and Displaying It
Reply With Quote #23

It was because of the pug_round_starts, you were resetting stats in there.
PHP Code:
public plugin_init()
{
    
register_plugin(plugin_name,plugin_version,plugin_author);

    
register_dictionary("yap.txt")
    
register_dictionary("yap_aux.txt")

    
pug_cvar_help register_cvar("pug_help","http://")
    
pug_cvar_admin_help register_cvar("pug_adminhelp","http://")

    
register_pug_admincmd("help","cmd_cmdlist",_,"Lista de todos los comandos PUG")

    
register_pug_clcmd("hp","cmd_hpteam",_,"Muestra el hp de los oponentes")

    
register_pug_clcmd("dmg","cmd_dmg",_,"Muestra el daņo que causastes y el que te causo el oponente")
    
register_pug_clcmd("rdmg","cmd_dmg",_,"Muestra el daņo que causastes y el que te causo el oponente")

    
register_pug_admincmd("svrestart","cmd_restart",PUG_CMD_LVL,"Solo para ADMIN")

    
//parse_header("BOE-E",pug_header,5)
}

// Rukia: We need to reset the dmg and hits when a client connects, disconnects, and rounds start
new pug_dmg[33][33]
new 
pug_hits[33][33]

public 
client_connect(id
{
    
arrayset(pug_dmg[id], 033); 
    
arrayset(pug_hits[id], 033);
}

public 
client_disconnect(id)
{
    for (new 
033i++)
    {
        
pug_dmg[i][id] = 0;
        
pug_hits[i][id] = 0;
    }
}

public 
pug_round_start()
{
    
#if defined RESET_DELAY
        
set_taskRESET_DELAY"TASK_ResetStats" )
    
#else
        
TASK_ResetStats()
    
#endif
    
    
b_CanTypeWhileAlive true
}

public 
pug_round_start_failed()
{
    
#if defined RESET_DELAY
        
set_taskRESET_DELAY"TASK_ResetStats" )
    
#else
        
TASK_ResetStats()
    
#endif
    
    
b_CanTypeWhileAlive true
}

// Rukia: Assume that the mod specific plugin has loaded the correct module, or provided this for us
public  client_damage attackervictimamountwpnindexhitplaceTA )
{
    
//if (attacker == victim) return;

    
pug_dmg[attacker][victim] += amount
    pug_hits
[attacker][victim] += 1
}

#define RESET_DELAY    15.0
new bool:b_CanTypeWhileAlive

public TASK_ResetStats()
{
    new 
iPlayers[32]
    new 
iNum
    
new player
    
new id
    
    get_players
iPlayersiNum )
    
    for( new 
0iNumi++ )
    {
        
player iPlayers[i]
        
        for( new 
0iNumj++ )
        {
            
id iPlayers[j]
            
            if( 
id == player )
            {
                continue;
            }
            
            
pug_dmg[id][player] = 0
            
            pug_hits
[id][player] = 0
        
}
    }
    
    
b_CanTypeWhileAlive false
}

public 
cmd_dmg(id)
{
    if( 
is_user_alive(id) && id != && !b_CanTypeWhileAlive pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED");
    else
    {
        static 
Players[32], name[32]
        new 
playerCountiplayer
        get_players
(PlayersplayerCount"ch")

        new 
tmp_hitstmp_dmgtmp_rhitstmp_rdmgcheck
        
for (i=0i<playerCounti++)
        {
            
player Players[i]
            
tmp_hits pug_hits[id][player]
            
tmp_rhits pug_hits[player][id]

            if( 
tmp_hits || tmp_rhits )
            {
                
check 1
                tmp_dmg 
pug_dmg[id][player]
                
tmp_rdmg pug_dmg[player][id]

                if(
player == idclient_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG_SELF",tmp_dmg,tmp_hits)
                else
                {
                    
get_user_name(player,name31)
                    
client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG",tmp_dmg,tmp_hits,tmp_rdmg,tmp_rhitsname)
                }
            }
          }

        
tmp_hits pug_hits[id][0]
        
tmp_rhits pug_hits[0][id]
        if( 
tmp_hits || tmp_rhits )
        {
            
tmp_dmg pug_dmg[id][0]
            
tmp_rdmg pug_dmg[0][id]
            
client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG","WorldSpawn",tmp_hits,tmp_dmg)
        }
        else if(!
checkclient_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_NODMG")
    }
    return 
PLUGIN_HANDLED

__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
flamin
BANNED
Join Date: Jul 2009
Location: Los Teques
Old 03-12-2010 , 18:32   Re: [TUT] Recording Damage/Hits Per-Round and Displaying It
Reply With Quote #24

Ok perfect now if it shows the dmg of the previous round but there is another problem i am not reset the damage continues adding each round...

The problem is on the resetstats but i cannot find that I can do to restart the damage to the 15 secs
flamin is offline
flamin
BANNED
Join Date: Jul 2009
Location: Los Teques
Old 03-12-2010 , 20:15   Re: [TUT] Recording Damage/Hits Per-Round and Displaying It
Reply With Quote #25

Thank you wrecked_ i have already achieved have the dmg! But only shows me to the people that i have caused damage, in your code shows all the players on the team i have tried to implement the my code and i did not succeed help!

I believe that this is the code for the team, i'm wrong?


PHP Code:
    new iPlayers[32]
    new 
iNum
    
new plrid
    
    get_players
iPlayersiNum )
    
    static 
name[32]
    static 
message[108]
    
    new 
CsTeams:idteam cs_get_user_teamid )
    
    for( new 
0iNumi++ )
    {
        
plrid iPlayers[i]
        
        if( 
id == plrid || cs_get_user_teamplrid ) == idteam )
        {
            continue;
        }
        
        
get_user_nameplridname31 
How could implement this code in the mio that is this:

PHP Code:
public cmd_dmg(id)
{
    if( 
is_user_alive(id) && id != && !b_CanTypeWhileAlive pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED");
    else
    {
        static 
Players[32], name[32]
        new 
playerCountiplayer
        get_players
(PlayersplayerCount"ch")

        new 
tmp_hitstmp_dmgtmp_rhitstmp_rdmgcheck
        
for (i=0i<playerCounti++)
        {
            
player Players[i]
            
tmp_hits pug_hits[id][player]
            
tmp_rhits pug_hits[player][id]

            if( 
tmp_hits || tmp_rhits )
            {
                
check 1
                tmp_dmg 
pug_dmg[id][player]
                
tmp_rdmg pug_dmg[player][id]

                if(
player == idclient_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG_SELF",tmp_dmg,tmp_hits)
                else
                {
                    
get_user_name(player,name31)
                    
client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG",tmp_dmg,tmp_hits,tmp_rdmg,tmp_rhitsname)
                }
            }
          }

        
tmp_hits pug_hits[id][0]
        
tmp_rhits pug_hits[0][id]
        if( 
tmp_hits || tmp_rhits )
        {
            
tmp_dmg pug_dmg[id][0]
            
tmp_rdmg pug_dmg[0][id]
            
client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG","WorldSpawn",tmp_hits,tmp_dmg)
        }
        else if(!
checkclient_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_NODMG")
    }
    return 
PLUGIN_CONTINUE;

I have tried to do so, but to compile i got error help
flamin is offline
flamin
BANNED
Join Date: Jul 2009
Location: Los Teques
Old 03-12-2010 , 21:23   Re: [TUT] Recording Damage/Hits Per-Round and Displaying It
Reply With Quote #26

wrecked_ help me XD
flamin is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-12-2010 , 21:47   Re: [TUT] Recording Damage/Hits Per-Round and Displaying It
Reply With Quote #27

Quote:
Originally Posted by flamin View Post
wrecked_ help me XD
That's what, the third time you've bumped an already double-post? Please, for the love of everything holy, just be patient. You have been constantly asking for help when the answer was right in front of you. Help is okay, but not when it's solvable by simply looking over your code and the tutorial. Common sense, as rare as it is, is the solution to the majority of any problems you will have in Pawn. Read over your code and attempt it yourself.

Moreover, you are not the only person's issues I'm getting requests to fix. You can't expect me to reply the instant I come online. Multiple PMs on Alliedmodders and Steam are coming in at once, and I can't just abandon everyone because you don't know how to read. The hour I took just to WRITE UP this tutorial was dedicated to making this as simple as possible. Read it and look over your code, I'm sure you'll find your error.

Furthermore, I don't know how "help me" could ever cause you to "XD".
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
flamin
BANNED
Join Date: Jul 2009
Location: Los Teques
Old 03-12-2010 , 21:52   Re: [TUT] Recording Damage/Hits Per-Round and Displaying It
Reply With Quote #28

It is true wrecked_ have all the reason apologized for the double post, and i ask or ask help on another problem different?

Last edited by flamin; 03-12-2010 at 21:54.
flamin is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-12-2010 , 21:59   Re: [TUT] Recording Damage/Hits Per-Round and Displaying It
Reply With Quote #29

Sure.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
flamin
BANNED
Join Date: Jul 2009
Location: Los Teques
Old 03-12-2010 , 22:14   Re: [TUT] Recording Damage/Hits Per-Round and Displaying It
Reply With Quote #30

Ok thanks you mean now that i have thanks to you the dmg as esea what i achieve is to have the hp beside the name i have implemented this get_user_health(player) but has an error when i killed the player in the hp instead of saying (0 hp) says (1 hp) being killed as could adjust to that i show in (0 hp) when this killed the opponent? There is another problem that now that you can see the dmg being alive is not shows me the hp in the last round if it takes as a new verification and in the new round where i am going to see the dmg of the last round tells me (100 hp) when the user in the last round was dead! Should tell (0 hp) until you run the reset, posteare my code here:

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

#include <yap_modspecific>
#include <yap_forwards>
#include <yap_stocks>
#include <yap_const>

new const plugin_author[] = "PsychO"
new const plugin_name[] = "YAP-AUX"
new const plugin_version[] = "0.0.1"

public pug_cvar_help
public pug_cvar_admin_help

#define RESET_DELAY    15.0
new bool:allowdmg

public plugin_init()
{
    
register_plugin(plugin_name,plugin_version,plugin_author);

    
register_dictionary("yap.txt")
    
register_dictionary("yap_aux.txt")

    
pug_cvar_help register_cvar("pug_help","http://")
    
pug_cvar_admin_help register_cvar("pug_adminhelp","http://")

    
register_pug_admincmd("help","cmd_cmdlist",_,"Lista de todos los comandos PUG")

    
register_pug_clcmd("hp","cmd_hpteam",_,"Muestra el hp de los oponentes")

    
register_pug_clcmd("dmg","cmd_dmg",_,"Muestra el daņo que causastes y el que te causo el oponente")
    
register_pug_clcmd("rdmg","cmd_dmg",_,"Muestra el daņo que causastes y el que te causo el oponente")

    
register_pug_admincmd("svrestart","cmd_restart",PUG_CMD_LVL,"Solo para ADMIN")

    
//parse_header("BOE-E",pug_header,5)
}

// Rukia: We need to reset the dmg and hits when a client connects, disconnects, and rounds start
new pug_dmg[33][33]
new 
pug_hits[33][33]

public 
client_connect(id
{
    
arrayset(pug_dmg[id], 033); 
    
arrayset(pug_hits[id], 033);
}

public 
client_disconnect(id)
{
    for (new 
033i++)
    {
        
pug_dmg[i][id] = 0;
        
pug_hits[i][id] = 0;
    }
}

public 
pug_round_start()
{
    
#if defined RESET_DELAY
        
set_taskRESET_DELAY"TASK_ResetStats" )
    
#else
        
TASK_ResetStats()
    
#endif
    
    
allowdmg true
}

public 
pug_round_start_failed()
{
    
#if defined RESET_DELAY
        
set_taskRESET_DELAY"TASK_ResetStats" )
    
#else
        
TASK_ResetStats()
    
#endif
    
    
allowdmg true
}

// Rukia: Assume that the mod specific plugin has loaded the correct module, or provided this for us
public  client_damage attackervictimamountwpnindexhitplaceTA )
{
    
//if (attacker == victim) return;

    
pug_dmg[attacker][victim] += amount
    pug_hits
[attacker][victim] += 1
}

#include <yap_aux>


public cmd_hpall(id)
{
    if(
is_user_alive(id) && id != 0) { pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED"); }
    else
    {
        static 
Players[32], name[32]
        new 
playerCountiplayer
        get_players
(PlayersplayerCount"ah")

        for (
i=0i<playerCounti++)
        {
            
player Players[i]
            
get_user_name(player,name,31)

            
client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_HP",name,get_user_health(player),get_user_armor(player))
        }
    }
    return 
PLUGIN_HANDLED
}

public 
cmd_hpteam(id)
{
    if(
is_user_alive(id) && id != 0) { pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED"); }
    else
    {
        static 
Players[32], name[32]
        new 
playerCountiplayer
        get_players
(PlayersplayerCount"ah")

        new 
teamid pug_get_client_team(id)
        for (
i=0i<playerCounti++)
        {
            
player Players[i]
            if(
teamid == pug_get_client_team(player) ) continue;
            
get_user_name(player,name,31)

            
client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_HP",get_user_health(player),get_user_armor(player), name)
        }
    }
    return 
PLUGIN_HANDLED
}

public 
TASK_ResetStats()
{
    for (new 
033; ++i)
    {
        
arrayset(pug_dmg[i], 033)    
        
arrayset(pug_hits[i], 033)    
    }
    
allowdmg false
}

public 
cmd_dmg(id)
{
    if( 
is_user_alive(id) && id != && !allowdmg pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED");
    else
    {
        static 
Players[32], name[32]
        new 
playerCountiplayer
        get_players
(PlayersplayerCount"ch")

        new 
tmp_hitstmp_dmgtmp_rhitstmp_rdmgcheck
        
for (i=0i<playerCounti++)
        {
            
player Players[i]
            
tmp_hits pug_hits[id][player]
            
tmp_rhits pug_hits[player][id]

            if( 
tmp_hits || tmp_rhits )
            {
                
check 1
                tmp_dmg 
pug_dmg[id][player]
                
tmp_rdmg pug_dmg[player][id]

                if(
player == idclient_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_DMG_SELF",tmp_dmg,tmp_hitsget_user_health(player))
                else
                {
                    
get_user_name(player,name31)
                    
client_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_DMG",tmp_dmg,tmp_hits,tmp_rdmg,tmp_rhitsnameget_user_health(player))
                }
            }
          }

        
tmp_hits pug_hits[id][0]
        
tmp_rhits pug_hits[0][id]
        if( 
tmp_hits || tmp_rhits )
        {
            
tmp_dmg pug_dmg[id][0]
            
tmp_rdmg pug_dmg[0][id]
            
client_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_DMG","WorldSpawn",tmp_hits,tmp_dmgget_user_health(player))
        }
        else if(!
checkclient_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_NODMG")
    }
    return 
PLUGIN_CONTINUE;

Attached Files
File Type: sma Get Plugin or Get Source (yap_aux.sma - 1223 views - 9.1 KB)
flamin 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 00:00.


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