Random checkpoint except last one
#2

Put many checkpoints will make the change to be the same cp littlest

EDIT: Or you could try something like that:

Код HTML:
new CPs[8][3] =
{
	{ 0.0, 0.0, 0.0 },
	{ 0.0, 0.0, 0.0 },
	{ 0.0, 0.0, 0.0 },
    { 0.0, 0.0, 0.0 },
    { 0.0, 0.0, 0.0 },
    { 0.0, 0.0, 0.0 },
    { 0.0, 0.0, 0.0 }
}

new pLastCP[MAX_PLAYERS];

// where you set

new rNum = random(sizeof(CPs));
SetPlayerCheckPoint(playerid, CPs[rNum][0], CPs[rNum][1], CPs[rNum][2], 1.0);
pLastCP[playerid] = rNum;


// Where you give another CP

new rNum = random(sizeof(CPs));

if(rNum == pLastCP[playerid)
{
	if(rNum == 8) { SetPlayerCheckPoint(playerid, CPs[rNum-1][0], CPs[rNum-1][1], CPs[rNum-1][2], 1.0); pLastCP[playerid] = (rNum - 1); }
	if(rNum < 8) { SetPlayerCheckPoint(playerid, CPs[rNum+1][0], CPs[rNum+1][1], CPs[rNum+1][2], 1.0); pLastCP[playerid] = (rNum - 1); }
}
Reply


Messages In This Thread
Random checkpoint except last one - by TheWay - 02.08.2015, 08:57
Re: Random checkpoint except last one - by Mariciuc223 - 02.08.2015, 09:02
Re: Random checkpoint except last one - by Mencent - 02.08.2015, 09:12
Re: Random checkpoint except last one - by Vince - 02.08.2015, 10:24

Forum Jump:


Users browsing this thread: 1 Guest(s)