Player Data
scripts/vscripts/alyxlib/player/data.lua
Functions
SyncEquippedWeaponState
Sync the equipped weapon state of the player with the given weapon classname.
If no classname is given, the weapon classname will be determined from the player's criteria.
Parameters
classname(optional)
string
The classname of the weapon to sync.handle(optional)
EntityHandle
The entity handle of the weapon to sync.
Returns
-
EntityHandle?
weaponHandle
The entity handle of the weapon that was equipped. -
CPropVRHand?
handHandle
The entity handle of the hand that the weapon was equipped to.
RestorePreviouslyEquippedWeaponState
Restore the previously equipped weapon state.
Parameters
fireEvent(optional)
boolean
Forces theweapon_switchevent to be fired when restoring.
PauseWeaponStateSync
Pause weapon state synching. This will prevent the weapon_switch player event from firing.
ResumeWeaponStateSync
Resume weapon state synching. This will allow the weapon_switch player event to fire.
WeaponStateSyncPaused
Check if weapon state synching is paused.
GetDefaultWeaponOffset
Returns the default weapon offset for the given weapon classname and hand.
Parameters
classname
string
The classname of the weaponhand
CPropVRHand,number
The hand to get the offset for
Returns
- Vector
The default weapon offset, or Vector() if not found