Raised This Month: $ Target: $400
 0% 

Solved Damage Event not working?!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
MihaiGamerXD
Member
Join Date: Aug 2018
Old 11-27-2018 , 16:08   Damage Event not working?!
Reply With Quote #1

Hello and I don't understand why the damage event is not working?

Here is the code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>

static zombie[33]

public 
plugin_init() {
    
register_plugin("Block Damage","1.0","MihaiGamerXD")
    
RegisterHam(Ham_TakeDamage,"player","onDamage")
    
register_event("HLTV""onNewRound""a","1=0","2=0")
}

public 
onNewRound() {
    new 
id get_random_player("a")
    
cs_set_user_team(id,CS_TEAM_T)
    
zombie[id] = true
}

public 
onDamage(victiminflictorattackerFloat:damagedmg_bits) {
        if (
zombie[attacker]) {
        new 
last get_birds("a");
        if (
last == 1)
            return 
HAM_IGNORED;
        
        
cs_set_user_team(victim,CS_TEAM_T);
        
set_user_health(victim,500);
        
strip_user_weapons(victim);
        
give_item(victim,"weapon_ak47");
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}

stock get_random_player(const flags[]="", const team[]="") {
    new 
players[32], pnum;
    
get_players(playerspnumflagsteam);
    
    return (
pnum 0) ? players[random(pnum)] : -1;
}

stock get_birds(const flags[]="", const team[]="") {
    new 
players[32], pnumbirdsid;
    
get_players(playerspnumflagsteam);

    for (--
pnumpnum >= 0pnum--)
    {
        
id players[pnum];

        if (!
zombie[id])
            
birds++;
    }

    return 
birds;

And it doesn't work, it doesn't do nothing! Is something wrong or it's a bug?

Last edited by MihaiGamerXD; 12-03-2018 at 12:45. Reason: It Worked
MihaiGamerXD is offline
 


Thread Tools
Display Modes

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 07:36.


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