Raised This Month: $ Target: $400
 0% 

[HELP]Save Group Damage


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 10-17-2015 , 08:34   [HELP]Save Group Damage
Reply With Quote #1

So bassicaly i want to add the damage of all the players within togheter into a group damage bool , then display it on a hud
I tried several things, so far i only managed to count their damage togheter in a bool, but when a player joined, for him the group damage was 0...



PHP Code:

enum _
:pdata 
{
    
In_Party,
    
Position,
    
Amount_In_Party,
    
Block_Party,
    
UserName[32],
    
Damage_In_Party
}

new 
g_PartyData[33][pdata], Array:Party_Ids[33]


public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if (
victim == attacker || !is_user_connected(attacker))
        return 
HAM_IGNORED;
    
    if (
g_PartyData[attacker][In_Party])
    {
        new 
Players[32], user
        get_party_index
(attackerPlayers)
        for(new 
ig_PartyData[attacker][Amount_In_Party]; i++)
        {
            
user Players[i]
            if(
is_user_alive(attacker) && !zp_get_user_zombie(attacker))
            {
                
g_PartyData[attacker][Damage_In_Party] += floatround(damage)
                
client_print(userprint_chat"Members: %d"g_PartyData[user][Amount_In_Party])
                
                if(
g_PartyData[Damage_In_Party] >= get_pcvar_num(cvar_damage_reward))
                {
                    
zp_set_user_ammo_packs(userzp_get_user_ammo_packs(user) + get_pcvar_num(cvar_ammo_reward))
                    
g_PartyData[Damage_In_Party] -= g_PartyData[Damage_In_Party]
                    
                }
            }
        }
        
        
g_PlayerDamage[attacker] += floatround(damage)
        
        if(
g_PlayerDamage[attacker] >= 1000)
        {
            
g_PlayerScore[attacker] += 1
            g_PlayerDamage
[attacker] -= 1000
        
}
    }
    return 
HAM_HANDLED;
}

public 
PartyHud(taskid) {
    
    static 
id
    id 
ID_HUD
    
    
if(!is_user_connected(id)) {
        
remove_task(taskid)
        return
    }
    
    static 
CountPartyPartyMsg[256], Players[32], id2
    
static PartyDamage[16]
    
    
CountParty 0
    PartyMsg
[0] = 0
    
    get_party_index
(idPlayers)
    for(new 
ig_PartyData[id][Amount_In_Party]; i++) {
        
        
id2 Players[i]
        
        if(
CountParty)
            
add(PartyMsgcharsmax(PartyMsg), "^n")
        
        
format(PartyMsgcharsmax(PartyMsg), "%s[%d]^t^t^t^t%s"strlen(PartyMsg) ? PartyMsg "[DMG]  -  [Party Members]^n"g_PlayerDamage[id2], g_PartyData[id2][UserName])
        
CountParty++
        
    }
    
    
AddCommas(g_PartyData[Damage_In_Party], PartyDamage15);
    
    
set_hudmessage(255255255get_pcvar_float(cvar_hudx), get_pcvar_float(cvar_hudy), 06.01.0);
    
show_hudmessage(id"%s^n__________________^n|Damage : [%s / %d]|"PartyMsgPartyDamageget_pcvar_num(cvar_damage_reward))


Last edited by Depresie; 10-17-2015 at 08:37.
Depresie is offline
 



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 22:03.


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