Jump to content
  • 0

Bug /v


TheGodfather

Question

Salut, am un bug in care arata jucatorului in /v ca masina/masinile pe care le are sunt ocupate chiar daca nu sunt.

Cand dau /v da return la functia asta:

stock ShowPlayerVehicle(playerid, bool: type) {
    if(aspam[playerid] > 0) return SCMEx(playerid, COLOR_LIGHTRED, "[Command Anti-Spam] {FFFFFF}Wait %d seconds.", aspam[playerid]);
    new szTitle[2000], szDialog[2000], x = 0;
    if(Iter_Count(MyVehicle[playerid]) == 0) 
        return SCM(playerid, COLOR_LGREEN, "Error: You do not have a personal vehicle!");
    
    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;
}

function IsVehicleOccupied(vehicleid) return VehicleOccupied[vehicleid] != 0 ? (true) : (false);

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 1
34 minutes ago, TheGodfather said:

Este scrisa pe ultimul rand din mesajul meu de mai sus

Nu am observat.

 

Du-te la OnPlayerStateChange si pui:

if(oldstate == PLAYER_STATE_DRIVER) VehicleOccupied[gLastCar[playerid]] = 0;
if(newstate == PLAYER_STATE_DRIVER) VehicleOccupied[gLastCar[playerid]] = 1;

Apoi la OnPlayerExitVehicle:

VehicleOccupied[vehicleid] = 0;

Si la OnPlayerEnterVehicle:

VehicleOccupied[vehicleid] = 1;

 

Verifica daca ai variabila gLastCar este definita in GM si tot odata daca isi face treaba, daca nu cauta una sub alta denumire in GM iar daca nu ai, faci una care sa faca urmatorul lucru:

  • Cand un jucator intra si iese intr-un vehicul sa-i actualizeze variabila cu ID-ul vehiculului. (la fel si in cazul in care variabila pe care o ai in GM, daca o ai nu face acest lucru)

 

Daca nu functioneaza asa, poti modifica functia IsVehicleOccupied cu:

function IsVehicleOccupied(vehicleid) {
	foreach(new i: Player) {
      		if(IsPlayerConnected(i)) {
        		if(IsPlayerInAnyVehicle(i) && GetPlayerVehicleID(i) == vehicleid) return true; }
	}
	return false; }

Nu este cea mai optimizata varianta insa isi face treaba, dar ti-as recomanda ca prima oara sa incerci ce ti-am dat mai sus.

 

Daca problema mai persista dupa aceste modificari poti lasa un reply iar daca a functionat as aprecia un +1!

Succes!

Edited by Yonut
Link to comment
Share on other sites

  • 0
21 minutes ago, Yonut said:

Am mai facut cateva modificari sa stii.

Am gm b-hood HPQ123. Tin sa mentionez ca acest bug apare doar dupa ce un jucator cumpara o masina din DS. Daca da relog problema dispare.

Edited by TheGodfather
Link to comment
Share on other sites

  • 0
17 minutes ago, TheGodfather said:

Am gm b-hood HPQ123. Tin sa mentionez ca acest bug apare doar dupa ce un jucator cumpara o masina din DS. Daca da relog problema dispare.

Ok.

Edited by Yonut
Link to comment
Share on other sites

  • 0
2 minutes ago, TheGodfather said:

Dar de ce cand cumpara masina apare bugul iar dupa ce da relog nu mai e nimic? Fara sa schimb ceva la cod

Fara sa schimbi ceva nu ai cum.

 

Eu ti-am aratat ce ai de facut si cam atat.

Mult succes!

Edited by Yonut
Link to comment
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   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 TheGodfather
      Salut, am vrut sa adaug un nou PNS, cand intru in el ma da si scoate la alt PNS. Am adaugat PNS in baza de date, cu coordonate cu tot. In GM am asa:
      new Float: PutVehiclePNS[5][4] = {
          {1975.3617,2162.3789,10.7974,268.9753},
          {1024.8359,-1025.1244,31.8286,1.4482},
          {720.1768, -456.4775, 15.4988,1.0200},
          {720.1006,-458.8903,16.0630,0.0031}
          //2newpns
          ,{487.4117, -1741.3563, 10.8499, 173.0401}
          //2newpns
      };
      new Float: ExitVehiclePNS[5][4] = {
          {1963.0897,2162.2114,10.5474,89.7477}, 
          {1024.9517,-1034.4995,31.4208,177.5887},
          {720.0970,-466.9240,16.0688,181.9951},
          {720.1700,-467.4203,16.0688,178.9350}
          //2newpns
          ,{488.8409, -1730.2566, 10.9630, 353.4602}
          //2newpns
      };
      Ce e intre // sunt locatiile de la PNS pe care vreau sa il adaug.
      function PutVehicleInPNS(playerid, idd) {
          LastPns[playerid] = idd;
          SetVehiclePos(GetPlayerVehicleID(playerid), PutVehiclePNS[idd][0], PutVehiclePNS[idd][1], PutVehiclePNS[idd][2]);
          SetVehicleZAngle(GetPlayerVehicleID(playerid), PutVehiclePNS[idd][3]);
          GetVehicleHealth(GetPlayerVehicleID(playerid), VehicleHealth[playerid]);
          TogglePlayerControllable(playerid, false);
          PnsTimer[playerid] = gettime()+5;
          return true;
      }
      if(PnsTimer[playerid] != -1) return true;
                    for(new i = 1; i <= GpsBizzType[14]; i++) {
                            idd = BizzTypeID[14][i];
                            if(!PlayerToPoint(10, playerid, BizzInfo[idd][bEntranceX], BizzInfo[idd][bEntranceY], BizzInfo[idd][bEntranceZ]))
                                continue;
                            PutVehicleInPNS(playerid, i-1);
                            cc = true;
                            break;
                    }
      Am incercat aici la PutVehicleInPNS in loc de i-1 sa pun i dar dupa nu mai merge in celelalte bizuri de tip PNS. Bizurile de tip PNS au numarul 14 in baza de date ca biz.
    • By R4zvyy
      Salutare, am o problema cu vehiculele, atunci cand cumpar manual VIP, VIP Plus, Rainbow, stage si neon nu se salveaza

      ma ajuta careva?
    • By TheGodfather
      Salut, cand intru pe server si ma pune sa ma loghez, ma da la coordonatele 0, 0, 0 de la harta si nu stiu de ce. Aveti vreo idee?

    • By KlausMikaelson
      Salutare, am si eu o problema, nu am facut modificari cine stie ce in gamemode, nu imi da erori dar in schimb mi-a aparut un bug la crates, imi ramane imaginea blocata, are cineva idee ce ar putea fi? 
      Discord: Jameshood#5425
    • By GabyRo.off
      cum rezolv bugul la fish?

      ca cand ma duc la zona de fish zice ca nu sunt acolo
       
  • 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.