Raised This Month: $ Target: $400
 0% 

Weapon Damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vegetaz
Member
Join Date: Oct 2006
Old 02-13-2007 , 14:01   Weapon Damage
Reply With Quote #1

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
Vegetaz is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-13-2007 , 17:55   Re: Weapon Damage
Reply With Quote #2

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.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS

Last edited by XxAvalanchexX; 02-13-2007 at 18:00.
XxAvalanchexX is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 02-13-2007 , 18:07   Re: Weapon Damage
Reply With Quote #3

He's running AMX.
[ --<-@ ] Black Rose is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-13-2007 , 18:36   Re: Weapon Damage
Reply With Quote #4

Well then... upgrade. AMX is no longer supported.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 00:40.


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