Raised This Month: $51 Target: $400
 12% 

[CSGO] Hooking client commands invnext/invprev


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-21-2015 , 10:01   [CSGO] Hooking client commands invnext/invprev
Reply With Quote #1

I think I'm brain farting...

I cant get this to work

Code:
public OnPluginStart()
{
    RegConsoleCmd("invnext", ItDoesntLoveMe);
    RegConsoleCmd("invprev", ItDoesntLoveMe);
}

public Action:ItDoesntLoveMe(client, args)
{
    PrintToConsole(client, "[SM] ---------==========> ItDoesntLoveMe()");
    return Plugin_Continue;
}
__________________
Neuro Toxin is offline
Michalplyoutube
Veteran Member
Join Date: Jan 2013
Location: Tank Carrier in Mannhatt
Old 05-21-2015 , 10:11   Re: [CSGO] Hooking client commands invnext/invprev
Reply With Quote #2

Quote:
Originally Posted by Neuro Toxin View Post
I think I'm brain farting...

I cant get this to work

Code:
public OnPluginStart()
{
    RegConsoleCmd("invnext", ItDoesntLoveMe);
    RegConsoleCmd("invprev", ItDoesntLoveMe);
}

public Action:ItDoesntLoveMe(client, args)
{
    PrintToConsole(client, "[SM] ---------==========> ItDoesntLoveMe()");
    return Plugin_Continue;
}
Its client side thing

you can try to hook

or make time that will raport weapon change
__________________
The plugin developer of TF2BWR Reborn
And a TF2 Player
Michalplyoutube is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 05-21-2015 , 10:55   Re: [CSGO] Hooking client commands invnext/invprev
Reply With Quote #3

SDKHooks WeaponSwitch
The server will only listen to so many commands at a time, most players spam invnext and invprev with mousewheel, and the server does not see all of the weapon switches.

(Also you should be using command listeners not registering them.)

Last edited by Mitchell; 05-21-2015 at 10:58.
Mitchell is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 05-21-2015 , 11:48   Re: [CSGO] Hooking client commands invnext/invprev
Reply With Quote #4

They're prolly not sent to the server
Miu is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-21-2015 , 12:37   Re: [CSGO] Hooking client commands invnext/invprev
Reply With Quote #5

Like the slot# commands, this is indeed processed clientside. The client then sends it's weapon selection to the server in the next "usercmd" it sends. You can watch for this by using the OnPlayerRunCmd forward in SDKTools. If the weapon var is non-zero, the client requested a switch to that weapon.
psychonic is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 05-21-2015 , 12:55   Re: [CSGO] Hooking client commands invnext/invprev
Reply With Quote #6

hooking weapon switches isn't the same as hooking invnext/prev though, so it's not possible
Miu is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-21-2015 , 18:59   Re: [CSGO] Hooking client commands invnext/invprev
Reply With Quote #7

Thanks for the replies.

I'm wanting to make the mouse wheel act as a scroll bar selector for a menu.

Sounds like my best idea is psychonics advice.

Only problem I see is. I wont know if a player is scrolling up or down.
__________________
Neuro Toxin is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 05-21-2015 , 19:19   Re: [CSGO] Hooking client commands invnext/invprev
Reply With Quote #8

You can see which slot they're moving to: if they're going to the slot above their current weapon, they're scrolling up, and vice versa. The real issue is that you won't be able to distinguish scrolling from the 1-9 keys unless the new slot isn't neighboring the old one.

Last edited by Miu; 05-21-2015 at 19:19.
Miu is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-21-2015 , 19:31   Re: [CSGO] Hooking client commands invnext/invprev
Reply With Quote #9

A menu will be open that will block the client pressing 1-8.

Pretty much as a player scrolls the menu redraws to show the selection.

The logic is going to become really complex by the sounds of it.

1. Find slot of weapon in forward args
2. Find slot of m_hActiveWeapon
3. Check for slot wrap

I'm also worried a quick scroll could skip weapons / slots and make the plugin think they are scrolling the opposite way.
__________________
Neuro Toxin is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 05-21-2015 , 20:10   Re: [CSGO] Hooking client commands invnext/invprev
Reply With Quote #10

Yep, and if they have less than three weapons (e.g. a USP and a knife), there's no way to distinguish
Miu 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 14:48.


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