Difference between revisions of "SetPickupType"

From Multi Theft Auto: Wiki
(Example)
m
Line 5: Line 5:
 
==Syntax==  
 
==Syntax==  
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
setPickupType ( pickup thePickup, int type, int amount/weapon, [ int ammo ] )           
+
bool setPickupType ( pickup thePickup, int type, int amount/weapon, [ int ammo ] )           
 
</syntaxhighlight>  
 
</syntaxhighlight>  
  
Line 19: Line 19:
 
{{OptionalArg}}  
 
{{OptionalArg}}  
 
*'''ammo''': An integer representing the amount of ammo a pickup contains. This argument is only valid when the pickup type is a Weapon Pickup, and must be specified in that case.
 
*'''ammo''': An integer representing the amount of ammo a pickup contains. This argument is only valid when the pickup type is a Weapon Pickup, and must be specified in that case.
 +
 +
===Returns===
 +
Returns ''true'' if successful, ''false'' otherwise.
  
 
==Example==  
 
==Example==  

Revision as of 12:41, 7 July 2009

This function allows changing the type of a pickup to a Weapon, Armour or Health pickup, and allows you to set the health points or the weapon and ammo that the pickup will give.

Syntax

bool setPickupType ( pickup thePickup, int type, int amount/weapon, [ int ammo ] )          

Required Arguments

  • thePickup: The pickup which you wish to change the settings of
  • type: An integer representing the type of pickup. You can choose from:
    • 0: Health Pickup
    • 1: Armour Pickup
    • 2: Weapon Pickup
  • amount/weapon: An integer representing the amount of Health points or Armour points a pickup has. If the type is a Weapon pickup, then it represents the Weapon ID of the weapon pickup. The 'ammo' field must be specified if the type is Weapon Pickup.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • ammo: An integer representing the amount of ammo a pickup contains. This argument is only valid when the pickup type is a Weapon Pickup, and must be specified in that case.

Returns

Returns true if successful, false otherwise.

Example

This example changes the pickup time every time someone hits it

Click to expand [+]
Server

This example changes a local player's pickup every time the spacebar key is pressed down

Click to expand [+]
Client

See Also