Jump to content

Cum sa faci o Cursa


Guest farse

Recommended Posts

Guest farse

..Nici eu nu stiu foarte bine..dar sa va zic si voua...


La inceput punem 2 variabile :) :

new Cursa[MAX_PLAYERS]; 
new CheckpointStatus[MAX_PLAYERS]; 
Apoi Checkpoint-urile
#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.
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
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;
}

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...
  • 2 weeks later...

Cu un timer

//la comanda
SetTimerEx(playerid,"MaximTimp",50000,0,"i",playerid);//50000-timpul in milisecunde
///
forward MaximTimp(playerid);
public MaximTimp(playerid)
{
if(Cursa[playerid] == 1)
{
Cursa[playerid] = 0;
CheckpointStatus[playerid] = 0;
DisablePlayerRaceCheckpoint(playerid);
SendClientMessage(playerid,COLOR_RED,"A trecut timpul,misiunea s-a dezactivat");
}
return 1;
}

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.