Raised This Month: $ Target: $400
 0% 

Ham Damage (Knife)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
mentalproblems
Junior Member
Join Date: Mar 2019
Old 09-15-2019 , 07:06   Re: Ham Damage (Knife)
Reply With Quote #4

Okay, but what should I correct here then so it should work?
Or how should I convert this to RegisterHam?

Here's the source of knife damage.

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

new g_iDamage

public plugin_init() {
    
    
register_plugin("Knife Damage""2.0""alKapone")
    
register_event("Damage""event_damage""be")
    
    
g_iDamage register_cvar("rgc_knife_damage""2")
}

public 
event_damage(id) {
    
    new 
victim id;
    if(!
is_user_connected(victim)) return PLUGIN_CONTINUE
    
new dmg_take read_data(2);
    new 
dmgtype read_data(3);
    new 
Float:multiplier get_pcvar_float(g_iDamage);
    new 
Float:damage dmg_take multiplier;
    new 
health get_user_health(victim);
    
    new 
iWeapIDattacker_id get_user_attacker(victimiWeapID);
    
    if(!
is_user_connected(attacker_id) || !is_user_alive(victim)) {
        return 
PLUGIN_HANDLED
    
}
    
    if(
iWeapID == CSW_KNIFE) {
        
        if(
floatround(damage) >= health) {
            if(
victim == attacker_id) {
                return 
PLUGIN_CONTINUE
            
}
            else {
                
log_kill(attacker_idvictim"knife"0);
            }
            
            return 
PLUGIN_CONTINUE
        
}
        else {
            if(
victim == attacker_id) return PLUGIN_CONTINUE
            
            fakedamage
(victim"weapon_knife"damagedmgtype);
        }
    }
    return 
PLUGIN_CONTINUE
}

stock log_kill(killervictimweapon[],headshot) {
    
user_silentkill(victim);
    
    
message_begin(MSG_ALLget_user_msgid("DeathMsg"), {0,0,0}, 0);
    
write_byte(killer);
    
write_byte(victim);
    
write_byte(headshot);
    
write_string(weapon);
    
message_end();
    
    new 
kfrags get_user_frags(killer);
    
set_user_frags(killerkfrags++);
    new 
vfrags get_user_frags(victim);
    
set_user_frags(victimvfrags++);
    
    return  
PLUGIN_CONTINUE


Last edited by mentalproblems; 09-15-2019 at 07:07.
mentalproblems 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 17:23.


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