GetPlayerWeapon: Difference between revisions
Jump to navigation
Jump to search
Complete Lua function catalog |
Document upcoming 0.1.4 weapon confirmation and mouse camera APIs |
||
| Line 35: | Line 35: | ||
[[Category:Player Functions]] | [[Category:Player Functions]] | ||
[[Category:Equipment Functions]] | [[Category:Equipment Functions]] | ||
<!-- weapon-mouse014:start --> | |||
== Native confirmation since 0.1.4 (in development) == | |||
See [[Weapon control]]. setPlayerWeapon returns request acceptance, not completion. getPlayerWeapon remains the legacy single scripted choice, not the actual two-slot loadout. Use [[getPlayerWeaponState]] and [[onPlayerWeaponChangeResult]] for confirmed equipment. Matching client and server are required. | |||
<!-- weapon-mouse014:end --> | |||
Revision as of 13:53, 19 September 2026
getPlayerWeapon
Returns the stable key of the weapon equipped by a player.
Syntax
string|false getPlayerWeapon(int playerId)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
Returns
Returns the equipped weapon key, an empty string when the slot is clear, or false for an invalid player.
Examples
Read a player's equipped weapon:
local itemKey = getPlayerWeapon(playerId)
if itemKey and itemKey ~= "" then
outputDebugString("Equipped weapon: " .. itemKey)
end
Notes
- Available only in server-side resource scripts.
- Equipment state is server-authoritative and included in player synchronization.
Native confirmation since 0.1.4 (in development)
See Weapon control. setPlayerWeapon returns request acceptance, not completion. getPlayerWeapon remains the legacy single scripted choice, not the actual two-slot loadout. Use getPlayerWeaponState and onPlayerWeaponChangeResult for confirmed equipment. Matching client and server are required.