Raised This Month: $ Target: $400
 0% 

Block IN_JUMP when player hold another button


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 03-21-2014 , 01:30   Block IN_JUMP when player hold another button
Reply With Quote #1

Hi everybody, well im trying to block IN_JUMP button when a player hold right, left and forward button at the same time, but i want to activate the button IN_JUMP again when the player stop hold this buttons i mean left, right and forward button, i found a code of connor but i dunno how i can make to block jump button when the player hold the buttons that i mentioned, then when this stop hold button i want to enable the IN_JUMP button again, how i can make this? can someone help me.. thx in advance

another thing can u tell me if the code is fine?

code:

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

#define m_afButtonLast 245 

public plugin_init() 

    
register_forward(FM_CmdStart"OnCmdStart"false


public 
OnCmdStart(idcmd

    static 
buttonsbuttonsChangedbuttonPressedbuttonReleased 
    buttons 
get_uc(cmdUC_Buttons

    
buttonsChanged get_pdata_int(idm_afButtonLast) ^ buttons 

    buttonPressed 
buttonsChanged buttons 
    buttonReleased 
buttonsChanged & ~buttons 

    
if(buttonPressed IN_FORWARD && buttonPressed IN_MOVERIGHT && buttonPressed IN_MOVELEFT
    { 
       
set_pevidpev_oldbuttonspevidpev_oldbuttons ) | IN_JUMP )
    } 
    else if(
buttonReleased  IN_FORWARD && buttonReleased  IN_MOVERIGHT && buttonReleased  IN_MOVELEFT
    { 
        
set_pevidpev_oldbuttonspevidpev_oldbuttons ) & ~IN_JUMP )
    } 


Last edited by wicho; 03-21-2014 at 13:47.
wicho is offline
LukeyB
Member
Join Date: Dec 2011
Old 03-25-2014 , 18:17   Re: Block IN_JUMP when player hold another button
Reply With Quote #2

This should work:

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <orpheu>
#include <orpheu_advanced>
#include <orpheu_memory>
public plugin_init()
{
    
register_plugin"BlockJump""1.0""LukeyB" )
    
OrpheuRegisterHook(OrpheuGetFunction("PM_Jump"),"OnPM_Jump")
}
public 
OrpheuHookReturn:OnPM_Jump()
{
    new 
OrpheuStruct:ppmove get_ppmove()
    new 
id OrpheuGetStructMember(ppmove,"player_index") + 1
    
static button button pev(idpev_button)
    if(
is_user_alive(id) && (button IN_FORWARD || button IN_MOVELEFT || button IN_MOVERIGHT))
    {
        return 
OrpheuSupercede
    
}
    return 
OrpheuIgnored
}
OrpheuStruct:get_ppmove()
{        
    return 
OrpheuGetStructFromAddress(OrpheuStructPlayerMove,OrpheuMemoryGet("ppmove"))

LukeyB is offline
nonserviam
Senior Member
Join Date: May 2013
Old 03-26-2014 , 07:04   Re: Block IN_JUMP when player hold another button
Reply With Quote #3

INS, END, F8, F9 buttons applied for this?
nonserviam is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 03-26-2014 , 11:34   Re: Block IN_JUMP when player hold another button
Reply With Quote #4

Quote:
Originally Posted by nonserviam View Post
INS, END, F8, F9 buttons applied for this?
If your asking if it checks the exact button press, then it's no, also as I read in other threads, you can only block the command sent to the server and not the actual key the command is bound to.
WildCard65 is offline
nonserviam
Senior Member
Join Date: May 2013
Old 03-26-2014 , 11:54   Re: Block IN_JUMP when player hold another button
Reply With Quote #5

Your information useful. Thank you.
nonserviam 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 05:59.


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