AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Checking if played died from falling. (https://forums.alliedmods.net/showthread.php?t=99006)

zacky 07-31-2009 17:13

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

Thanks
-zacky

xPaw 07-31-2009 17:18

Re: Checking if played died from falling.
 
probably the killer will be same as attacker oO

hleV 07-31-2009 17:22

Re: Checking if played died from falling.
 
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)) }

zacky 07-31-2009 17:26

Re: Checking if played died from falling.
 
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

crazyeffect 07-31-2009 18:32

Re: Checking if played died from falling.
 
Is this for DeathRun?

zacky 08-01-2009 07:54

Re: Checking if played died from falling.
 
Quote:

Originally Posted by crazyeffect (Post 886991)
Is this for DeathRun?

Nop, i'm not even releasing this plugin

hzqst 08-01-2009 08:20

Re: Checking if played died from falling.
 
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----//

}

Arkshine 08-01-2009 08:59

Re: Checking if played died from falling.
 
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.         }     }

zacky 08-01-2009 14:11

Re: Checking if played died from falling.
 
Quote:

Originally Posted by hzqst (Post 887424)
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 (Post 887453)
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"); 

?

Arkshine 08-01-2009 14:16

Re: Checking if played died from falling.
 
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.


All times are GMT -4. The time now is 18:25.

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