Liberty Unleashed

Scripting => Script Help => Topic started by: Trot on March 18, 2011, 06:52:56 pm

Title: Like Patriot playground...
Post by: Trot on March 18, 2011, 06:52:56 pm
Hi!That's already 4 o'clock I'm trying to make a coherent chain of checkpoints. Here is my script. I just do not understand what I am wrong.

function onPlayerEnterSphere( pPlayer, sphere )
{
if ( sphere.ID == 8 )
{
CreateCheckpoint( Vector( -869, -751.9, 10.49 ), 5.0, Colour( 0, 245, 0 ) );
CreateCheckpoint( Vector( -818.6, -870.1, 10.76 ), 5.0, Colour( 0, 245, 0 ) );
CreateCheckpoint( Vector( -907.7, -882.3, 10.76 ), 5.0, Colour( 0, 245, 0 ) );
CreateCheckpoint( Vector( -972.2, -882.1, 10.76 ), 5.0, Colour( 0, 0, 0 ) );
}
return 1;
}


function onPlayerEnterCheckpoint( pPlayer, checkpoint )
{
   if ( checkpoint.ID == 0 )
   {
   CreateCheckpoint( Vector( -818.6, -870.1, 10.76 ), 5.0, Colour( 0, 0, 0 ) );
   checkpoint.Type = MARKER_TYPE_VEHICLE;
   checkpoint.Remove();
   }

   else if ( checkpoint.ID == 1 )
   {
   CreateCheckpoint( Vector( -818.6, -870.1, 10.76 ), 5.0, Colour( 0, 0, 0 ) );
   checkpoint.Type = MARKER_TYPE_VEHICLE;
   checkpoint.Remove();
   }

   else if ( checkpoint.ID == 2 )
   {
   CreateCheckpoint( Vector( -907.7, -882.3, 10.76 ), 5.0, Colour( 0, 0, 0 ) );
   checkpoint.Type = MARKER_TYPE_VEHICLE;
   checkpoint.Remove();
   }
   
   else if ( checkpoint.ID == 3 )
   {
   CreateCheckpoint( Vector( -972.2, -882.1, 10.76 ), 5.0, Colour( 0, 0, 0 ) );
   checkpoint.Type = MARKER_TYPE_VEHICLE;
   checkpoint.Remove();
   }       
return 1;
}
Title: Re: Like Patriot playground...
Post by: Force on March 18, 2011, 07:10:21 pm
Your setting the type of the checkpoint that your deleting for a start. :P

Obviously with more players the checkpoint IDs will differ, so this is just a basic explanation to try and help you out.

Code: (squirrel) [Select]
function onPlayerEnterCheckpoint( pPlayer, pCheckpoint )
{
local iCheckpoint = pCheckpoint.ID, pNextCheckpoint;
switch ( iCheckpoint )
{
case 0:
{
// If they entered checkpoint ID 0
// Create the new checkpoint and set it's type
pNextCheckpoint = CreateCheckpoint( ... );
if ( pNextCheckpoint )
{
// If the checkpoint was created successfully.
pNextCheckpoint.Type = MARKER_TYPE_VEHICLE;
}
// Remove the current checkpoint (Uncomment if needed)
//pCheckpoint.Remove();
}
break;
case 1:
{
// If they entered checkpoint ID 1
// Create the new checkpoint and set it's type
if ( pNextCheckpoint )
{
pNextCheckpoint.Type = MARKER_TYPE_VEHICLE;
}
pNextCheckpoint.Type = MARKER_TYPE_VEHICLE;
// Remove the current checkpoint (Uncomment if needed)
//pCheckpoint.Remove();
}
break;
}

return 1;
}
Title: Re: Like Patriot playground...
Post by: Trot on March 18, 2011, 07:41:54 pm
Thanks. But I'm trying, and it is still doesn't work. Second sphere not disable.
Title: Re: Like Patriot playground...
Post by: Trot on March 19, 2011, 11:27:33 am
I make that script

function onPlayerEnterSphere( pPlayer, sphere )
{
if ( sphere.ID == 8 )
{
BigMessage( pPlayer"~y~Take all checkpoints!", 3000, 2 );
CreateCheckpoint( Vector( -869, -751.9, 10.49 ), 5.0, Colour( 0, 245, 0 ) );
CreateCheckpoint( Vector( -818.6, -870.1, 10.76 ), 5.0, Colour( 0, 245, 0 ) );
CreateCheckpoint( Vector( -907.7, -882.3, 10.76 ), 5.0, Colour( 0, 245, 0 ) );
CreateCheckpoint( Vector( -972.2, -882.1, 10.76 ), 5.0, Colour( 0, 245, 0 ) );
CreateCheckpoint( Vector( -1093.7, -877.7, 10.76 ), 5.0, Colour( 0, 245, 0 ) );
CreateCheckpoint( Vector( -1180.1, -828, 10.77 ), 5.0, Colour( 0, 245, 0 ) );
CreateCheckpoint( Vector( -1263.6, -770.2, 10.77 ), 5.0, Colour( 0, 245, 0 ) );
CreateCheckpoint( Vector( -1348.9, -703.1, 10.77 ), 5.0, Colour( 0, 245, 0 ) );
CreateCheckpoint( Vector( -1369.9, -623.8, 16.87 ), 5.0, Colour( 0, 245, 0 ) );
CreateCheckpoint( Vector( -1354.1, -503.6, 10.77 ), 5.0, Colour( 255, 0, 0 ) );
}
return 1;
}

function onPlayerEnterCheckpoint( player, cp )
{
cp.Remove();
     return 1;
}

But when i cross last checkpoint, it all begin enabled random. How i can make disable all script, when i cross last checkpoint? And how i can add money for each one cp?
Title: Re: Like Patriot playground...
Post by: Trot on March 23, 2011, 02:23:29 am
Your setting the type of the checkpoint that your deleting for a start. :P
Obviously with more players the checkpoint IDs will differ, so this is just a basic explanation to try and help you out.

where the need is to insert?
Title: Re: Like Patriot playground...
Post by: Trot on March 23, 2011, 03:17:46 am

where the need is to insert?.....................................
[/quote]

Oh, I knew you must have created the project for scholars of nuclear physicists. Or post-graduate mathematical schools. In this case, I understand your reluctance to help.