[Pomoc] Oko goriva


Započeo Markoni990, Januar 29, 2015, 11:35:51 PRE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: GTA RP
Detaljan opis problema: Ovako pravio sam rezerve goriva na pumpama i sad,ja hocu da to ide na sve 5 pumpe posebno, odvezes turu na jednu pumpu i ona naprimer ima u rezervi 10l i kad oteram napuni 20l a sad za drugu pumpu ona 30l i odnesem ima 40l a ne ovako kao sto sam pravio kad oteram turu na sve pumpe ide isto.
Dio skripte:
/////////////////////////////////////////////VOZAC GORIVA////////////////////////////////////////////////
		  if(CP[playerid] ==1600 && IsAGorivo(carid)&& IsTrailerAttachedToVehicle(carid)) { CP[playerid] = 1601; TogglePlayerControllable(playerid, 0); Gorivo12[playerid] = 1; GameTextForPlayer(playerid, "~b~Sacekaj da se gorivo~n~~g~istoci", 3000, 4);TogglePlayerControllable(playerid, 0); SetTimerEx("Gorivo2",13000, false, "i", playerid); DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, 1937.2955,-1776.0560,13.3828,10.0); }
    else if(CP[playerid] == 1601 && IsAGorivo(carid)&& IsTrailerAttachedToVehicle(carid)) { CP[playerid] = 1602; TogglePlayerControllable(playerid, 0); Gorivo12[playerid] = 1; GameTextForPlayer(playerid, "~b~Sacekaj da se gorivo~n~~g~istoci", 3000, 4);TogglePlayerControllable(playerid, 0); SetTimerEx("Gorivo2",13000, false, "i", playerid); DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, 1004.9973,-940.4534,42.1797,10.0); }
    else if(CP[playerid] == 1602 && IsAGorivo(carid)&& IsTrailerAttachedToVehicle(carid)) { CP[playerid] = 1603; TogglePlayerControllable(playerid, 0); Gorivo12[playerid] = 1; GameTextForPlayer(playerid, "~b~Sacekaj da se gorivo~n~~g~istoci", 3000, 4);TogglePlayerControllable(playerid, 0); SetTimerEx("Gorivo2",13000, false, "i", playerid); DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, 651.6285,-564.7838,16.3301,10.0); }
	else if(CP[playerid] == 1603 && IsAGorivo(carid)&& IsTrailerAttachedToVehicle(carid)) { CP[playerid] = 1604; TogglePlayerControllable(playerid, 0); Gorivo12[playerid] = 1; GameTextForPlayer(playerid, "~b~Sacekaj da se gorivo~n~~g~istoci", 3000, 4);TogglePlayerControllable(playerid, 0); SetTimerEx("Gorivo2",13000, false, "i", playerid); DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, 1380.9648,456.1190,19.8869,10.0); }
	else if(CP[playerid] == 1604 && IsAGorivo(carid)&& IsTrailerAttachedToVehicle(carid)) { CP[playerid] = 1605; TogglePlayerControllable(playerid, 0); Gorivo12[playerid] = 1; GameTextForPlayer(playerid, "~b~Sacekaj da se gorivo~n~~g~istoci", 3000, 4);TogglePlayerControllable(playerid, 0); SetTimerEx("Gorivo2",13000, false, "i", playerid); DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, -98.0867,-1167.2094,2.5977,10.0); }
    else if(CP[playerid] == 1605 && IsAGorivo(carid)&& IsTrailerAttachedToVehicle(carid)) { CP[playerid] = 1606; TogglePlayerControllable(playerid, 0); Gorivo12[playerid] = 1; GameTextForPlayer(playerid, "~b~Sacekaj da se gorivo~n~~g~istoci", 3000, 4);TogglePlayerControllable(playerid, 0); SetTimerEx("Gorivo2",13000, false, "i", playerid); DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, 2430.8547,-2113.4102,13.5469,10.0); }
	else if(CP[playerid] == 1606 && IsAGorivo(carid)&& IsTrailerAttachedToVehicle(carid)) { CP[playerid] = 1607; TogglePlayerControllable(playerid, 0); Gorivo12[playerid] = 1; GameTextForPlayer(playerid, "~r~Zavrsili ste ~n~~g~posao", 3000, 4);TogglePlayerControllable(playerid, 0); SetTimerEx("Gorivo2",13000, false, "i", playerid); DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, 2509,-2089,13.54,10.0); }
	  if(CP[playerid] == 1607 && IsAGorivo(carid)&& IsTrailerAttachedToVehicle(carid))
	  {
        	new randpay = 1750 + random(165);
			PlayerInfo[playerid][pPayCheck] += randpay;
			TogglePlayerControllable(playerid, 1);
			DisablePlayerCheckpoint(playerid);
			SendClientMessage(playerid, 0x8D531AFF, "-----------");
			format(string, sizeof(string), "Zarada: %d$.", randpay);
			SendClientMessage(playerid, 0x9A6735FF, string);
			SendClientMessage(playerid, 0xB89571FF, "-----------");
    new random;
    random = 10 + (0);
    gorivonapumpi += random; 
    GorivoNaPumpi();
SBizzInfo[3][sbTill] += 500;
    ExtortionSBiz(3, 500);
    SBizzInfo[3][sbProducts]--;
	Gorivo12[playerid] = 1;
	PlayerInfo[playerid][pGorivo] = 0;
	new taj = GetVehicleTrailer(carid);
	SetVehicleToRespawn(taj);
    }

