AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Weapon Damage (https://forums.alliedmods.net/showthread.php?t=51207)

Vegetaz 02-13-2007 14:01

Weapon Damage
 
Code:

#include <amxmod>
#include <Vexd_Utilities>
#include <Fun>

public plugin_init()
{
        register_plugin("Scout Damage", "99.9", "Blah")
        register_event("Damage", "scout_damage", "b", "2!0")
}
public damage(id)
{
        if (!is_user_alive(id)) return

        new damage = read_data(2)
        new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
        new headshot = bodypart == 1 ? 1 : 0

        if ( weapon == CSW_SCOUT && is_user_alive(id) ) {
                new extraDamage = floatround(damage * 2.0") - damage)
                if (extraDamage > 0) ExtraDamage( id, attacker, extraDamage, "scout", headshot )
        }
}

If someone says how to fix this code, i will apriciate that :)

XxAvalanchexX 02-13-2007 17:55

Re: Weapon Damage
 
Code:
#include <amxmodx> // used to be "amxmod", that's an old AMX include #include <engine> // used to be "Vexd_Utilities", that's an old AMX include #include <fun> // used to be "Fun", I believe includes are case-sensitive? public plugin_init() {     register_plugin("Scout Damage", "99.9", "Blah")     register_event("Damage", "scout_damage", "b", "2!0") } public scout_damage(id) // used to be "damage", but that's not how you registered it {     if (!is_user_alive(id)) return     new damage = read_data(2)     new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)     new headshot = bodypart == 1 ? 1 : 0     if ( weapon == CSW_SCOUT ) { // removed is_user_alive check, you already did one         // got rid of extraDamage calculation         ExtraDamage( id, attacker, float(damage), "weapon_scout", headshot ) // don't check for 0 damage, it's done in your register_event     } } stock ExtraDamage(victim,attacker,Float:damage,weapon[],headshot) {     new Float:health = entity_get_float(victim,EV_FL_health);     if(health <= 0.0) return;     if(health - damage <= 0.0)     {         user_silentkill(victim);         make_deathmsg(attacker,victim,headshot,weapon);         set_user_frags(attacker,get_user_frags(attacker)+1);     }     else fakedamage(victim,weapon,damage,DMG_BULLET); }

This should convert it to AMXX and get it to work. I changed your extraDamage part, because (damage * 2) - damage is the same as damage * 1, so I assume you just want double damage. I also added an ExtraDamage function, because AMXX doesn't have one by default.

[ --<-@ ] Black Rose 02-13-2007 18:07

Re: Weapon Damage
 
He's running AMX.

XxAvalanchexX 02-13-2007 18:36

Re: Weapon Damage
 
Well then... upgrade. AMX is no longer supported.


All times are GMT -4. The time now is 00:40.

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