Hello !!
I have a question want to ask that i have make a cmd when player type ex /test it's will random a checkpoint , every thing is ok. but i want to ask that when player /test > random a checkpoint(i call this random checkpoint is 0) > enter checkpoint 0 > appear a checkpoint 1( this check point is this location -572.6946,-188.0733,78.4063) > enter checkpoint 1 > will appear checkpoint random is 0 again ! |
new Float:Checkpoint[][] = { {-2168.8091,820.6702,64.9275,186.7119}, {-2168.9868,796.0462,64.9427,359.3602}, {-2187.3042,795.7017,57.5561,186.5670}, {-2205.3921,795.8117,50.4726,96.9528}, {-2205.2039,820.6953,50.4423,357.6252}, {-2223.2563,820.6120,49.4412,80.0326}, {-2223.8704,796.5319,49.4383,182.8069}, {-2241.4644,786.0906,49.3921,251.7409}, {-2240.7637,753.6312,49.3808,184.6869}, {-2278.5129,747.9567,49.4393,98.2061}, {-2278.5881,767.1949,49.4453,0.1318}, {-2278.1094,788.1552,49.4453,110.1129} };
new CheckFix[MAX_PLAYERS]; //on top of your script
CMD:test(playerid)
{
//your code
new Float:c1,Float:c2,Float:c3;
CheckFix[playerid] = 1;
new Random = random(sizeof(Checkpoint));
c1 = Checkpoint[Random][0];
c2 = Checkpoint[Random][1];
c3 = Checkpoint[Random][2];
SetPlayerCheckPoint(playerid,Checkpoint[Random][0],Checkpoint[Random][1],Checkpoint[Random][2]);
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(IsPlayerInRangeOfPoint(playerid,5,c1,c2,c3) && CheckFix[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
CheckFix[playerid] = 0;
SetPlayerCheckpoint(playerid,-572.6946,-188.0733,78.4063);
}
if(IsPlayerInRangeOfPoint(playerid,5,-572.6946,-188.0733,78.4063))
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,c1,c2,c3);
}
if(IsPlayerInRangeOfPoint(playerid,5,c1,c2,c3) && CheckFix[playerid] == 0)
{
DisablePlayerCheckpoint(playerid);
}
return 1;
}