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.

  • Similar Content

    • By Wreeper
      Salut. M-am gandit de recent sa bag niste culori noi la texte, dar nu vad cum pot sa fac asta. SA:MP e SA:MP si din cauza asta majoritatea culoriilor arata ceva genul asta:
      0xFFC266AA
      M-am gandit ca un destept ce sunt sa pun culoare ROSIE (#FF0000) si sa fac:
      #define RED 0xFFFF0000
      Bineinteles ca e munca Wreepareasca si imi da culoare alba. Din ce cauza? Ce convertor exista sa fac asemenea culori?
    • By RoPe
      Salutare, 
      Am văzut multi playeri care sunt interesati sa faca bani pe server dar considera ca job-ul nu mai este la moda însă  cred ca se merită dacă nu mă credeți uitați-vă la clipul de jos.
      Dacă doriți și cu alte job-uri scrieti aici în comentarii!
       
    • By xVincenzo
      salut, vreau si eu o comanda de /updates daca se poate!
    • By AlexCelTare
      Salut baieti, am si eu nevoie de putin ajutor, vreau sa fac o comanda, ca atunci cand playerul da /enablemusic sa ii cante muzica in toate locatiile astea. Dar problema e, ca, doar un steram merge, cel de la sfarsit, restul, primele 2, nu se aud deloc.
       
      // playerid
      // url
      // coordonates X Y Z
      // distance

      {
          if (strcmp("/enablemusic", cmdtext, true) == 0)
          {
              PlayAudioStreamForPlayer(playerid, "https://uploadir.com/u/0ggegbx6", -2130.5364,-2061.0081,63.3233, 30.0, 1);
              PlayAudioStreamForPlayer(playerid, "https://uploadir.com/u/57dvvuy7", -2218.7273,-2154.1978,43.6795, 20.0, 1);
              PlayAudioStreamForPlayer(playerid, "https://uploadir.com/u/qvov4zt0", -2197.3599,-2254.3499,30.8057, 20.0, 1);
              return 1;
          }
          return 0;
      }
       
      multumesc!
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.