Squirrel/Server/Functions/SpawnClass/GetWeaponAmmo

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This function returns the spawn weapon ammo in the given slot for a ''SpawnClass''. == Syntax == <code>int SpawnClass.GetWeaponAmmo( int iSlot )</code> == Arguments == * '''iS...)
 
(Example)
Line 11: Line 11:
 
== Example ==
 
== Example ==
  
{{Squirrel/NeedsExample}}
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( player, cmd, text )
 +
{
 +
if ( cmd == "getammo" )
 +
{
 +
local wepammo = p_SpawnClass.GetWeaponAmmo( 1 );
 +
MessagePlayer( "The current wep ammo in slot one is: " + wepammo, player );
 +
}
 +
}
 
</code>
 
</code>
 +
 +
This example will return the weapon ammo in slot 1 of the spawn class, that we found earlier in [[Squirrel/Server/Functions/SpawnClass/FindSpawnClass|FindSpawnClass]].
  
 
=== Notes ===
 
=== Notes ===
  
-- Example notes/used functions here
+
The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in in this example. More info about this in the corresponding page.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/SpawnClass}}
 
{{Squirrel/Server/Functions/SpawnClass}}

Revision as of 17:31, 8 March 2010

This function returns the spawn weapon ammo in the given slot for a SpawnClass.

Syntax

  1. int SpawnClass.GetWeaponAmmo( int iSlot )

Arguments

  • iSlot - The slot you want to retrieve the weapon ammo for. There are three slots available: 1, 2 and 3

Example

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "getammo" )
  5. {
  6. local wepammo = p_SpawnClass.GetWeaponAmmo( 1 );
  7. MessagePlayer( "The current wep ammo in slot one is: " + wepammo, player );
  8. }
  9. }
  10.  

This example will return the weapon ammo in slot 1 of the spawn class, that we found earlier in FindSpawnClass.

Notes

The call onPlayerCommand was used in in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox