Raised This Month: $ Target: $400
 0% 

Checking if played died from falling.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 07-31-2009 , 17:13   Checking if played died from falling.
Reply With Quote #1

Hi, i don't know how to do this, but how can i check in DeathMsg if played died from falling?

Thanks
-zacky
zacky is offline
Send a message via Skype™ to zacky
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 07-31-2009 , 17:18   Re: Checking if played died from falling.
Reply With Quote #2

probably the killer will be same as attacker oO
__________________
xPaw is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-31-2009 , 17:22   Re: Checking if played died from falling.
Reply With Quote #3

Actually the killer will be 0. So:
Code:
public DeathMsg() {         if (read_data(1))                 return; // Killer is player, stop the function           // Killer is not player         // Most likely Victim fell or found another way to die         // Your code here (Victim is read_data(2)) }
__________________
hleV is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 07-31-2009 , 17:26   Re: Checking if played died from falling.
Reply With Quote #4

Actually xPaw is right, i have in DeathMsg checking if victim is killer, and remove 5 xp from him, but it even happens when changing team, and i dont want like that, so thats why i want to check if victim died from falling.

EDIT: Sorry, you wer're right hleV, i just tried in game, didnt lose 5 xp by falling.

Thanks hleV
+karma

Last edited by zacky; 07-31-2009 at 17:29.
zacky is offline
Send a message via Skype™ to zacky
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 07-31-2009 , 18:32   Re: Checking if played died from falling.
Reply With Quote #5

Is this for DeathRun?
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 08-01-2009 , 07:54   Re: Checking if played died from falling.
Reply With Quote #6

Quote:
Originally Posted by crazyeffect View Post
Is this for DeathRun?
Nop, i'm not even releasing this plugin
zacky is offline
Send a message via Skype™ to zacky
hzqst
Senior Member
Join Date: Jul 2008
Old 08-01-2009 , 08:20   Re: Checking if played died from falling.
Reply With Quote #7

RegisterHam(Ham_TakeDamage, "player", "fw_damage")

public fw_damage(id, inf, attacker, Float:damage, damagetype){
if((damagetype & DMG_FALL) && get_user_health(id) - floatround(damage) <= 0)

//----your code----//

}
hzqst is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-01-2009 , 08:59   Re: Checking if played died from falling.
Reply With Quote #8

DeathMsg way :

Code:
    #include <amxmodx>     public plugin_init ()     {         register_event( "DeathMsg", "CPlayer_Killed", "a", "1=0", "4&world" );     }         public CPlayer_Killed ()     {         // Fallen.     }

Ham way :

Code:
    #include <amxmodx>     #include <fakemeta>     #include <hamsandwich>         const m_bitsDamageType = 76;         public plugin_init ()     {         RegisterHam( Ham_Killed, "player", "CPlayer_Killed" );     }         public CPlayer_Killed ( const Victim, const Attacker )     {         if ( !Attacker && get_pdata_int( Victim, m_bitsDamageType ) & DMG_FALL )         {             // Fallen.         }     }
__________________
Arkshine is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 08-01-2009 , 14:11   Re: Checking if played died from falling.
Reply With Quote #9

Quote:
Originally Posted by hzqst View Post
RegisterHam(Ham_TakeDamage, "player", "fw_damage")

public fw_damage(id, inf, attacker, Float:damage, damagetype){
if((damagetype & DMG_FALL) && get_user_health(id) - floatround(damage) <= 0)

//----your code----//

}
Thats not what i wanted...

Quote:
Originally Posted by Arkshine View Post
DeathMsg way :

Code:
    #include <amxmodx>     public plugin_init ()     {         register_event( "DeathMsg", "CPlayer_Killed", "a", "1=0", "4&world" );     }         public CPlayer_Killed ()     {         // Fallen.     }

Ham way :

Code:
    #include <amxmodx>     #include <fakemeta>     #include <hamsandwich>         const m_bitsDamageType = 76;         public plugin_init ()     {         RegisterHam( Ham_Killed, "player", "CPlayer_Killed" );     }         public CPlayer_Killed ( const Victim, const Attacker )     {         if ( !Attacker && get_pdata_int( Victim, m_bitsDamageType ) & DMG_FALL )         {             // Fallen.         }     }
I can't have that since im using more stuff in deathmsg

EDIT: I think i can use the ham way since im using both DeathMsg and Ham_Killed

EDIT2: Shouldnt this:
PHP Code:
RegisterHamHam_Killed"player""CPlayer_Killed" ); 
be this:
PHP Code:
RegisterHamHam_Killed"player""CPlayer_Killed"); 
?

Last edited by zacky; 08-01-2009 at 14:15.
zacky is offline
Send a message via Skype™ to zacky
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-01-2009 , 14:16   Re: Checking if played died from falling.
Reply With Quote #10

Using DeathMsg, you have just to check if killer is equal to 0 and weapon to "worldspawn". I've put the param directly in the registe_event() but you can do the check in the callback too. You can use 2 register_event() too.
__________________
Arkshine is offline
Reply


Thread Tools
Display Modes

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 18:25.


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