AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   i'd like to change that code to f key. (https://forums.alliedmods.net/showthread.php?t=303509)

laenss 12-10-2017 06:04

i'd like to change that code to f key.
 
i'd like to change that code to f key.

it's hard to fix.

plz help!!

PHP Code:

public Action:OnPlayerRunCmd(Client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if(
buttons IN_SPEED)
    {
        if(
IsClientInGame(Client) && IsPlayerAlive(Client) && !KeyBuffer[Client])
        {
            if(
Special[Client][CT_LEADER] == 1)
            {
                
DisplayMenu_Leader(Client);
            }
            if(
Special[Client][TR_TRADER] == 1)
            {
                
DisplayMenu_Trader(Client);
            }
            if(
Special[Client][TR_TERROR] == 1)
            {
                
DisplayMenu_Boooom(Client);
            }
            
KeyBuffer[Client] = true;
        }
    }
    else
    {
        
KeyBuffer[Client] = false;
    }
    return 
Plugin_Continue;



oplkill 12-10-2017 07:34

Re: i'd like to change that code to f key.
 
There only values for variable Button

PHP Code:

// These defines are for client button presses.
#define IN_ATTACK        (1 << 0)
#define IN_JUMP            (1 << 1)
#define IN_DUCK            (1 << 2)
#define IN_FORWARD        (1 << 3)
#define IN_BACK            (1 << 4)
#define IN_USE            (1 << 5)
#define IN_CANCEL        (1 << 6)
#define IN_LEFT            (1 << 7)
#define IN_RIGHT        (1 << 8)
#define IN_MOVELEFT        (1 << 9)
#define IN_MOVERIGHT        (1 << 10)
#define IN_ATTACK2        (1 << 11)
#define IN_RUN            (1 << 12)
#define IN_RELOAD        (1 << 13)
#define IN_ALT1            (1 << 14)
#define IN_ALT2            (1 << 15)
#define IN_SCORE        (1 << 16)       /**< Used by client.dll for when scoreboard is held down */
#define IN_SPEED        (1 << 17)    /**< Player is holding the speed key */
#define IN_WALK            (1 << 18)    /**< Player holding walk key */
#define IN_ZOOM            (1 << 19)    /**< Zoom key for HUD zoom */
#define IN_WEAPON1        (1 << 20)    /**< weapon defines these bits */
#define IN_WEAPON2        (1 << 21)    /**< weapon defines these bits */
#define IN_BULLRUSH        (1 << 22)
#define IN_GRENADE1        (1 << 23)    /**< grenade 1 */
#define IN_GRENADE2        (1 << 24)    /**< grenade 2 */
#define IN_ATTACK3        (1 << 25) 


But you can catch button F in another way (https://forums.alliedmods.net/showthread.php?t=299036)

PHP Code:

public Action OnClientCommandKeyValues(int clientKeyValues kv)
{
    
char szBuffer[64];
    
kv.GetSectionName(szBuffersizeof(szBuffer));
    if (
StrEqual(szBuffer"+inspect_server"false))
    {
         
//There we hooked F key, paste your code here
    
}
    
    return 
Plugin_Continue;




All times are GMT -4. The time now is 06:46.

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