Cod:
new Cursa[MAX_PLAYERS];
new CheckpointStatus[MAX_PLAYERS];
Apoi Checkpoint-urile
Cod:
#define MAX_RACE_POINTS 10 //Incepeti de la 0 0,1,2...
new Float:racecheckpoints[MAX_RACE_POINTS][3] = { // Aici puneti Checkpoint-urile.[3] inseamna X,Y,Z...puneti sa puneti [4]..dar sa mai adaugati inca ceva la cele de mai jos..
{1656.829956, -1166.398437, 23.617559}, // 0
{1707.867675, -1206.746826, 20.976793}, // 1
{1783.874511, -1286.020629, 13.275278}, // 2
{1859.596069, -1219.198364, 18.736469}, //3
{1892.303710, -1127.870849, 24.013429}, // 4
{1907.985717, -1127.944580, 24.407924}, // 5
{1921.429077, -1127.915771, 24.743091},// 6
{1957.571533, -1128.151611, 25.638833},// 7
{1997.838745, -1128.968505, 25.293878},// 8
{2029.990234, -1128.175903, 24.385658},// 9 .Am inceput de la 0,deci sunt 10 checkpointuri
};
Apoi la facem o comanda.
Cod:
public OnPlayerCommandText(playerid, cmdtext[]) {
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd,"/mission", true) == 0) {
if(IsPlayerInAnyVehicle(playerid)){
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 411) //.Daca vrei sa faca numai cu o anumita masina
{
Cursa[playerid] = 1; //pentru a activa cursa..
SetPlayerRaceCheckpoint(playerid,0,racecheckpoints[0][0],racecheckpoints[0][1],racecheckpoints[0][2],racecheckpoints[1][0],racecheckpoints[1][1],racecheckpoints[1][2],3.0);
//SetPlayerRaceCheckpoint(playerid, CheckPointtype, X, Y, Z, Urmatorul X, Urmatorul Y, Urmatorul , Z);
}
}
return 1;
}
return 0;
}
Si acum la OnPlayerEnterInRaceCheckpoint
Cod:
public OnPlayerEnterRaceCheckpoint(playerid)
{
if (IsPlayerInAnyVehicle(playerid)) //Trebuie sa fie numai in Masina
{
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 411) //si sa participe numai cu un tip de masina
{
if(Cursa[playerid] == 1) //Daca a activat comanda /misiune
{
CheckpointStatus[playerid]++;
new Numar_Checkpointuri= MAX_RACE_POINTS; //pentru a citi numarul de Checkpointuri
if(CheckpointStatus[playerid] < Numar_Checkpointuri)//Trebuie sa fie mai mic decat Numarul de checkpointuri
{
DisablePlayerRaceCheckpoint(playerid); // Scoatem celalse Checkpointuri
SetPlayerRaceCheckpoint(playerid,0,racecheckpoints[CheckpointStatus[playerid]][0],racecheckpoints[CheckpointStatus[playerid]][1],racecheckpoints[CheckpointStatus[playerid]][2],racecheckpoints[CheckpointStatus[playerid]+1][0],racecheckpoints[CheckpointStatus[playerid]+1][1],racecheckpoints[CheckpointStatus[playerid]+1][2],3.0);
}
if(CheckpointStatus[playerid] == Numar_Checkpointuri){ //cand este in ultimul Checkpoint
Cursa[playerid]= 0; // A terminat misiunea
CheckpointStatus[playerid] = 0; //II scoatem cursa
DisablePlayerRaceCheckpoint(playerid); //Dezactivam Checkpointurile
}
}
}
}
return 1;