AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Damage Event with TS (https://forums.alliedmods.net/showthread.php?t=49267)

Fred Dawes 12-31-2006 00:05

Damage Event with TS
 
I wish to multiply the damage given with Kung Fu by X amount. Here is my code.
Code:
#include <amxmodx> #include <amxmisc> #include <tsfun> #include <engine> #include <fun> #include <tsxaddon> register_event("Damage", "Damage", "b", "2!0") //..... new KungFuMultiplier = 1.4 //..... public Damage() {       new victim = read_data(0) // Victim ID     new damage = read_data(2) // Damage     new weapon, bodypart, attacker = get_user_attacker(victim, weapon, bodypart)     client_print(attacker,print_chat,"Damage Event Recognized")     if (weapon == TSW_KUNG_FU ) {         client_print(attacker,print_chat,"Kung Fu Damage Event Recognized")         // Do extra damage         new newDamage = floatround(damage * (g_fightskills[attacker] / 100) + damage)         if (get_user_health(victim) <= newDamage)         {             set_user_health(victim, 1)             client_print(attacker,print_chat,"Your opponent now has 1 HP!")             client_print(victim,print_chat,"You are at 1 HP!")         }else{             set_user_health(victim,(get_user_health(victim) - newDamage))             client_print(attacker, print_chat,"%i damage done",newDamage)         }     } }

My error: It compiles fine, but it doesn't work. The debug messages don't even show up. Does the Damage event not work with The Specialists?

XxAvalanchexX 12-31-2006 00:27

Re: Damage Event with TS
 
No, TS doesn't use the Damage event. There might be a TSDamage event, if not you'll have to stick with TSHealth.

stupok 12-31-2006 04:14

Re: Damage Event with TS
 
Code:
register_event("PTakeDam", "PTakeDam_function", "a") register_message(50, "damage_function")

PTakeDam provides the amount of damage dealt.
50 (it has no name) is called directly after PTakeDam, and provides the id's of the victim(2) and killer(3)

I'm still not certain, though, when to use register_event() and when to use register_message() :shock:


EDIT: I checked again, and I'd go with TSHealth instead of PTakeDam.

Minimum 12-31-2006 04:46

Re: Damage Event with TS
 
I talked with him over XFire. I helped him get it working.

I just had him use client_damage.

spider853 12-31-2006 09:21

Re: Damage Event with TS
 
I Think You Dont Use'it Right...
For Exampler Sombody Make Damage To Other Player
100 HP - 50 HP
DAMAGE=50 HP
IF You Multiply This With 1.5 This Will Be DAMAGE (FROM CS) - Multiply Damge (FROM SCRIPT) 50 - 75 = 1 (SCRIPT<0)

If You Want To Multiply DMG With 1.4 Then You Need To Set KungFuMultiplier = 0.4

Or To Substract 1.... (KungFuMultiplier - 1)


All times are GMT -4. The time now is 22:23.

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