Scripting/Squirrel/Functions/Checkpoint.Pos: 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
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
As the other checkpoint functions, You need to give a name to the checkpoint or else, it can't define itself
This function changes the Position of a Checkpoint.


== Syntax ==
<pre>Checkpoint.Pos</pre>


<pre>function onScriptLoad()
== Arguments ==
*[[Scripting/Squirrel/Functions/Vector|''Vector'']] '''pos''' - The checkpoint position
 
== Example ==
<source lang="squirrel">
function onScriptLoad()
{
CheckpointGreen <- CreateCheckpoint( null, 0, false, Vector( -378.79, -537.962, 17.2832 ), RGB(255, 0, 255), 2);
return 1;
}
 
 
function onPlayerCommand( player, command, arguments )
{
{
array <- CreateCheckpoint(null, 0, Vector( 132.42, 674.34, 12.6543 ), RGB( 255, 0,255 ), 2);  
if(cmd == "setcppos")
}</pre>
{
CheckpointGreen.Pos = Vector(player.Pos.x, player.Pos.y, player.Pos.z);
//NOTE: The Checkpoint might disappear use /kill to respawn, the Checkpoint will be visible again and the Position will be updated
}
return 1;
}
</source>


Now You can set its position to other places in different events.
=== Notes ===
== For example ==


<pre>function onPlayerJoin( player )
Call [[onScriptLoad]] and [[onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
{
array.Pos = Vector( 564.75, 454.98, 15.65 );
}</pre>


== Related Functions ==


By VCMP Team
{{Scripting/Squirrel/Functions/Checkpoint_Functions}}
[[Category:Scripting/Squirrel/Functions/Checkpoint_Functions]]

Latest revision as of 17:45, 3 August 2017

This function changes the Position of a Checkpoint.

Syntax

Checkpoint.Pos

Arguments

  • Vector pos - The checkpoint position

Example

function onScriptLoad()
{ 
	CheckpointGreen <- CreateCheckpoint( null, 0, false, Vector( -378.79, -537.962, 17.2832 ), RGB(255, 0, 255), 2);
	return 1;
}


function onPlayerCommand( player, command, arguments )
{
	if(cmd == "setcppos")
	{
		CheckpointGreen.Pos = Vector(player.Pos.x, player.Pos.y, player.Pos.z);
		//NOTE: The Checkpoint might disappear use /kill to respawn, the Checkpoint will be visible again and the Position will be updated
	}
	return 1;
}

Notes

Call onScriptLoad and onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions