Jump to content
  • 0

Comanda utilizata doar in anumite vehicule


Guest Alxxie

Question

Cum fac o comanda care poate fi utilizata doar in anumite vehicule(mai multe).

Sa presupunem ca am 60 de vehicule in care vreau sa poata fi utilizata o comanda.Cum fac? ???

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Guest Mariachi

Faci asa :

forward IsASpecialCar(carid);
public IsASpecialCar(carid)
{
	if((carid >= 169) && (carid <= 171))
	{
	    return 1;
	}
	return 0;
}
Si comanda trebuie sa fie asa
    if(!strcmp(cmdtext, "/comanda", true)) // By LordMan
    {
		if(IsPlayerConnected(playerid))
		{
		    new carid = GetPlayerVehicleID(playerid);
		    if(IsASpecialCar(carid))
		    {

		    }
		}
		return 1;
    }

Link to comment
Share on other sites

varianta GF, dar daca futi "locul" vehiculeleor in GamemodeInit se fute tot.

poti sa faci

new Vehs[60];

//sub gamemodeinit
Vehs[0] = 
Vehs[1] =
Vehs[2] = 
Vehs[3] =
etc.

//sub commandtext
    if(!strcmp(cmdtext, "/comanda", true)) // By LordMan
    {
        new carid = GetPlayerVehicleID(playerid);
        for(new i=0; i<60; i++)
        {
            if( carid == Vehs[i] )
            {
                //comanda ta
            }
        }
        return 1;
    }
Sau cu functie
stock IsASpecialCar(carid)
{
    for(new i=0; i<60; i++)
    {
        if( carid == Vehs[i] )
        {
            return 1;
        }
    }
    return 0;
}

//comanda
    if(!strcmp(cmdtext, "/comanda", true)) // By LordMan
    {
        new carid = GetPlayerVehicleID(playerid);
        if( IsASpecialCar(carid) )
        {
                //comanda
        }                    
        return 1;
    }

Spre deosebire de Moz asta garanteaza functionarea oricand, daca faci ca Moz, tot merge, dar daca schimbi locul vehiculelor in GameModeInit, se strica tot. Acum faci cu vrei tu.

Bafta

-Toate tutorialele postate intra aici sau puneti-le direct [url=http://www.sa-mp.ro/forum/index

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Similar Content

    • By xLinix96
      Salut, asta este prima mea postare pe aceasta comunitate, astazi vreau sa va arat cum sa creati o comanda /flymode, stiu ca este o comanda foarte simpla, dar sunt unii incepatori care nu stiu sa o faca.
       
      Pentru inceput aveti nevoie de un include.
      #include <fly>
      Il gasiti aici: http://www.solidfiles.com/d/289d6c8fdf/
       
       
      Acum vom face comanda:
      CMD:fly(playerid, params[])
      {
          if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa te comenctezi."); // aici verificam daca esti conectat
          if(IsPlayerConnected(playerid)) 
          {
              if(PlayerInfo[playerid][pAdmin] >= 1) // aici punem nivelul de admin necesar pentru a folosii comanda.
              {
                  new sendername[30],string[256];
                  if(flymode[playerid] == 0)
                  {
                      GetPlayerName(playerid, sendername, sizeof(sendername)); // aici obtinem numele adminuui.
                      togfind[playerid] = 0;
                      flymode[playerid] = 1;
                      format(string,sizeof(string),"{DFF230}%s este acum in modul fly-mode.", sendername); 
                      ABroadCast(COLOR_ORANGE,string,1);
                      InitFly(playerid);
                      StartFly(playerid);
                      SetPlayerHealthEx(playerid, 10000000); // aici setam hp-ul.
                  }
                  else
                  {
                      GetPlayerName(playerid, sendername, sizeof(sendername)); // iar de aici oprim fly-ul.
                      togfind[playerid] = 1;
                      flymode[playerid] = 0;
                      format(string,sizeof(string),"{F89AD6}Ai oprit fly-mode-ul", sendername);
                      SCM(playerid, COLOR_GREEN, string);
                      StopFly(playerid);
                      SetPlayerHealthEx(playerid, 100); // 
                  }
              }
              else return SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
          }
          return 1;
      }
       
      Sper ca v-am ajutat, nu este cine site ce sistem.
       
       
    • By FlobertRO
      Cum pot schimba o comanda de tipul "strcmp" in "cmd" ? un exemplu daca se poate, multumesc <3
    • By GamerulFOX
      CMD:masina(playerid, params[])
      {
          CreateVehicle(531, 217.3956, 1867.7419, 12.8884, 0, 1, 1, 0, 0);
          SendClientMessage(playerid, 0x0077ffFF, "Masina ta a fost spawnata cu succes in baza militara !");
          DisablePlayerCheckpoint(playerid);
          SetPlayerCheckpoint(playerid, 217.3956, 1867.7419, 12.8884, 3.0);
          SendClientMessageToAll(0x48452eFF, "Un player a spawnat o masina!");
          return 1;
      }






      CMD:comanda7368(playerid, params[])
      {
          SendClientMessage(playerid, 0x0077ffFF, "Pentru ca ai folosit comanda aceasta ai primit 10 000 de lei!");
          GivePlayerMoney(playerid, 10000);
          return 1;
      }


       
    • By StrypS
      YCMD:bonus(playerid, params[], help) {
          if(PlayerInfo[playerid][pLevel] > 1)
              return true;
          new string[43];
          new money = PlayerInfo[playerid][pLevel] * 500000 + random(8000000);
          new lvlbonus = PlayerInfo[playerid][pLevel] * 3 + random(5);
          new ppbonus = PlayerInfo[playerid][pLevel] * 10 + random(50);
          SetPlayerScore(playerid, lvlbonus);
          PlayerInfo[playerid][pLevel] += lvlbonus;
          UpdateVar(playerid, "Level", 3);
          PlayerInfo[playerid][pPremiumPoints] += ppbonus;
          UpdateVar(playerid, "PremiumPoints", 3);
          GivePlayerCash(playerid, 1, money);
          format(string, sizeof(string), "Server Bonus Random: Ai primit %s PremiumPoints, Level %d si %i $.", ppbonus, lvlbonus, FormatNumber(money));
          SCM(playerid, -1, string);
          return true;
      }

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