What's wrong with my code?
#8
(04-29-2013, 04:38 AM)xoft Wrote: There are three TakeDamage functions in cPawn, none of them matches what you're calling:
/// Makes this pawn take damage from an attack by a_Attacker. Damage values are calculated automatically and DoTakeDamage() called
void TakeDamage(cPawn & a_Attacker);
	
/// Makes this pawn take the specified damage. The final damage is calculated using current armor, then DoTakeDamage() called
void TakeDamage(eDamageType a_DamageType, cPawn * a_Attacker, int a_RawDamage, double a_KnockbackAmount);

/// Makes this pawn take the specified damage. The values are packed into a TDI, knockback calculated, then sent through DoTakeDamage()
void TakeDamage(eDamageType a_DamageType, cPawn * a_Attacker, int a_RawDamage, int a_FinalDamage, double a_KnockbackAmount);
The first one calculates damage based on what the attacker is wielding - not what you want here.
The second one subtracts armor value from RawDamage and deals that to the pawn - could be used, but the third one is better.
The third one uses everything that you specify and just deals the damage.

Note: Don't set a_Attacker to the player issuing the command, otherwise if we ever get the plugin that checks player distance before allowing damage, it would most likely forbid the kill. Use nil instead:
OtherPlayer:TakeDamage(dtInVoid, nil, 1000, 1000, 0);

In rev 1429 and later, you should also use dtAdmin or dtPlugin instead of dtInVoid.
Thx it worked
Reply
Thanks given by:


Messages In This Thread
What's wrong with my code? - by tonibm19 - 04-28-2013, 09:04 PM
RE: What's wrong with my code? - by NiLSPACE - 04-28-2013, 09:46 PM
RE: What's wrong with my code? - by xoft - 04-28-2013, 11:40 PM
RE: What's wrong with my code? - by tonibm19 - 04-29-2013, 04:14 AM
RE: What's wrong with my code? - by NiLSPACE - 04-29-2013, 04:20 AM
RE: What's wrong with my code? - by tonibm19 - 04-29-2013, 04:24 AM
RE: What's wrong with my code? - by xoft - 04-29-2013, 04:38 AM
RE: What's wrong with my code? - by tonibm19 - 04-29-2013, 04:41 AM



Users browsing this thread: 8 Guest(s)