GetPlayerTotalAmmo: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Changed "DeprecatedWithAlt" template to "Deprecated") |
||
(9 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | |||
{{Deprecated|getPedTotalAmmo|}} | |||
This function returns an integer that contains the total ammo in a specified [[player]]'s weapon. See [[weapon|Weapon Info]] | This function returns an integer that contains the total ammo in a specified [[player]]'s weapon. See [[weapon|Weapon Info]] | ||
==Syntax== | ==Syntax== | ||
<section name="Server" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
int getPlayerTotalAmmo ( player thePlayer, | int getPlayerTotalAmmo ( player thePlayer ) | ||
</syntaxhighlight> | |||
===Required Arguments=== | |||
*'''thePlayer''': The [[player]] whose ammo you want to check. | |||
===Returns=== | |||
Returns an [[int]] containing the total amount of ammo for the player's current weapon. | |||
</section> | |||
<section name="Client" class="client" show="true"> | |||
<syntaxhighlight lang="lua"> | |||
int getPlayerTotalAmmo ( player thePlayer [, int weaponSlot = current ] ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 10: | Line 25: | ||
*'''thePlayer''': The [[player]] whose ammo you want to check. | *'''thePlayer''': The [[player]] whose ammo you want to check. | ||
*'''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) | ||
===Returns=== | ===Returns=== | ||
Returns an [[int]] containing the total amount of ammo for the specified player's weapon, or 0 if the player specified is invalid. | Returns an [[int]] containing the total amount of ammo for the specified player's weapon, or 0 if the player specified is invalid. | ||
</section> | |||
==Example== | ==Example== | ||
Line 21: | Line 35: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- Find the player called 'Someguy' | -- Find the player called 'Someguy' | ||
myPlayer = | myPlayer = getPlayerFromNick ( "Someguy" ) | ||
-- If a player called 'Someguy' was found then | -- If a player called 'Someguy' was found then | ||
if ( myPlayer | if ( myPlayer ) then | ||
-- Retrieve the total amount of ammo for that player, and store it in a variable called 'ammo' | -- Retrieve the total amount of ammo for that player, and store it in a variable called 'ammo' | ||
ammo = getPlayerTotalAmmo ( myPlayer ) | ammo = getPlayerTotalAmmo ( myPlayer ) | ||
-- Tell all the players how much ammo 'Someguy' has | -- Tell all the players how much ammo 'Someguy' has | ||
outputChatBox ( "Someguy's current total ammo: " | outputChatBox ( "Someguy's current total ammo: " .. ammo .. "." ) | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 16:27, 13 February 2015
This function is deprecated. This means that its use is discouraged and that it might not exist in future versions. | |
Please use getPedTotalAmmo instead. |
This function returns an integer that contains the total ammo in a specified player's weapon. See Weapon Info
Syntax
Click to collapse [-]
Serverint getPlayerTotalAmmo ( player thePlayer )
Required Arguments
- thePlayer: The player whose ammo you want to check.
Returns
Returns an int containing the total amount of ammo for the player's current weapon.
Click to collapse [-]
Clientint getPlayerTotalAmmo ( player thePlayer [, int weaponSlot = current ] )
Required Arguments
- thePlayer: The player whose ammo you want to check.
- weaponSlot: an integer representing the weapon slot (set to the players current slot if not given)
Returns
Returns an int containing the total amount of ammo for the specified player's weapon, or 0 if the player specified is invalid.
Example
This example outputs the total amount of ammo a player called Someguy has for his weapon.
-- Find the player called 'Someguy' myPlayer = getPlayerFromNick ( "Someguy" ) -- If a player called 'Someguy' was found then if ( myPlayer ) then -- Retrieve the total amount of ammo for that player, and store it in a variable called 'ammo' ammo = getPlayerTotalAmmo ( myPlayer ) -- Tell all the players how much ammo 'Someguy' has outputChatBox ( "Someguy's current total ammo: " .. ammo .. "." ) end
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