AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] Hook Slot5 and Slot6 (https://forums.alliedmods.net/showthread.php?t=239427)

dias 04-27-2014 07:15

[Help] Hook Slot5 and Slot6
 
I want to hook slot5 and slot6
My idea is making [5] and [6] as skill buttons, not change weapon slot

I saw in a cs mod, they can do it, but i dont see the code
I tried this code and failed:
PHP Code:

public plugin_init()
{
    
register_plugin("Test""1.0""Dias")
    
register_clcmd("slot5""Slot5")
}

public 
Slot5(id)
{
    
client_print(idprint_chat"Skill Activated")



klippy 04-27-2014 07:50

Re: [Help] Hook Slot5 and Slot6
 
It may be very simple and i am just really wrong with this, but here are my thoughts.
Few days i ago i was testing some commands and I made output for every command client_command() forward catches. When I press number 3 for instance, it catches weapon_knife command. So they *maybe* put some weapons in those slots with different weapon data so they can hook it like this.
As i said, I may be wrong, but this is a possible way I can see. :)

EDIT:
You could also display an empty menu with keys bitsum you want to detect, so I believe you could catch all numbers(0-9). Only problem here is when they open different menu. Maybe activate that invisible menu if they have no other menu open(there is a offset for this called m_iMenu i think) in PreThink(maybe a bad method, but that is first thing on my mind right now).

Black Rose 04-27-2014 08:28

Re: [Help] Hook Slot5 and Slot6
 
Problem with hooking, for example, weapon_knife as slot3 is that it only works when the weapon is actually selected. If you have hud_fastswitch 0, it will not work until you press mouse1.

Constantly showing a menu will prevent you to use any other slot buttons, even if you only register MENU_KEY_5 and 6 as buttons for it.

dias 04-30-2014 02:18

Re: [Help] Hook Slot5 and Slot6
 
I play CS BTE, even i set hud_fastswich 0, i still can active skill when pressing Slot5 and Slot6

Backstabnoob 04-30-2014 08:16

Re: [Help] Hook Slot5 and Slot6
 
CS BTE is a completely custom client which can have this feature included.

You're out of luck with server-side coding only.

Hook flashlight and drop instead, they're better for skills anyway.

m4m3ts 05-02-2014 19:30

Re: [Help] Hook Slot5 and Slot6
 
yea, that's server side i think.


All times are GMT -4. The time now is 15:55.

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