GetPlayerWeapon

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 09:53, 15 August 2026 by QCherry (talk | contribs) (Complete Lua function catalog)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.