Raised This Month: $ Target: $400
 0% 

How to block player jump or duck?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
@.SizNeR
Member
Join Date: Jun 2013
Old 08-22-2013 , 12:01   How to block player jump or duck?
Reply With Quote #1

How can I block a player jump/duck?
@.SizNeR is offline
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 08-22-2013 , 14:01   Re: How to block player jump or duck?
Reply With Quote #2

you can hook player jump and duck with hamsandwich..
look in mousewheel forcer

Last edited by red_bull2oo6; 08-22-2013 at 14:03.
red_bull2oo6 is offline
@.SizNeR
Member
Join Date: Jun 2013
Old 08-22-2013 , 21:40   Re: How to block player jump or duck?
Reply With Quote #3

Quote:
Originally Posted by red_bull2oo6 View Post
you can hook player jump and duck with hamsandwich..
look in mousewheel forcer
Yes but how i block player jump or duck?
@.SizNeR is offline
Old 08-23-2013, 02:27
LordOfNothing
This message has been deleted by ConnorMcLeod. Reason: troll, or posting random confusing code, or posting for posts count
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 08-23-2013 , 05:21   Re: How to block player jump or duck?
Reply With Quote #4

well you can try this, but idk if it`s accurate.

you can't jump and you can't duck

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

#pragma semicolon 1


#define PLUGIN "New Plugin"
#define VERSION "0.0.1"

new g_iCvarJump;
new 
g_iCvarDuck;

public 
plugin_init( )
{
    
// took the method from mwheel_force.
    
register_pluginPLUGINVERSION"Askhanar" );
    
g_iCvarJump register_cvar"amx_block_jump""1" );
    
g_iCvarDuck register_cvar"amx_block_duck""1" );
    
    
RegisterHamHam_Player_Jump"player""ham_PlayerJumpPre"true );
    
RegisterHamHam_Player_Duck"player""ham_PlayerDuckPre"true );
    
}

public 
ham_PlayerJumpPreid )
{
    if( !
get_pcvar_numg_iCvarJump ) )
        return;
        
    static 
iOldButtons;
    
iOldButtons entity_get_intidEV_INT_oldbuttons );
    
    if( !( 
iOldButtons IN_JUMP ) &&  entity_get_intidEV_INT_flags ) & FL_ONGROUND )
        
entity_set_intidEV_INT_oldbuttonsiOldButtons IN_JUMP );
            
            
}

public 
ham_PlayerDuckPreid )
{
    if( !
get_pcvar_numg_iCvarDuck ) )
        return;
        
    static 
iOldButtons;
    
iOldButtons entity_get_intidEV_INT_oldbuttons );
    
    if( !( 
iOldButtons IN_DUCK ) &&  entity_get_intidEV_INT_flags ) & FL_ONGROUND )
        
entity_set_intidEV_INT_oldbuttonsiOldButtons IN_DUCK );


red_bull2oo6 is offline
Kz1.0
Senior Member
Join Date: Jan 2013
Location: Vietnam
Old 08-23-2013 , 06:57   Re: How to block player jump or duck?
Reply With Quote #5

Quote:
Originally Posted by LordOfNothing View Post
PHP Code:
new pCvar;
new 
tCvar;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("+jump","hook_jump")
    
register_clcmd("+duck","hook_duck")
    
pCvar register_cvar("sv_blockjump","1")
    
tCvar register_cvar("sv_blockduck","1")
}

public 
hook_jump(id)
{
    if(
get_pcvar_numpCvar ))
    {
        return 
1;
    } 
    return 
0;
    
}
public 
hook_duck(id)
{
    if(
get_pcvar_numtCvar ))
    {
        return 
1;
    } 
    return 
0;
    
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1048\\ f0\\ fs16 \n\\ par }
*/ 
wow
Kz1.0 is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 08-23-2013 , 16:10   Re: How to block player jump or duck?
Reply With Quote #6

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

new g_pAllowDuckg_pAllowJump

public plugin_init()
{
    
register_plugin("Block Something""0.001""ZomeGuY")

    
register_forward(FM_CmdStart"fw_CmdStart_Pre"0)

    
g_pAllowDuck register_cvar("amx_allow_duck""0")
    
g_pAllowJump register_cvar("amx_allow_jump""0")
}

public 
fw_CmdStart_Pre(iduc_handleseed)
{
    if(!
is_user_alive(id))
    {
        return;
    }

    new 
iButtons get_uc(uc_handleUC_Buttons)

    if(
iButtons IN_DUCK)
    {
        if(
get_pcvar_num(g_pAllowDuck))
        {
            return;
        }

        
set_uc(uc_handleUC_ButtonsiButtons & ~IN_DUCK)
        return;
    }

    if(
iButtons IN_JUMP)
    {
        if(
get_pcvar_num(g_pAllowJump))
        {
            return;
        }

        
set_uc(uc_handleUC_ButtonsiButtons & ~IN_JUMP)
    }

__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
@.SizNeR
Member
Join Date: Jun 2013
Old 08-23-2013 , 16:30   Re: How to block player jump or duck?
Reply With Quote #7

Quote:
Originally Posted by pokemonmaster View Post
try
PHP Code:
#include <amxmodx>
#include <fakemeta>

new g_pAllowDuckg_pAllowJump

public plugin_init()
{
    
register_plugin("Block Something""0.001""ZomeGuY")

    
register_forward(FM_CmdStart"fw_CmdStart_Pre"0)

    
g_pAllowDuck register_cvar("amx_allow_duck""0")
    
g_pAllowJump register_cvar("amx_allow_jump""0")
}

public 
fw_CmdStart_Pre(iduc_handleseed)
{
    if(!
is_user_alive(id))
    {
        return;
    }

    new 
iButtons get_uc(uc_handleUC_Buttons)

    if(
iButtons IN_DUCK)
    {
        if(
get_pcvar_num(g_pAllowDuck))
        {
            return;
        }

        
set_uc(uc_handleUC_ButtonsiButtons & ~IN_DUCK)
        return;
    }

    if(
iButtons IN_JUMP)
    {
        if(
get_pcvar_num(g_pAllowJump))
        {
            return;
        }

        
set_uc(uc_handleUC_ButtonsiButtons & ~IN_JUMP)
    }

Dont working...
@.SizNeR is offline
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 08-23-2013 , 16:37   Re: How to block player jump or duck?
Reply With Quote #8

Quote:
Originally Posted by red_bull2oo6 View Post
well you can try this, but idk if it`s accurate.

