AlliedModders

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

shino 06-06-2006 15:05

fakedamage
 
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 :P

nightscreem 06-06-2006 15:30

Try this
if you want to use the function below
put this in the public you want it to be used
Code:
log_kill(enemy,id,"weaponname",1)

Put this in your plugin
Code:
stock log_kill(killer, victim, weapon[],headshot) {     new id = victim     if(has_headshot[killer]) {         set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)         set_user_health(id,-1)         set_msg_block(get_user_msgid("DeathMsg"),BLOCK_NOT)         message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0)         write_byte(killer)         write_byte(victim)         write_byte(headshot)         write_string(weapon)         message_end()         new frags = get_user_frags(killer)         set_user_frags(killer,frags+1)                 return PLUGIN_HANDLED     }     return  PLUGIN_HANDLED }

+Karma should be nice if it works

GHW_Chronic 06-06-2006 15:39

Code:
        set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)         set_user_health(id,-1)         set_msg_block(get_user_msgid("DeathMsg"),BLOCK_NOT)

Code:
user_silentkill(id)

Chex 06-06-2006 16:02

I think this would work. Not too sure though.

Code:
          if(get_user_health(victim) <= 150) {           user_silentkill(victim)           make_deathmsg(attacker,victim, 1, "ak47") } else set_user_health(get_user_health(victim) - 150) //Just for some how if they have more then 150 hp.

If I'm right (I don't really know) +karma? :D

shino 06-06-2006 16:11

i'm not sure you understood me, so i will explain it once more:

zombies have 450 HP. if i shoot them three times into the head, they should die. if i shoot them in other body parts, it would only take 10 HP from them.
but this occures:
[img]http://img389.**************/img389/4738/dedust3dj.jpg[/img]
so, Ron shouldn't be even dead.
i want to sum up the 150 damages and 10 damages so it would show like 5 hits and 470 dmg, because is shot that zombie three times in the head...

can it be solved?


All times are GMT -4. The time now is 16:18.

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