Hooks called by Weapon Selector

Summary

Hooks

Called on the client when the highlighted entry of the weapon selector changes through the invprev, invnext or slot binds.
Called on the client when the player confirms the highlighted weapon with attack, right after the selectweapon command has been sent to the server.
Asks whether the weapon selector should handle a bind.

Hooks

OnWeaponIndexChange(old_index, self.weapon_index)

shared plugins/sh_weaponselect.lua:217

Called on the client when the highlighted entry of the weapon selector changes through the invprev, invnext or slot binds. The plugin's own handler opens the selector and scrolls it to the new entry.

Parameters

  • old_index Number Previously highlighted index in the weapon list of the player
  • index Number Newly highlighted index

Called from

Call sites

OnWeaponSelected(self.weapon_index)

shared plugins/sh_weaponselect.lua:262

Called on the client when the player confirms the highlighted weapon with attack, right after the selectweapon command has been sent to the server.

Parameters

  • index Number Index of the selected weapon in the weapon list of the player

Called from

Call sites

ShouldOpenWepselect(client, bind, pressed)

shared plugins/sh_weaponselect.lua:201

Asks whether the weapon selector should handle a bind. Called on the client for every bind the local player presses or releases while they are not in a vehicle and not holding attack.

Parameters

  • client Player The local player
  • bind String The command of the bind
  • pressed Boolean Whether the bind was pressed rather than released

Returns

  • Boolean Return false to make the selector ignore the bind

Called from

Call sites

Defined in