GetPickupWeapon: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This | This function retreives the Weapon ID of the Weapon Pickup | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
Line 10: | Line 7: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''pickup:''' The pickup in which you wish to retrieve the weapon of | ||
===Returns=== | ===Returns=== | ||
Returns | Returns an integer of the Weapon ID of the pickup | ||
==Example== | ==Example== | ||
This example | This example gives extra ammo to a player if a pickup only has a small amount of ammo. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | addEventHandler ( onPickupHit, root, onPickupHit ) -- add an event for onPickupHit | ||
function onPickupHit ( player ) --when a pickup is hit | |||
-- | ammo == getPickupAmmo ( source ) | ||
weapon == getPickupWeapon ( source ) -- define weapon as the weapon of the pickup | |||
if ammo < 50 then -- the ammo of the pickup is less that 50 | |||
giveWeaponAmmo ( player, weapon, 50 ) --then give an extra 50 ammo | |||
end | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{ | {{IDs}} | ||
{{Pickup functions}} |
Revision as of 21:28, 12 August 2006
This function retreives the Weapon ID of the Weapon Pickup
Syntax
int getPickupWeapon ( pickup pickup )
Required Arguments
- pickup: The pickup in which you wish to retrieve the weapon of
Returns
Returns an integer of the Weapon ID of the pickup
Example
This example gives extra ammo to a player if a pickup only has a small amount of ammo.
addEventHandler ( onPickupHit, root, onPickupHit ) -- add an event for onPickupHit function onPickupHit ( player ) --when a pickup is hit ammo == getPickupAmmo ( source ) weapon == getPickupWeapon ( source ) -- define weapon as the weapon of the pickup if ammo < 50 then -- the ammo of the pickup is less that 50 giveWeaponAmmo ( player, weapon, 50 ) --then give an extra 50 ammo end end
See Also
GTASA IDs (vehicles, weapons, weathers, characters, colors): http://info.vces.net/ (Special thanks to Brophy and Ratt for making these lists)