Scripting/Squirrel/Functions/CreatePickup: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
No edit summary |
No edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
This function will create a pickup. | |||
== Syntax == | == Syntax == | ||
<pre>CreatePickup( | '''1''' | ||
<pre>CreatePickup( model , pos )</pre> | |||
'''2''' | |||
<pre>CreatePickup( model, world, quantity, pos, alpha, isAuto )</pre> | |||
'''3''' | |||
<pre>CreatePickup( model, world, quantity, x, y, z, alpha, isAuto )</pre> | |||
{{Scripting/ | == Arguments == | ||
'''1''' | |||
* ''int'' '''model''' - The model of pickup. | |||
* ''Vector'' '''pos''' - The pos of pickup. | |||
'''2''' | |||
* ''int'' '''model''' - The model of pickup. | |||
* ''int'' '''world''' - The world of pickup. | |||
* ''int'' '''quantity''' - The quantity of pickup. | |||
* ''Vector'' '''pos''' - The pos of pickup. | |||
* ''int'' '''alpha''' - The alpha of pickup. | |||
* ''bool'' '''isAuto''' - (Is auto respawn?) | |||
'''3''' | |||
* ''int'' '''model''' - The model of pickup. | |||
* ''int'' '''world''' - The world of pickup. | |||
* ''int'' '''quantity''' - The quantity of pickup. | |||
* ''float'' '''x''' - The x pos of pickup. | |||
* ''float'' '''y''' - The y pos of pickup. | |||
* ''float'' '''z''' - The z pos of pickup. | |||
* ''int'' '''alpha''' - The alpha of pickup. | |||
* ''bool'' '''isAuto''' - (Is auto respawn?) | |||
== Example 1 == | |||
The following example will create a pickup. which will be executed by onPickupPickedUp | |||
<source lang=squirrel> | |||
function onPlayerCommand( player, cmd, text ); | |||
{ | |||
if ( cmd == "pick1" ) | |||
{ | |||
CreatePickup(368, Vector(player.Pos.x, player.Pos.y, player.Pos.z)); | |||
} | |||
} | |||
</source> | |||
== Example 2 == | |||
The following example will create a pickup. which will be executed by onPickupPickedUp but could be directly used for few Pickups such as weapons, armour and health | |||
<source lang=squirrel> | |||
function onPlayerCommand( player, cmd, text ); | |||
{ | |||
if ( cmd == "armourpick" ) | |||
{ | |||
CreatePickup(368, player.World, 50, Vector(player.Pos.x, player.Pos.y, player.Pos.z), 255, true); | |||
} | |||
} | |||
</source> | |||
== Example 3 == | |||
The following example will create a pickup without Vector. which will be executed by onPickupPickedUp but could be directly used for few Pickups such as weapons, armour and health | |||
<source lang=squirrel> | |||
function onPlayerCommand( player, cmd, text ); | |||
{ | |||
if ( cmd == "armourpick" ) | |||
{ | |||
CreatePickup(368, player.World, 50, player.Pos.x, player.Pos.y, player.Pos.z, 255, true); | |||
} | |||
} | |||
</source> | |||
=== Notes === | |||
Call [[onPlayerCommand]] were used in this example. More info about them in the corresponding pages. | |||
== Related Functions == | |||
{{Scripting/Squirrel/Functions/Pickup_Functions}} | |||
[[Category:Scripting/Squirrel/Functions/Pickup_Functions]] |
Latest revision as of 18:36, 30 January 2017
This function will create a pickup.
Syntax
1
CreatePickup( model , pos )
2
CreatePickup( model, world, quantity, pos, alpha, isAuto )
3
CreatePickup( model, world, quantity, x, y, z, alpha, isAuto )
Arguments
1
- int model - The model of pickup.
- Vector pos - The pos of pickup.
2
- int model - The model of pickup.
- int world - The world of pickup.
- int quantity - The quantity of pickup.
- Vector pos - The pos of pickup.
- int alpha - The alpha of pickup.
- bool isAuto - (Is auto respawn?)
3
- int model - The model of pickup.
- int world - The world of pickup.
- int quantity - The quantity of pickup.
- float x - The x pos of pickup.
- float y - The y pos of pickup.
- float z - The z pos of pickup.
- int alpha - The alpha of pickup.
- bool isAuto - (Is auto respawn?)
Example 1
The following example will create a pickup. which will be executed by onPickupPickedUp
function onPlayerCommand( player, cmd, text );
{
if ( cmd == "pick1" )
{
CreatePickup(368, Vector(player.Pos.x, player.Pos.y, player.Pos.z));
}
}
Example 2
The following example will create a pickup. which will be executed by onPickupPickedUp but could be directly used for few Pickups such as weapons, armour and health
function onPlayerCommand( player, cmd, text );
{
if ( cmd == "armourpick" )
{
CreatePickup(368, player.World, 50, Vector(player.Pos.x, player.Pos.y, player.Pos.z), 255, true);
}
}
Example 3
The following example will create a pickup without Vector. which will be executed by onPickupPickedUp but could be directly used for few Pickups such as weapons, armour and health
function onPlayerCommand( player, cmd, text );
{
if ( cmd == "armourpick" )
{
CreatePickup(368, player.World, 50, player.Pos.x, player.Pos.y, player.Pos.z, 255, true);
}
}
Notes
Call onPlayerCommand were used in this example. More info about them in the corresponding pages.