Rent sistem


Započeo R1chard, Jul 15, 2018, 22:16:15 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Problem(error/warning): Stavlja label na sva vozila kad rentam jedno, to je zbog ovog loppa sto prolazi korz sva, kako da napravim da kad renta samo na mom stavi da je zauzeto a ne na svima
Dio skripte: [ pawn ]for(new i = 1; i < MAX_RENT; i++)
            {
                 Delete3DTextLabel(RentLabel);
               new string[128];
               format(string,sizeof(string),""vrp"[ RENT - "CRVENA"ZAUZETO "vrp"]\nId: '%d'", RentInfo[rID]);
                  RentLabel = Create3DTextLabel(string, 0x33CCFFFF, 0.0, 0.0, 0.0, 15.0, 0, 1);
                  Attach3DTextLabelToVehicle(RentLabel, RentInfo[rID], 0.0, 0.0, 0.0);
            }[ /pawn ]
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [ code ]vaš odgovor[ /code ]
Slika/video ingame problema(obavezno ako je ingame problem): link slike
Poslednja Izmena: Jul 16, 2018, 16:16:15 POSLE PODNE od Bašovski

jednostavno ili napravis kad upise komandu rentcar da updejtuje label ili u tom loopu napravis provjeru da li je vozilo rentano ako jest odradi to sta treba,a ako nije onda ga preskoci

"They have computers, and they may have other weapons of mass destruction."

Citat: MEDO poslato Jul 15, 2018, 22:31:44 POSLE PODNE
jednostavno ili napravis kad upise komandu rentcar da updejtuje label ili u tom loopu napravis provjeru da li je vozilo rentano ako jest odradi to sta treba,a ako nije onda ga preskoci
pa napravio sam kad ude u vozilo da odma ako je rent pojavi se dialog za iznajmit i iznjamim ja al pokaze na svim vozilima zauzeto po logici ovog koda a ja bi da samo na mom

pa gledaj kada das igracu dialog hoce li rent ili nece, ako on kaze da ce rent onda stavis na to vozilo na kojem je on taj label ne moras raditi taj loop, a ako hoces da radis taj loop onda moras napraviti provjeru da li je rentano ili nije jer sta tvoj loop radi jest stavlja na sva vozila koja su kreirana za rent taj tekst bez obzira da li su rentana ili ne

"They have computers, and they may have other weapons of mass destruction."

ali ako maknem taj lop i stavim samo ovako


Delete3DTextLabel(RentLabel[i]);
					new string[128];
					format(string,sizeof(string),""vrp"[ RENT - "CRVENA"ZAUZETO "vrp"]\nId: '%d'", RentInfo[i][rID]);
   					RentLabel[i] = Create3DTextLabel(string, 0x33CCFFFF, 0.0, 0.0, 0.0, 15.0, 0, 1);
   					Attach3DTextLabelToVehicle(RentLabel[i], RentInfo[i][rID], 0.0, 0.0, 0.0);


onda mi nece pokazat zauzeto ni na jednom ovizlu cak ni mom koje sma rento

ne razumijes me daj mi enum rentinfo ja cu ti rijesiti

"They have computers, and they may have other weapons of mass destruction."

enum rInfo
{
   rModel,
   Float:rPozicija[4],
   rBoja[2],
   rID,
   rRentCena,
   rVrsta,
   rDozvoljenRent
};

sta ti znaci to rdozvoljenrent tj za sta ga koristis?

"They have computers, and they may have other weapons of mass destruction."

pa kao da ga mozes rent tj. dal je rent vozilo ako me kontas

probaj ovo
for(new i = 1; i < MAX_RENT; i++)
{
    if(RentInfo[i][rDozvoljenRent] > 0) {
      Delete3DTextLabel(RentLabel);
      new string[128];
      format(string,sizeof(string),""vrp"[ RENT - "CRVENA"ZAUZETO "vrp"]\nId: '%d'", RentInfo[rID]);
      RentLabel = Create3DTextLabel(string, 0x33CCFFFF, 0.0, 0.0, 0.0, 15.0, 0, 1);
      Attach3DTextLabelToVehicle(RentLabel, RentInfo[rID], 0.0, 0.0, 0.0);
   }

}