you can't jump and you can't duck

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

#pragma semicolon 1


#define PLUGIN "New Plugin"
#define VERSION "0.0.1"

new g_iCvarJump;
new 
g_iCvarDuck;

public 
plugin_init( )
{
    
// took the method from mwheel_force.
    
register_pluginPLUGINVERSION"Askhanar" );
    
g_iCvarJump register_cvar"amx_block_jump""1" );
    
g_iCvarDuck register_cvar"amx_block_duck""1" );
    
    
RegisterHamHam_Player_Jump"player""ham_PlayerJumpPre"true );
    
RegisterHamHam_Player_Duck"player""ham_PlayerDuckPre"true );
    
}

public 
ham_PlayerJumpPreid )
{
    if( !
get_pcvar_numg_iCvarJump ) )
        return;
        
    static 
iOldButtons;
    
iOldButtons entity_get_intidEV_INT_oldbuttons );
    
    if( !( 
iOldButtons IN_JUMP ) &&  entity_get_intidEV_INT_flags ) & FL_ONGROUND )
        
entity_set_intidEV_INT_oldbuttonsiOldButtons IN_JUMP );
            
            
}

public 
ham_PlayerDuckPreid )
{
    if( !
get_pcvar_numg_iCvarDuck ) )
        return;
        
    static 
iOldButtons;
    
iOldButtons entity_get_intidEV_INT_oldbuttons );
    
    if( !( 
iOldButtons IN_DUCK ) &&  entity_get_intidEV_INT_flags ) & FL_ONGROUND )
        
entity_set_intidEV_INT_oldbuttonsiOldButtons IN_DUCK );


Why using post when you write pre?
__________________
simanovich is offline
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 08-23-2013 , 18:17   Re: How to block player jump or duck?
Reply With Quote #9

from what i know Post = 0 or false ( that's what i understand from here ).

PHP Code:
/**
 * Hooks the virtual table for the specified entity class.
 * An example would be: RegisterHam(Ham_TakeDamage, "player", "player_hurt");
 * Look at the Ham enum for parameter lists.
 *
 * @param function        The function to hook.
 * @param EntityClass    The entity classname to hook.
 * @param callback        The forward to call.
 * @param post            Whether or not to forward this in post.
 * @return                 Returns a handle to the forward.  Use EnableHamForward/DisableHamForward to toggle the forward on or off.
 */
native HamHook:RegisterHam(Ham:function, const EntityClass[], const Callback[], Post=0); 
red_bull2oo6 is offline
@.SizNeR
Member
Join Date: Jun 2013
Old 08-23-2013 , 18:32   Re: How to block player jump or duck?
Reply With Quote #10

I have another thing:
Code:
#include < amxmodx > #include < amxmisc > new g_szAdminsFile[ 64 ]; public plugin_init() {          // ...          get_configsdir( g_szAdminsFile, charsmax( g_szAdminsFile ) );          format( g_szAdminsFile, charsmax( g_szAdminsFile ), "%s/users.ini",  g_szAdminsFile ); } public MyPublic() {          // ...          new iFile = fopen( g_szAdminsFile, "rt" ); }

Error:
PHP Code:
ErrorInvalid symbol name "" on line 422
Error
Undefined symbol "iFile" on line 422 
Line 422:
PHP Code:
new iFile fopeng_szAdminsFile"rt" ); 
Help Please?

Last edited by @.SizNeR; 08-25-2013 at 05:29.
@.SizNeR 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 19:14.


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