Jump to content
  • 0

Tunare masini


matrixismyname

Question

new vehicle;

public OnGameModeInit( )
{
    vehicle = AddStaticVehicle(420,-2482.4937,2242.3936,4.6225,179.3656,6,1); // Taxi
    return 1;
}

public OnPlayerEnterVehicle (playerid, vehicleid)
{
    if (vehicleid == vehicle)
    {
        AddVehicleComponent(vehicle, 1010); // Nitro
        SendClientMessage(playerid, 0xFFFFFFAA, "Nitro added to the Taxi.");
    }
    return 1;
}

Am si eu o intrebare legata de acest cod, pot face in asa fel incat de exemplu daca am 4 factiuni, cu 10 masini fiecare (total 40 de masini)

Pot face cumva sa le...tunez pe toate 40 cu o singura functie sau cum se numeste AddVehicleComponent adica sa nu stau sa scriu la fiecare (am 40 de sultane)

AddVehicleComponent(vehicle1, 1010); // Nitro

AddVehicleComponent(vehicle2, 1010); // Nitro

AddVehicleComponent(vehicle3, 1010); // Nitro

..............................................................

AddVehicleComponent(vehicle40, 1010); // Nitro

Pot face cumva sa ...adauge componenta asta la anumite id-uri ? De exemplu sa fie ceva de genu

AddVehicleComponent(>=9 && <=30, 1010); // Nitro (adica sa adauge nos la toate masinile de la masina 9 pana la masina 30 (inclusiv)

(ce am scris eu mai sus nu merge, insa verau sa stiu daca este vre-o metoda care sa mearga sa nu stau sa scriu 40 de addvehiclecomponent..)

Multumesc :D

