native

cs_get_user_weapon

Syntax

native cs_get_user_weapon(playerIndex, &clip = 0, &ammo = 0);

Description

Returns weapon index of the active weapon.

Parameters

playerIndex Player index
clip Optional variable to store clip ammo to
ammo Optional variable to store backpack ammo to

Note

More reliable than get_user_weapon.

Return

Weapon index on success or 0 if there is no active weapon

Error

If the client index is not within the range of 1 to
maxClients, or the client is not connected, an error will be
thrown.