forward GorivonaPumpi();
public GorivoNaPumpi()
{
	new strFromFile[30], arrCoords[6][5], File: file = fopen("Podesavanje/Gorivonapumpi/Gorivonapumpi.txt", io_read);
	if (file)
	{
	    fread(file, strFromFile);
	    razdvoji(strFromFile, arrCoords, ',');
		gorivonapumpi = strval (arrCoords[0]);
		fclose(file);
	}
	return 1;
}

forward KolicinaGorivaPumpa();
public KolicinaGorivaPumpa()
{
	new coordstring[30];
	format(coordstring, sizeof(coordstring), "%d", gorivonapumpi);
	new File: file = fopen("Podesavanje/Gorivonapumpi/Gorivonapumpi.txt", io_write);
	fwrite(file, coordstring);
	fclose(file);
	new stringa[256];
	Delete3DTextLabel(GorivoPumpaLabel);
	format( stringa,sizeof(stringa),"{00CCFF}Benzisnka pumpa rezervoar:\n{FFFFFF}%d Litara ",gorivonapumpi);
	(GorivoPumpaLabel) = Create3DTextLabel(stringa,0x00C3FFFF,211.0494,1874.8359,-25.0267,80.0,0);
	return 1;
}

new gorivonapumpi = 10000;
new gorviostrin[200];
format(gorivostring,256,"{00CCFF}Benzinska pumpa rezervoar:\n{FFFFFF}%d Litara",gorivonapumpi);
GorvioPumpaLabel = Create3DTextLabel(avlstring,0x00C3FFFF,211.0494,1874.8359,-25.0267,80.0,0);

Sredi to punjenje preko markera odnosno sta hocu da ti kazem ti ovde imas posebno kod markera koja je koja pumpa i onda jednostavno tu ubacis i to punjenje goriva.

Da brt ali kako da mi ucita da kad ne sipam gorivo na jednu pumpu da ne poveca odma na sve pet ako me razumes
gorivonapumpi += random;
:D

new gor = random(5);
gorivonapumpi += gor;
ovako ti gore ne moze
a ti sad trebaš svaku pumpu posebno napravit kontaš nije samo jednu
~ Server Pernambucho Roleplay ~
Forum : ~ http://pernambucho.com/ ~
Facebook :~ https://www.facebook.com/events/331686430351597 ~

Owner : JA :D

Mozes mi objasniti malo bolje ne kapiram  :)

Moras napraviti neki enum onda za te nazivimo ih cisterne i za svaku pumpu posebne varijable i onda jednostavno preko markera znas koja je pumpa i tu varijablu povecavas za taj odredjeni broj ako me razumes ...