Raised This Month: $ Target: $400
 0% 

Damage stacking


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Wasc
Junior Member
Join Date: Apr 2011
Old 04-11-2011 , 02:50   Damage stacking
Reply With Quote #1

I need help to write plugin, which shows damage done.
When player hits a target, in bottom of his screen appears HUD-message with (all damage)+(damage of this hit) in 1 constant.
I have constants:

damage = read_data(2)
dmdone = 0 (starting value)
new killer = get_user_attacker(id) - index, which uses in HUD-msg


I know that this is a cycle, but dont know how organizate it.
without cycle I tried to write:

dmdone = dmdone + damage

But no effect (HUD-message prints value 0 without changes)

P.S. Constant must changes with every hit
P.P.S For Zombie Server
Wasc is offline
!Morte
Veteran Member
Join Date: May 2010
Old 04-11-2011 , 10:40   Re: Damage stacking
Reply With Quote #2

PHP Code:
new g_totaldamage[33]

// Then in take damage

g_totaldamage[attacker] = g_totaldamage[attacker] + floatround(damage)

set_hudmessage(25500, -1.0, -1.006.012.0)
show_hudmessage(id"%d Damage"g_totaldamage[attacker]) 
something like this?
__________________
First Zombie Class
[ZP] Zombie Class: Houndeye Zombie
Quote:
Originally Posted by lucas_7_94 View Post
tenes que saber pawn antes de intentar hacer algo digno.
!Morte is offline
Send a message via MSN to !Morte Send a message via Skype™ to !Morte
Wasc
Junior Member
Join Date: Apr 2011
Old 04-11-2011 , 12:15   Re: Damage stacking
Reply With Quote #3

Constant doesn't change value with new hud.
Always displays 0.
I think that that's must be in a cycle. But dont know how organizate it. I think that if I'll use this actions in condition it always refreshes to 0.
Can you write cycle for me?
Wasc is offline
Wasc
Junior Member
Join Date: Apr 2011
Old 04-12-2011 , 13:43   Re: Damage stacking
Reply With Quote #4

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

new g_MsgSync
new g_MsgSync2
new g_MsgSync3
new g_totaldamage[33]

public 
plugin_init() {
    
register_plugin("Damage Dealt""1.0""Wasc")
    
register_event("Damage","event_damage","b","2!0","3=0","4!0")

    
g_MsgSync CreateHudSyncObj()
    
g_MsgSync2 CreateHudSyncObj()
    
g_MsgSync3 CreateHudSyncObj()
    }
    while(
zp_get_user_zombie(id))
    {
        
g_totaldamage[killer] = g_totaldamage[killer] + floatround(damage)
        
set_hudmessage(2005050, -1.00.8220.130.00.020.02, -1)
        
ShowSyncHudMsg(killer,g_MsgSync3"Damage Meter: %i",g_totaldamage[killer])
    }

Can someone help, please.

Why when someone starts to dealing damage server shutting down. It started when I added cycle "While"

Last edited by Wasc; 05-05-2011 at 16:16.
Wasc is offline
fmcTheKing
Member
Join Date: Feb 2011
Location: Brazil
Old 04-13-2011 , 13:31   Re: Damage stacking
Reply With Quote #5

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

public plugin_init() 
{   
    
register_plugin("Damage","1.0","fmc")
    
    
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamagePost"1)
}

public 
Ham_TakeDamagePost(victim idinflictoridattackerfloat:damagedamagebits
{    
    new 
damage pevvictim pev_dmg_take )
    
    
set_hudmessage(25500, -1.0, -1.006.02.0)
    
show_hudmessage(idattacker "%d"damage)
    
    return 
HAM_HANDLED

=)

#6 [PT-BR] Coloquei sem querer, obrigado por avisar.
__________________


Last edited by fmcTheKing; 04-13-2011 at 14:42.
fmcTheKing is offline
Send a message via MSN to fmcTheKing Send a message via Skype™ to fmcTheKing
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-13-2011 , 14:33   Re: Damage stacking
Reply With Quote #6

Use %d for integers, chief. %s is for strings.
__________________
Bugsy is offline
Wasc
Junior Member
Join Date: Apr 2011
Old 04-14-2011 , 10:38   Re: Damage stacking
Reply With Quote #7

fmcTheKing
Your plugin shows damage, which dealt by last bullet, but not calculating damage.
Wasc is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-14-2011 , 20:20   Re: Damage stacking
Reply With Quote #8

Like this?
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

new const Version[] = "0.1";

const 
MAX_PLAYERS 32;

enum KillData
{
    
CurrentDamage,
    
TotalDamage
}

new 
kdPlayerDataMAX_PLAYERS ][ KillData ];

public 
plugin_init() 
{   
    
register_plugin"Damage Tracker" Version "bugsy" );
    
    
RegisterHamHam_TakeDamage "player" "fw_HamTakeDamage_Post" );
}

public 
fw_HamTakeDamage_PostiVictim iInflictoriAttacker Float:fDamage DamageBits 
{    
    
kdPlayerDataiAttacker ][ TotalDamage ] += ( kdPlayerDataiAttacker ][ CurrentDamage ] = peviVictim pev_dmg_take ) );
    
    
set_hudmessage255 , -1.0 , -1.0 6.0 2.0 );
    
show_hudmessageiAttacker "Total Damage: %d | Attack Damage: %d" kdPlayerDataiAttacker ][ TotalDamage ] , kdPlayerDataiAttacker ][ CurrentDamage ] );
    
    return 
HAM_IGNORED;

__________________

Last edited by Bugsy; 04-14-2011 at 20:23.
Bugsy is offline
fmcTheKing
Member
Join Date: Feb 2011
Location: Brazil
Old 04-14-2011 , 21:46   Re: Damage stacking
Reply With Quote #9

Wasc
Sorry, I do not speak English very well, not just reading the topics, I see the codes.

#palmface for me. =/
__________________

fmcTheKing is offline
Send a message via MSN to fmcTheKing Send a message via Skype™ to fmcTheKing
Wasc
Junior Member
Join Date: Apr 2011
Old 04-15-2011 , 09:10   Re: Damage stacking
Reply With Quote #10

Bugsy
Ty, working. But last question: how can I refresh total damage when started new round.
I tried code in public_init:
PHP Code:
register_event("HLTV""event_round_start""a""1=0""2=0"
And code into body:
PHP Code:
public event_round_start(iAttacker)
{
    for (new 
idid <= 32id++) (kdPlayerDataiAttacker ][ TotalDamage ])[id] = false;

fmcTheKing
No problem. I am not english too

Last edited by Wasc; 04-15-2011 at 12:22.
Wasc 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 20:08.


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