Raised This Month: $ Target: $400
 0% 

HELPME setting a key 4 any cmd


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Viveks326
Junior Member
Join Date: Dec 2013
Old 03-20-2014 , 01:35   HELPME setting a key 4 any cmd
Reply With Quote #1

I wanna ask if for instance i have to set a key for a command like sentry_build so hw can i do so ?
Viveks326 is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 03-20-2014 , 01:41   Re: HELPME setting a key 4 any cmd
Reply With Quote #2

With +Use button?

PHP Code:
public client_PreThink(iIndex)
{
       new 
iButton get_user_button(iIndex);
       
       if (
iButton == IN_USEclient_cmd(iIndex"sentry_build");

__________________
What are you looking for here?

Last edited by DavidJr; 03-20-2014 at 01:41.
DavidJr is offline
Baws
Veteran Member
Join Date: Oct 2012
Old 03-20-2014 , 22:11   Re: HELPME setting a key 4 any cmd
Reply With Quote #3

client_cmd don't work anymore i think.
__________________
Like my clean plugins and work?
Baws is offline
Kiske
Veteran Member
Join Date: May 2009
Old 03-20-2014 , 23:32   Re: HELPME setting a key 4 any cmd
Reply With Quote #4

Quote:
Originally Posted by baws View Post
client_cmd don't work anymore i think.
https://developer.valvesoftware.com/...in_Slowhacking
__________________

Kiske is offline
Send a message via Skype™ to Kiske
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 03-21-2014 , 06:25   Re: HELPME setting a key 4 any cmd
Reply With Quote #5

Quote:
Originally Posted by Viveks326 View Post
I wanna ask if for instance i have to set a key for a command like sentry_build so hw can i do so ?
You can't choose a key as such, you can choose a command that is sent to the server.

Quote:
Originally Posted by DavidJr View Post
With +Use button?

PHP Code:
public client_PreThink(iIndex)
{
       new 
iButton get_user_button(iIndex);
       
       if (
iButton == IN_USEclient_cmd(iIndex"sentry_build");

A poor method. Also in most cases bitwise ops should be & not == , because your checking for a certain key press, not that key by alone ( with no others present ).

Quote:
Originally Posted by baws View Post
client_cmd don't work anymore i think.
It still works.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 03-21-2014 , 09:37   Re: HELPME setting a key 4 any cmd
Reply With Quote #6

hornet, what about this?

PHP Code:
#define m_afButtonPressed 246
#define m_afButtonReleased 247 

public client_PreThink(iIndex)
{
    new 
iButtonPressediButtonReleased;
    
iButtonPressed get_pdata_int(iJndexm_afButtonPressedXO_PLAYER);
    
iButtonReleased get_pdata_int(iIndexm_afButtonReleasedXO_PLAYER);
    
    if (
iButtonPressed IN_SCORE)
    {
        
//button pressed
    
}
    else if (
iButtonReleased IN_SCORE)
    {
        
//button released
    
}

__________________
What are you looking for here?
DavidJr is offline
Baws
Veteran Member
Join Date: Oct 2012
Old 03-21-2014 , 17:16   Re: HELPME setting a key 4 any cmd
Reply With Quote #7

Off topic: Damn i always thought they removed it. Thanks for letting me know!
__________________
Like my clean plugins and work?
Baws is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 03-22-2014 , 02:05   Re: HELPME setting a key 4 any cmd
Reply With Quote #8

Quote:
Originally Posted by DavidJr View Post
hornet, what about this?

PHP Code:
#define m_afButtonPressed 246
#define m_afButtonReleased 247 

public client_PreThink(iIndex)
{
    new 
iButtonPressediButtonReleased;
    
iButtonPressed get_pdata_int(iJndexm_afButtonPressedXO_PLAYER);
    
iButtonReleased get_pdata_int(iIndexm_afButtonReleasedXO_PLAYER);
    
    if (
iButtonPressed IN_SCORE)
    {
        
//button pressed
    
}
    else if (
iButtonReleased IN_SCORE)
    {
        
//button released
    
}

Essentially it is the same as your first post. The problem here is that using the PreThink forward just to check for a button is a waste of cpu, when there are other methods that can be used ( and you can't unregister the forward with engine module ). Not to mention that also the thread author did not specifically say what key / command he wants to hook.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 03-22-2014 , 09:26   Re: HELPME setting a key 4 any cmd
Reply With Quote #9

So, what's a good method to detect button?
__________________
What are you looking for here?
DavidJr is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 03-22-2014 , 11:49   Re: HELPME setting a key 4 any cmd
Reply With Quote #10

Quote:
Originally Posted by DavidJr View Post
So, what's a good method to detect button?
Depends on what button.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet 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 06:01.


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