Raised This Month: $ Target: $400
 0% 

why i dont get any falldamge after ham_take_damage?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-01-2010 , 20:51   why i dont get any falldamge after ham_take_damage?
Reply With Quote #1

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
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers

Last edited by mottzi; 07-02-2010 at 05:39.
mottzi is offline
Send a message via MSN to mottzi
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 07-02-2010 , 01:53   Re: why i dont get any falldamge after ham_take_damage?
Reply With Quote #2

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.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-02-2010 , 05:42   Re: why i dont get any falldamge after ham_take_damage?
Reply With Quote #3

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
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
Reply



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 07:06.


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