Raised This Month: $ Target: $400
 0% 

fakedamage


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
shino
Senior Member
Join Date: May 2006
Old 06-06-2006 , 15:05   fakedamage
Reply With Quote #1

i want to set damage, dealt to the enemy, if hit into the head or in other body part. if it would be shot into the head, it would deduct 150 from victim's health and then set the damage that attacker did to victim to 150. same if other part of body than head would be hit, only the number is different. code:
Code:
public plugin_init() {     register_cvar( "amx_zombiebot_hsdamage", "150" )     register_cvar( "amx_zombiebot_damage", "10" )     register_event( "Damage", "ZombieDamage", "be" ) } public ZombieDamage( id, hitplace, headshot ) {     if( get_cvar_num("amx_zombiebot") != 1 ) {         return PLUGIN_HANDLED     }     new hsdamage, damage, victim, vichealth, attacker, weap, attfrags, dmgtype     hsdamage = get_cvar_num( "amx_zombiebot_hsdamage" )     damage = get_cvar_num( "amx_zombiebot_damage" )     victim = id     vichealth = get_user_health( victim )     attacker = get_user_attacker( victim, weap )     attfrags = get_user_frags( attacker )     dmgtype = read_data( 3 )     if( !is_user_connected( attacker ) || !is_user_alive( victim )) {         return PLUGIN_HANDLED     }     if( is_user_bot( victim )) {         if( damage > 0 ){             if( hitplace == HIT_HEAD ) {                 set_user_health( victim, vichealth - get_cvar_num("amx_zombiebot_hsdamage"))                 switch(weap) {                     case CSW_AK47: {                         fakedamage( victim, "weapon_ak47", float(hsdamage), dmgtype )                     }                     // ...                     case CSW_XM1014: {                         fakedamage( victim, "weapon_xm1014", float(hsdamage), dmgtype )                     }                 }             }             if( hitplace != HIT_HEAD ) {                 set_user_health( victim, vichealth - get_cvar_num("amx_zombiebot_damage"))                 switch(weap) {                     case CSW_AK47: {                         fakedamage( victim, "weapon_ak47", float(damage), dmgtype )                     }                                         // ...                     case CSW_XM1014: {                         fakedamage( victim, "weapon_xm1014", float(damage), dmgtype )                     }                 }             }         }         if( damage > vichealth ) {             switch(weap) {                 case CSW_AK47: {                                        user_silentkill( victim )                     make_deathmsg( attacker, victim, headshot, "ak47" )                 }                 // ...                 case CSW_XM1014: {                     user_silentkill( victim )                     make_deathmsg( attacker, victim, headshot, "xm1014" )                 }                       }             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE }

what is wrong? thanks
shino 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 16:18.


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