GetWeaponClipAmmo: Difference between revisions
Jump to navigation
Jump to search
Zangomangu (talk | contribs) mNo edit summary |
OpenIDUser60 (talk | contribs) m (→Syntax) |
||
Line 12: | Line 12: | ||
===Returns=== | ===Returns=== | ||
Returns the amount of ammo in the custom weapons clip, false otherwise. | Returns the amount of ammo in the custom weapons clip, false otherwise. | ||
===Example=== | |||
<section name="Example 1" class="client" show="true">This example gets your ammo and output it! | |||
<syntaxhighlight lang="lua"> | |||
[lua] | |||
function getMyAmmo(player) -- Create a function named getMyAmmo and add player as the first parameter of addCommandHandler! | |||
local weapon = getPedWeapon(player) -- Create a local variable with the value of getPedWeapon ( the weapon of the player )! | |||
local clipAmmo = getWeaponClipAmmo(weapon) -- Now use the local variable and get the weapon's clip ammo! | |||
outputChatBox(tostring(clipAmmo), player) -- Output the clipAmmo to the player, Please use tostring for it or it will give you a error that it should be a string! | |||
end -- End the function | |||
</syntaxhighlight> | |||
</section> | |||
==See Also== | ==See Also== | ||
{{Client weapon creation functions}} | {{Client weapon creation functions}} |
Revision as of 11:25, 14 October 2014
Script Example Missing Function GetWeaponClipAmmo needs a script example, help out by writing one. | |
Before submitting check out Editing Guidelines Script Examples. |
This function gets the amount of ammo in a custom weapons magazine/clip.
Syntax
int getWeaponClipAmmo ( weapon theWeapon )
Required Arguments
- theWeapon: The weapon to get the clip ammo of.
Returns
Returns the amount of ammo in the custom weapons clip, false otherwise.
Example
Click to collapse [-]
Example 1This example gets your ammo and output it!
[lua] function getMyAmmo(player) -- Create a function named getMyAmmo and add player as the first parameter of addCommandHandler! local weapon = getPedWeapon(player) -- Create a local variable with the value of getPedWeapon ( the weapon of the player )! local clipAmmo = getWeaponClipAmmo(weapon) -- Now use the local variable and get the weapon's clip ammo! outputChatBox(tostring(clipAmmo), player) -- Output the clipAmmo to the player, Please use tostring for it or it will give you a error that it should be a string! end -- End the function
See Also
- createWeapon
- fireWeapon
- getWeaponAmmo
- getWeaponClipAmmo
- getWeaponFiringRate
- getWeaponFlags
- getWeaponOwner
- getWeaponProperty
- getWeaponState
- getWeaponTarget
- resetWeaponFiringRate
- setWeaponAmmo
- setWeaponClipAmmo
- setWeaponFiringRate
- setWeaponFlags
- setWeaponProperty
- setWeaponState
- setWeaponTarget