Raised This Month: $ Target: $400
 0% 

A way to make No fall damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 12-31-2009 , 07:08   A way to make No fall damage
Reply With Quote #1

I searched some codes, but I cant get it.
I need a way to add fall damage to a menu (shop).
__________________
Please help me with this Thread
I am 70% addicted to Counterstrike. What about you?
Ill make any spanish translation of a plugin. Just ask for it
benamo6 is offline
Send a message via MSN to benamo6
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-31-2009 , 07:21   Re: A way to make No fall damage
Reply With Quote #2

create a global variable that handles if players are immuned or not about fall damage, change that variable when a player buy no fall damage, or die or whatever.

PHP Code:
const MAX_PLAYERS 32

new g_bNoFallDamage[MAX_PLAYERS+1]

public 
plugin_init()
{
    
RegisterHam(Ham_TakeDamage"player""Ham_CBasePlayer_TakeDamage_Pre")
}

public 
Ham_CBasePlayer_TakeDamage_Pre( const id, const iInflictor, const iAttacker, const Float:flDamage, const iDamageType )
{
    if( 
iDamageType == DMG_FALL && g_bNoFallDamage[id] )
    {
    
//    SetHamParamFloat(4, 0.0)
        
SetHamReturnInteger(0)
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 12-31-2009 , 07:23   Re: A way to make No fall damage
Reply With Quote #3

Why is this line commented?
PHP Code:
//    SetHamParamFloat(4, 0.0) 
__________________
Please help me with this Thread
I am 70% addicted to Counterstrike. What about you?
Ill make any spanish translation of a plugin. Just ask for it

Last edited by benamo6; 12-31-2009 at 07:28.
benamo6 is offline
Send a message via MSN to benamo6
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-31-2009 , 07:25   Re: A way to make No fall damage
Reply With Quote #4

Because i don't think it is needed, you could use it and don't set the return interger though.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-31-2009 , 07:26   Re: A way to make No fall damage
Reply With Quote #5

In case returning 0 won't work I guess, you can change on the fly the damage param since if damage is 0 the function will be aborted. But returning 0 should work.
__________________
Arkshine is offline
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 12-31-2009 , 07:29   Re: A way to make No fall damage
Reply With Quote #6

Thanks, but im new at scripting, I added all those things to my code, but I dont know how to make this
Quote:
create a global variable that handles if players are immuned or not about fall damage, change that variable when a player buy no fall damage, or die or whatever.
Can you give me an example please?
__________________
Please help me with this Thread
I am 70% addicted to Counterstrike. What about you?
Ill make any spanish translation of a plugin. Just ask for it
benamo6 is offline
Send a message via MSN to benamo6
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-31-2009 , 07:30   Re: A way to make No fall damage
Reply With Quote #7

It is already done, g_bNoFallDamage is the variable.
When a player buy no falldamage, set g_bNoFallDamage[id] = true
Set it to false in client_putinserver, and if you need in player spawn/dies etc..
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Old 12-31-2009, 07:32
benamo6
This message has been deleted by benamo6.
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 12-31-2009 , 07:41   Re: A way to make No fall damage
Reply With Quote #8

I get an error when I compile.
Undefined symbol "id" on line 510 (this is the line where I have g_bNoFallDamage[id] = true)
__________________
Please help me with this Thread
I am 70% addicted to Counterstrike. What about you?
Ill make any spanish translation of a plugin. Just ask for it
benamo6 is offline
Send a message via MSN to benamo6
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-31-2009 , 07:44   Re: A way to make No fall damage
Reply With Quote #9

Replace 'id' by the var you use for the player.
__________________
Arkshine is offline
AppStore
BANNED
Join Date: Dec 2009
Location: Saladillo
Old 12-31-2009 , 08:17   Re: A way to make No fall damage
Reply With Quote #10

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

const MAX_PLAYERS 32

new g_bNoFallDamage[MAX_PLAYERS+1]

public 
plugin_init()
{
    
RegisterHam(Ham_TakeDamage"player""Ham_CBasePlayer_TakeDamage_Pre")
}

public 
Ham_CBasePlayer_TakeDamage_Pre( const id, const iInflictor, const iAttacker, const Float:flDamage, const iDamageType )
{
    if( 
iDamageType == DMG_FALL && g_bNoFallDamage[id] )
    {
    
//    SetHamParamFloat(4, 0.0)
        
SetHamReturnInteger(0)
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED

AppStore is offline
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 04:12.


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