mada ti ovo nije dobar način ali tako si ti uradio
Poslednja Izmena: Jul 15, 2018, 23:27:08 POSLE PODNE od MEDO

"They have computers, and they may have other weapons of mass destruction."

opet je isto stavi na sva vozila de idi pp


daj mi dialog gdje prihvacas rent

"They have computers, and they may have other weapons of mass destruction."

    case D_VRENT:
		{
		    if(!response)
      		{
      		    new Float:Poz[3];
		    	GetPlayerPos(playerid, Poz[0], Poz[1], Poz[2]); SetPlayerPos(playerid, Poz[0], Poz[1], Poz[2]+1.5);
		    	INFO(playerid,"Odustali ste od iznajmljivanja vozila!");
		    }
			if(response)
			{
			    if(Rentano[playerid] != -1)
				{
				    new Float:Poz[3];
					INFO(playerid,"Vec imas iznajmljeno vozilo!");
					GetPlayerPos(playerid, Poz[0], Poz[1], Poz[2]); SetPlayerPos(playerid, Poz[0], Poz[1], Poz[2]+1.5);
					return 1;
				}
			    for(new i = 0; i <= GetPlayerPoolSize(); i++)
				{
	        		if(Rentano[i] == GetPlayerVehicleID(playerid))
	        		{
	        		    new Float:Poz[3];
	     				INFO(playerid,"Ovo vozilo je vec iznajmljeno!");
	     				GetPlayerPos(playerid, Poz[0], Poz[1], Poz[2]); SetPlayerPos(playerid, Poz[0], Poz[1], Poz[2]+1.5);
	     				return 1;
	       			}
	    		}
				if(PlayerInfo[playerid][pNovac] < RentInfo[UsaoRentVozilo[playerid]][rRentCena])
				{
				    new Float:Poz[3];
					INFO(playerid,"Nemate dovoljno novca da iznajmite ovo vozilo!");
					GetPlayerPos(playerid, Poz[0], Poz[1], Poz[2]); SetPlayerPos(playerid, Poz[0], Poz[1], Poz[2]+1.5);
					return 1;
	    		}
	    		SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, lights, alarm, doors, bonnet, boot, objective);
	    		DajIgracuNovac(playerid, RentInfo[UsaoRentVozilo[playerid]][rRentCena]); Rentano[playerid] = GetPlayerVehicleID(playerid);
				SCM(playerid, -1, ""vrp"_________________________________________________________________");
				SCMF(playerid,-1,""vrp"- "BELA"Uspesno ste iznajmili vozilo za "vrp"%d$"BELA"!", RentInfo[UsaoRentVozilo[playerid]][rRentCena]);
				SCM(playerid,-1,""vrp"- "BELA"Da prekinete iznajmljivanje kucajte "vrp"/unrent"BELA"!");
	            SCM(playerid, -1, ""vrp"_________________________________________________________________");
	            for(new i = 1; i < MAX_RENT; i++)
				{
				    if(RentInfo[i][rDozvoljenRent] > 0) {
				      Delete3DTextLabel(RentLabel[i]);
				      new string[128];
				      format(string,sizeof(string),""vrp"[ RENT - "CRVENA"ZAUZETO "vrp"]\nId: `%d`", RentInfo[rID]);
				      RentLabel[i] = Create3DTextLabel(string, 0x33CCFFFF, 0.0, 0.0, 0.0, 15.0, 0, 1);
				      Attach3DTextLabelToVehicle(RentLabel[i], RentInfo[i][rID], 0.0, 0.0, 0.0);
				   }

				}
			}
		}

ajd obrisi ovaj loop sto imas i ubaci ovo, probaj pa javi pisem sa mob mozda ima gresaka

new ppid = GetPlayerVehicleID(playerid);
Delete3DTextLabel(ppid);
new string[128];
 format(string,sizeof(string),""vrp"[ RENT - "CRVENA"ZAUZETO "vrp"]\nId: `%d`", RentInfo[ppid][rID]);
RentLabel[ppid] = Create3DTextLabel(string, 0x33CCFFFF, 0.0, 0.0, 0.0, 15.0, 0, 1);
Attach3DTextLabelToVehicle(RentLabel[ppid], RentInfo[ppid][rID], 0.0, 0.0, 0.0);

"They have computers, and they may have other weapons of mass destruction."