AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detect if user jumped (https://forums.alliedmods.net/showthread.php?t=162213)

plowed 07-16-2011 09:23

Detect if user jumped
 
I want to detect if a user is jumped and store it in a variable.
smth like this.

PHP Code:

if (jump)
jumpcount++ 

Ive searched in forum and some .inc files but found nothing.

dFF 07-16-2011 09:36

Re: Detect if user jumped
 
PHP Code:

#include < hamsandwich >

RegisterHamHam_Player_Jump"player""Player_Jump" )

public 
Player_Jumpid )
{
    
// check if user alive
        
countid ]++

    
// ...



Bugsy 07-16-2011 09:47

Re: Detect if user jumped
 
Quote:

Originally Posted by dFF (Post 1511830)
PHP Code:

#include < hamsandwich >

RegisterHamHam_Player_Jump"player""Player_Jump" )

public 
Player_Jumpid )
{
    
// check if user alive
        
countid ]++

    
// ...



Did you test your code?

Edit: Added check for if is on ground.

PHP Code:

#include <amxmodx>
#include <fakemeta>

new const Version[] = "0.1";

new 
g_iJumpCount33 ];

public 
plugin_init() 
{
    
register_plugin"Jump Count" Version "bugsy" );
    
    
register_forwardFM_CmdStart "fw_FMCmdStart" );
    
register_clcmd"say /jumps" "CmdCheckJumps" );
}

public 
client_putinserverid )
{
    
g_iJumpCountid ] = 0;
}

public 
CmdCheckJumpsid )
{
    
client_printid print_chat "* You have jumped %d times!" g_iJumpCountid ] );
    return 
PLUGIN_HANDLED;
}

public 
fw_FMCmdStartid handle seed )
{
    if ( ( 
get_uchandle UC_Buttons ) & IN_JUMP ) && !( pevid pev_oldbuttons ) & IN_JUMP ) && ( pevid pev_flags ) & FL_ONGROUND ) )
        
g_iJumpCountid ]++;



Stang 07-16-2011 23:47

Re: Detect if user jumped
 
I tried your plugin bugsy, and I found a bug. After you jump for awhile itll start counting your jumps by 5's and 4's etc... then go back down to normal.

Exolent[jNr] 07-17-2011 00:05

Re: Detect if user jumped
 
You also need to check if player is on ground.

Bugsy 07-17-2011 10:07

Re: Detect if user jumped
 
Fixed

Rossonero 03-15-2012 10:52

Re: Detect if user jumped
 
while thank you so much Bugsy & co.

I'm on the verge of creating a solution against bunny hop and flop and stuff :)
hopefully it will work


All times are GMT -4. The time now is 00:48.

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