GetPlayerAmmoInClip: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 12: | Line 12: | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
*'''weaponSlot''': an integer representing the weapon slot (set to the players current slot if not given) | *'''weaponSlot''': an integer representing the weapon slot (set to the players current slot if not given). Please note this argument is only relevant when using the function '''clientside'''. | ||
===Returns=== | ===Returns=== |
Revision as of 21:59, 29 July 2007
This article needs checking. | |
Reason(s): Should return false instead of 0 if player's invalid, for consistency |
This function returns an integer that contains the ammo in a specified player's weapon. See Weapon Info
Syntax
int getPlayerAmmoInClip ( player thePlayer, [ int weaponSlot = current ] )
Required Arguments
- thePlayer: The player whose ammo you want to check.
Optional Arguments
- weaponSlot: an integer representing the weapon slot (set to the players current slot if not given). Please note this argument is only relevant when using the function clientside.
Returns
Returns an int containing the ammount of ammo in the specified player's clip, or 0 if the player specified is invalid.
Example
This example outputs the amount of ammo the specified player has in his current slot. For example: 'ammo someguy'.
function showAmmo( player, command, who ) thePlayer = getPlayerFromNick(who) if (thePlayer ~= false) then local ammo = getPlayerAmmoInClip(thePlayer) outputChatBox(who.." has "..ammo.." in his active clip", player) else outputChatBox("Player '"..who.."' not found.", player) end end addCommandHandler( "ammo", showAmmo )
See Also
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState