Scripting/Squirrel/Functions/CreatePickup: Difference between revisions

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 34: Line 34:
* ''bool'' '''isAuto''' - (Is auto respawn?)
* ''bool'' '''isAuto''' - (Is auto respawn?)


== Example ==
== 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>


{{Scripting/Needs_Example}}
== 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 ===
=== Notes ===
Call [[onPlayerCommand]] were used in this example. More info about them in the corresponding pages.


== Related Functions ==
== Related Functions ==


{{Scripting/Squirrel/Functions/Pickup_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.

Related Functions