ir2tc1.png [url=http://forum.sa-mp.ro/filter-scripts-and-gamemode
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

..daca vrei pe toate 40...

new vehicle[41];
public OnGameModeInit( )
{
vehicle[0]=AddStaticVehicle(420,-2482.4937,2242.3936,4.6225,179.3656,6,1); // Taxi
vehicle[1]=AddStaticvehicle(..);
//tot asa pana la 40
for(new t=0;t<=41;t++)
{
AddVehicleComponent(vehicle[t], 1010); // Nitro
}
return 1;
}

nam citit tot,daca am inteles gresit imi zici  :D

Link to comment
Share on other sites

..daca vrei pe toate 40...

new vehicle[41];
public OnGameModeInit( )
{
vehicle[0]=AddStaticVehicle(420,-2482.4937,2242.3936,4.6225,179.3656,6,1); // Taxi
vehicle[1]=AddStaticvehicle(..);
//tot asa pana la 40
for(new t=0;t<=41;t++)
{
AddVehicleComponent(vehicle[t], 1010); // Nitro
}
return 1;
}

nam citit tot,daca am inteles gresit imi zici   :D

Ai inteles bine doar ca eu nu vreau sa stau sa scriu la fiecare addstaticvehicle sa stau sa scriu in fata lui vehicle[0] , 1, .... ceva mai rapid exista?

ir2tc1.png [url=http://forum.sa-mp.ro/filter-scripts-and-gamemode
Link to comment
Share on other sites

la inceput:

#define vehID X
//X = ID-ul primei masini (vehicle1)
public OnGameModeInit( )
{
      for(new c = vehID; c <= vehID+40)
      {
            AddVehicleComponent(c, 1010);
      }
      return 1;
}

B-Zone: Role Play Server -  77.81.202.202:7777 [url=http://www.game-monitor.com/sa-mp_GameServer/77.

Link to comment
Share on other sites

la inceput:

#define vehID X
//X = ID-ul primei masini (vehicle1)
public OnGameModeInit( )
{
      for(new c = vehID; c <= vehID+40)
      {
            AddVehicleComponent(c, 1010);
      }
      return 1;
}

da nu pot sa scriu direct in loc de vehid niste cifre? apropo de ce e vehid+40 ?

ir2tc1.png [url=http://forum.sa-mp.ro/filter-scripts-and-gamemode
Link to comment
Share on other sites

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

    • By TheGodfather
      Salut, masinile se respawneaza la un interval de timp daca cineva nu e in ele. Am pus peste tot unde e SetVehicleToRespawn() un mesaj unic, ca sa imi dau seama unde e problema. Dar cand masina se respawneaza nu apare niciun mesaj, tin sa mentionez ca mesajul e pus cu SendClientMessageToAll. Deci nu exista sansa sa se fi trimis si sa nu il fi vazut. Am gamemode hpq123 bhood.
    • By CenzoR
      Salut! Am problema cand intru in masina persoanala nu imi arata detalile acesteia, de ex cate zile are, km, culorile.
      Scriptul este deja pus in gamemode (nu este anulat)
      Ma poate ajuta cineva?
    • By Lwka
      Hey! Am si eu nevoie de ajutor la comanda /bonus


      Cum pot acorda un vehicul temporar?
    • By TheGodfather
      Salut, am gasit o problema la gamemde-ul bhood de HPQ123. Cand cineva isi cumpara o masina din dealership, uneori aceasta primeste random sistemele vip sau rainbow, totodata cand masina nu primeste aceste sisteme, in /v o sa spuna ca e ocupata chiar daca ea nu e ocupata iar playerul nu o poate despawna pentru ca ii spune ca este ocupata. Voi da cateva functii la care cred ca ar putea sa fie problema, daca nu, pun si gamemodeul sa va uitati in el daca doriti.
      YCMD:buycar(playerid, params[], help) {
          if(aspam[playerid] > 0) return SCMEx(playerid, COLOR_LIGHTRED, "[Command Anti-Spam] {FFFFFF}Asteapta %d secunde.", aspam[playerid]);
          if(PlayerInfo[playerid][pLevel] < 3) return SCM(playerid, COLOR_GREY, "Nu ai nivel 3!");
          if(InDealer[playerid] != 0) return 1;
          if(!PlayerToPoint(3,playerid,1487.0498,-2287.2930,13.7529)) return SCM(playerid, COLOR_GREY, "Nu esti la dealership.");
          if(TestingModel[playerid] == 1) return true;
          LoadDsVehs(playerid);
          if(PlayerInfo[playerid][pWantedLevel] > 0) return SCM(playerid, -1, "Ai wanted, nu poti folosi aceasta comanda!");
          TestingModel[playerid] = 0;
          DealerCarType[playerid] = 1;
          InDealer[playerid] = 1;
          TogglePlayerControllable(playerid, 0);
          SetPlayerVirtualWorld(playerid, playerid+1);
          SetPlayerInterior(playerid, 0);
          DealerID[playerid] = 1;
          DealerCarColor1[playerid] = 1;
          DealerCarColor2[playerid] = 1;
          DealerCar[playerid] = CreateVehicleEx(DSModels[DealerID[playerid]][dModel],1463.3318,-2299.0806,13.6845,281.2260,DealerCarColor1[playerid],DealerCarColor2[playerid], -1, 0);
          SetVehicleVirtualWorld(DealerCar[playerid],playerid+1);
          LinkVehicleToInterior(DealerCar[playerid], 0);
          PlayerTextDrawSetPreviewModel(playerid, DSTds[4], DSModels[DealerID[playerid]][dModel]);
          PlayerTextDrawShow(playerid, DSTds[4]);
          ShowDealershipTextdraws(playerid);
          SelectTextDraw(playerid, 0x15B864FF);
          ShowCamera(playerid);    
          return true;
      }
      stock ShowPlayerVehicle(playerid, bool: type) {
          if(aspam[playerid] > 0) return SCMEx(playerid, COLOR_LIGHTRED, "[Command Anti-Spam] {FFFFFF}Asteapta %d secunde.", aspam[playerid]);
          new szTitle[2000], szDialog[2000], x = 0;
          if(Iter_Count(MyVehicle[playerid]) == 0) 
              return SCM(playerid, COLOR_LGREEN, "Eroare: Nu ai un vehicul personal!");
          
          format(szTitle, sizeof(szTitle), "Your Vehicles {E3DE31}%d/%d", Iter_Count(MyVehicle[playerid]), GetSlots(playerid));
          strcat(szDialog, "Vehicul\tStatus\tDespawn Time\tOthers details\n");
          foreach(MyVehicle[playerid], car) {
              format(szDialog, sizeof(szDialog), "%s%s\t%s\t%s\t%s\n", szDialog, aVehicleNames[CarInfo[car][cModel]-400], CarInfo[car][Spawned] != 0 ? IsVehicleOccupied(CarInfo[car][Spawned]) ? ("{FFFF00}[occupied]") : ("{26B309}[spawned]") : ("{FF0000}[despawned]"), CheckDespawnCar(car), TotalUp(car)); 
              PlayerInfo[playerid][pCarKey][x] = car;
              x++;
          }
          ShowPlayerDialog(playerid, type ? DIALOG_STICKET : DIALOG_GARAGE, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog, "Ok", "Exit");
          return true;
      }
      B-HOOD.pwn
    • 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;
      }


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