AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   why i dont get any falldamge after ham_take_damage? (https://forums.alliedmods.net/showthread.php?t=131173)

mottzi 07-01-2010 20:51

why i dont get any falldamge after ham_take_damage?
 
Hello. Im scripting an anti-understabb plugin. But now i dont get any Falldamage! (When i clear the take_damage event compleatly, it works fine!)

Here is my code:
PHP Code:

public plugin_init() 
{
    
register_plugin("Anti-Understabb""2.0""Mottzi")
    
RegisterHam(Ham_TakeDamage"player""take_damage")


Please help

Emp` 07-02-2010 01:53

Re: why i dont get any falldamge after ham_take_damage?
 
You should learn to check your error logs.

Most likely what is happening is that you are getting an error from the entity_get_vector native. This is happening because during fall damage, you are taking damage from the world and not an entity (the attacker is 0). Enabling debug on your plugin would have easily told you this.

The error is unintentionally blocking the damage. You can fix this by checking to make sure the attacker is a valid entity, but you should also be checking if it is a valid player because you are getting the attacker's weapon and the attacker will not always be a player.

I would also like to point out that you are using the wrong return values for the Ham forward. Look into the HAM_* constants.

Lastly, the code you provide does not even compile cleanly (not that I tried, but I can spot something that would give you a warning). Before asking about a run time problem, you should be more worried about getting your code to compile correctly.

mottzi 07-02-2010 05:42

Re: why i dont get any falldamge after ham_take_damage?
 
Hello. First, Thanks that you take you time for me.

Im scripting since 2 Weeks now. You have to understand, i dont rlly know what the debug mode does. But now i do! And i looked in my error log: Native get_user_weapon.

I tryed to get attackers weapon until the attacker was 0 (world), like you said.)

From now on i gonna look in the logs first and thanks for the debug tip very usefull

Mottzi


All times are GMT -4. The time now is 07:06.

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