Raised This Month: $114 Target: $400
 28% 

Fall Movement


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands        Approver:   Exolent[jNr] (178)
Paulster1022
Member
Join Date: Apr 2006
Old 12-11-2008 , 00:44   Fall Movement
Reply With Quote #1

Description:
When a player falls, their movement decreases for an amount of time. Their screen will also take a fade effect for that given time.

Cvars:
fm_damage(default:25) = If the damage the player receives from falling is greater than or equal too the value, then this plugin will take effect.
fm_length(default:5) = Seconds a player has before recovery.(DO not make this cvar exceed 10 seconds, it will glitch the movement.)

Modules:
Fakemeta
Hamsandwich

Credits:
Connorr

Updates:
0.1 - First release
0.2 - New method with pev_fuser2(thanks connorr), optimized coding, and added new cvar.
0.3 - Fixed glitch with breaking out of movement with jump.
0.4 - Optimized code
0.5 - Added heartbeat sound with more optimization
0.6 - Fixed heartbeat sound bug
Attached Files
File Type: sma Get Plugin or Get Source (Fall_Movement.sma - 1501 views - 2.5 KB)

Last edited by Paulster1022; 12-15-2008 at 22:52.
Paulster1022 is offline
Send a message via AIM to Paulster1022
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-11-2008 , 02:07   Re: Fall Movement
Reply With Quote #2

May be set a high value to pev_fuser2 would have the same effect and then you wouldn't have to use a task, hook CurWeapon, set speed etc...
__________________
- tired and retired -
ConnorMcLeod is offline
mando127
Veteran Member
Join Date: Dec 2006
Location: virginia
Old 12-11-2008 , 12:53   Re: Fall Movement
Reply With Quote #3

good plugin im using it as a new kind of parachute the one i was using needed a skin this one yet not a parachute will work fine GJ.
__________________
mando127 is offline
Send a message via Skype™ to mando127
Paulster1022
Member
Join Date: Apr 2006
Old 12-11-2008 , 17:05   Re: Fall Movement
Reply With Quote #4

Think i might of made the final update, might add more to it.

Last edited by Paulster1022; 12-11-2008 at 22:28.
Paulster1022 is offline
Send a message via AIM to Paulster1022
Old 12-12-2008, 16:32
Paulster1022
This message has been deleted by Paulster1022.
Paulster1022
Member
Join Date: Apr 2006
Old 12-12-2008 , 18:17   Re: Fall Movement
Reply With Quote #5

Ill see if this plugin becomes approved or not
Paulster1022 is offline
Send a message via AIM to Paulster1022
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-13-2008 , 03:38   Re: Fall Movement
Reply With Quote #6

pev(id, pev_fuser2) >= 1000.0

pev_fuser2 is a float.
For all pev that are not integers, you have to do this way :

new Float:flFuser2
pev(id, pev_fuser2, flFuser2)
if( flUser2 >= 1000.0 )

Also, i think you could optimize a bit doing something like this :
PHP Code:
public TakeDamage(ididinflictoridattackerFloat:damagedamagebits)
{
    if( (
damagebits DMG_FALL) || damage get_pcvar_float(fm_damage))
        return

    new 
length SECONDS_TO_SCREENFADE_UNITS(get_pcvar_num(fm_length))

    
message_begin(MSG_ONE_UNRELIABLEgmsgScreenFade_id
    
write_short(length)
    
write_short(length)
    
write_short(1<<1
    
write_byte(50
    
write_byte(50
    
write_byte(50
    
write_byte(250
    
message_end()

    
// lenght has already been multiplied by 4096
    // so divide it by 4 makes basically previous * 1000
    
set_pev(idpev_fuser20.25 length)

__________________
- tired and retired -
ConnorMcLeod is offline
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 12-13-2008 , 12:04   Re: Fall Movement
Reply With Quote #7

well i tried it and it look poor so i added hud message and a nice sound from hl
maybe you could add this things to the plugin and change sound for a screem or wathever u want.

Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
 
#define DMG_FALL (1<<5)
#define SECONDS_TO_SCREENFADE_UNITS(%1) floatround(float((1<<12)) * (%1))

new fm_length, fm_damage, shade
public plugin_init() 
{
    register_plugin("Fall Movement","0.3","Quick-Gun")

    /* Ham Sandwich Register */
    RegisterHam(Ham_TakeDamage, "player", "fwd_TakeDamage")
    RegisterHam(Ham_Player_Jump, "player", "Player_Jump")

    /* Cvars */
    fm_length = register_cvar("fm_length", "2")
    fm_damage = register_cvar("fm_damage", "50")
    precache_sound("player/pl_die1.wav");  // precached the sound

    /* Message */
    shade = get_user_msgid("ScreenFade")
}

// ================ Take Damage Event ======================================
public fwd_TakeDamage(id, idinflictor, idattacker, Float:damage, damagebits)
{
    if( (is_user_alive(id)) && (damagebits & DMG_FALL) )
    {
    if(damage >= get_pcvar_float(fm_damage))
    {
        emit_sound(id, CHAN_BODY, "player/pl_die1.wav", 1.0, ATTN_NORM , 0, PITCH_NORM); // emit sound when hit the ground
        set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 1.0, 3.0); // set hudmessage on midle of screen
        show_hudmessage(id, "You are hurt!") 
        message_begin(MSG_ONE,shade,{0,0,0},id) 
           write_short(SECONDS_TO_SCREENFADE_UNITS(get_pcvar_num(fm_length) - 2))
            write_short(SECONDS_TO_SCREENFADE_UNITS(get_pcvar_num(fm_length) - 2))
        write_short(1<<1) 
        write_byte(50) 
        write_byte(50) 
        write_byte(50) 
        write_byte(250) 
        message_end()
        set_pev(id, pev_fuser2, get_pcvar_float(fm_length) * 1000.0)
    }
     }
}

// ============ Player Jump ============================
public Player_Jump(id)
{
    //Blocks jump when player has fallen movement
    if(is_user_alive(id))
    {
        if(pev(id, pev_fuser2) >= 1000.0)
        {
            static iOldButtons;
            iOldButtons = pev(id, pev_oldbuttons);
            if( !(iOldButtons & IN_JUMP) )
            {
                set_pev(id, pev_oldbuttons, iOldButtons | IN_JUMP);
            }
        }
    }
}
__________________
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-13-2008 , 14:16   Re: Fall Movement
Reply With Quote #8

I don't like the idea of a hudmessage.
Also, to be sure that the damage has been done, you should post-register the forward.
__________________
- tired and retired -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-13-2008 , 14:43   Re: Fall Movement
Reply With Quote #9

FYI, no need to define DMG_FALL, it's already done in hlsdk_const
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-13-2008 , 17:05   Re: Fall Movement
Reply With Quote #10

Quote:
Originally Posted by arkshine View Post
FYI, no need to define DMG_FALL, it's already done in hlsdk_const
Only if you include fakemeta because it includes hlsdk_const
__________________
- tired and retired -
ConnorMcLeod 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 11:54.


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