Scripting/Squirrel/Functions/Checkpoint.Remove: 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
Line 1: Line 1:
Checkpoint.remove : To use it, like others, you need to give the checkpoint a name.
Checkpoint.remove : To use it, like others, you need to find the checkpoint, either using a name or by using FindCheckpoint() function
For example
For example


Line 14: Line 14:
if(checkp_status == false)
if(checkp_status == false)
{
{
array <- CreateCheckpoint(null, 0, Vector( 132.42, 674.34, 12.6543 ), RGB( 255, 0,255 ), 2);
cp <- CreateCheckpoint(null, 0, Vector( 132.42, 674.34, 12.6543 ), RGB( 255, 0,255 ), 2);
checkp_status = true;
checkp_status = true;
}
}
}
}</pre>


Now we may like to delete it when we get 0 players.
Now we may like to delete it when we get 0 players.
Line 23: Line 23:
function onPlayerPart( player )  
function onPlayerPart( player )  
{  
{  
if(GetPlayers()-1 == 0)
if(GetPlayers() == 0)
{
{
array.Remove();
cp.Remove();
checkp_status = false;
checkp_status = false;
}
}
}
}</pre>


By VCMP Team
By someone

Revision as of 08:16, 24 February 2016

Checkpoint.remove : To use it, like others, you need to find the checkpoint, either using a name or by using FindCheckpoint() function For example


function onScriptLoad()
 { 
checkp_status = false
 }

Now lets create the checkpoint

function onPlayerJoin(player)
{
if(checkp_status == false)
{
cp <- CreateCheckpoint(null, 0, Vector( 132.42, 674.34, 12.6543 ), RGB( 255, 0,255 ), 2);
checkp_status = true;
}
}

Now we may like to delete it when we get 0 players.

function onPlayerPart( player ) { if(GetPlayers() == 0) { cp.Remove(); checkp_status = false; }

}

By someone