How to make random checkpoints ?
#1

How to make when player use command, to get on map random checkpoints ?
Reply
#2

Post the coordinates, I will make it for you with commented lines...
Reply
#3

pawn Code:
new
    Float: checkpoints[ ][ 3 ] =
    {
        { 0.0, 0.0, 0.0 },
        { 10.0, 10.0, 10.0 },
        { 20.0, 20.0, 20.0 },
        { 30.0, 30.0, 30.0 },
        { 40.0, 40.0, 40.0 }
    }
;

CMD:rcp( playerid, params[ ] )
{
    new
        rand = random( sizeof( checkpoints ) )
    ;
    SetPlayerCheckpoint( playerid, checkpoints[ rand ][ 0 ], checkpoints[ rand ][ 1 ], checkpoints[ rand ][ 2 ], 3.0 );
    return 1;
}
Reply
#4

Thx you man.Can i do that with:OnPlayerEneterCheckPoint ?
Reply
#5

Instead of the command? No, you cannot. OnPlayerEnterCheckpoint is called only when you enter a checkpoint.

Unless you meant something else and I misunderstood.
Reply
#6

Can i make when player enter on checkpoint to get new RANDOM on his map ?
Reply
#7

Yes.

pawn Code:
public OnPlayerEnterCheckpoint( playerid )
{
    new
        rand = random( sizeof( checkpoints ) )
    ;
    SetPlayerCheckpoint( playerid, checkpoints[ rand ][ 0 ], checkpoints[ rand ][ 1 ], checkpoints[ rand ][ 2 ], 3.0 );
    return 1;
}
Reply
#8

But where i must post cordinates of the checkpoints ?
Reply
#9

Quote:
Originally Posted by Konstantinos
View Post
pawn Code:
new
    Float: checkpoints[ ][ 3 ] =
    {
        { 0.0, 0.0, 0.0 },
        { 10.0, 10.0, 10.0 },
        { 20.0, 20.0, 20.0 },
        { 30.0, 30.0, 30.0 },
        { 40.0, 40.0, 40.0 }
    }
;

CMD:rcp( playerid, params[ ] )
{
    new
        rand = random( sizeof( checkpoints ) )
    ;
    SetPlayerCheckpoint( playerid, checkpoints[ rand ][ 0 ], checkpoints[ rand ][ 1 ], checkpoints[ rand ][ 2 ], 3.0 );
    return 1;
}
Quote:
Originally Posted by bustern
View Post
But where i must post cordinates of the checkpoints ?
pawn Code:
new
    Float: checkpoints[ ][ 3 ] =
    { //   X     Y    Z               put your coordinates according to the column.
        { 0.0, 0.0, 0.0 },
        { 10.0, 10.0, 10.0 },
        { 20.0, 20.0, 20.0 },
        { 30.0, 30.0, 30.0 },
        { 40.0, 40.0, 40.0 }
    }
;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)