[Pomoc]/buy System

Započeo FlashPoint, Decembar 28, 2012, 20:17:01 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: Od nula
Detaljan opis problema: Znaci napravio sam System takav da nemoram puno raditi(manje linija). Nigdje nebaca Error, ali kad kucim nesto u zbog 24/7, u blagajni imam 0, a trebo sam imati pola od cijene artikla(Mobitel: 300 - Pola 150). Nekuzim u cemu je stvar
Dio skripte:
public Kupnja(playerid) //NEBRISI!
{
    for(new b = 0; b < sizeof(BizzInfo); b++)
	{
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-29.2532,-184.7970,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[27][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[27][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,1.9494,-28.8390,1003.5494) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[28][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[28][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-27.9760,-89.2840,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[29][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[29][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-22.2957,-138.3508,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[30][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[30][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-31.0113,-28.7380,1003.5573) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[31][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[31][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-23.4475,-55.3327,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[32][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[32][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-29.1915,-184.8495,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[33][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[33][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,2.1286,-28.6856,1003.5494) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[34][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[34][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-29.3050,-184.6823,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[35][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[35][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-23.1642,-55.4948,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[36][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[36][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-30.6352,-28.6874,1003.5573) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[37][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[37][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,2.0240,-28.3020,1003.5494) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[39][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[39][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-23.4179,-55.2064,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[40][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[40][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-29.2599,-184.7598,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[41][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[41][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,2.1777,-28.6339,1003.5494) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[42][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[42][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-30.5294,-28.3697,1003.5573) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[43][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[43][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-28.9841,-184.6628,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[45][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[45][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-23.0976,-55.3073,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[46][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[46][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-30.9569,-28.6377,1003.5573) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[47][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[47][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-29.3838,-184.8395,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[51][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[51][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-23.7746,-55.3719,1003.5469) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[52][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[52][bProducts]--;
	  	SaveProperty();
	  	return 1;
	  	}
		if(IsPlayerInRangeOfPoint(playerid, 2.0,-31.1976,-28.4835,1003.5573) && PlayerInfo[playerid][pArtikl] == 1)
	 	{
	  	BizzInfo[71][bTill] += mobitel/2;
	  	BizzInfo[77][bTill] += mobitel/2;
	  	BizzInfo[71][bProducts]--;
	  	SaveProperty();
	  	return 1;
  		}
  	}
	return 1;
}


if(dialogid == DIALOG_24/7)
	{
	    if(response)
	    {
	        new string[18];
	        if(listitem == 0)
	        {
	        new broj = 100000 + random(899999);
	        if(SafeGetPlayerMoney(playerid) < mobitel) return SCM(playerid, COLOR_RED,"Nemas dovoljno novca!");
	        PlayerInfo[playerid][pArtikl] = 1;
         	format(string, sizeof(string), "~r~-$%d", mobitel);
    		GameTextForPlayer(playerid, string, 3000, 1);
			AC_BS_GivePlayerMoney(playerid, -mobitel);
			PlayerInfo[playerid][pNovac] -= mobitel;
    		PlayerInfo[playerid][pBroj] = broj;
    		PlayerInfo[playerid][pMobitel] = 1;
    		PlayerInfo[playerid][pBon] = 0;
      		Kupnja(playerid);
    		}
      		if(listitem == 1)
	        {
	        if(SafeGetPlayerMoney(playerid) < bon) return SCM(playerid, COLOR_RED,"Nemas dovoljno novca!");
	        PlayerInfo[playerid][pArtikl] = 2;
         	format(string, sizeof(string), "~r~-$%d", bon);
    		GameTextForPlayer(playerid, string, 3000, 1);
			AC_BS_GivePlayerMoney(playerid, -bon);
			PlayerInfo[playerid][pNovac] -= bon;
    		PlayerInfo[playerid][pBon] = 50;
    		Kupnja(playerid);
    		}
    		if(listitem == 2)
	        {
	        if(SafeGetPlayerMoney(playerid) < upaljac) return SCM(playerid, COLOR_RED,"Nemas dovoljno novca!");
	        PlayerInfo[playerid][pArtikl] = 3;
         	format(string, sizeof(string), "~r~-$%d", upaljac);
    		GameTextForPlayer(playerid, string, 3000, 1);
			AC_BS_GivePlayerMoney(playerid, -upaljac);
			PlayerInfo[playerid][pNovac] -= upaljac;
    		PlayerInfo[playerid][pUpaljac] = 1;
    		Kupnja(playerid);
    		}
    		if(listitem == 3)
	        {
	        if(PlayerInfo[playerid][pGodine] < 18) return SCM(playerid, COLOR_WHITE,"BLAGAJNICA: Momak, nemas 18 godina.");
	        if(SafeGetPlayerMoney(playerid) < cigare) return SCM(playerid, COLOR_RED,"Nemas dovoljno novca!");
	        PlayerInfo[playerid][pArtikl] = 4;
         	format(string, sizeof(string), "~r~-$%d", cigare);
    		GameTextForPlayer(playerid, string, 3000, 1);
			AC_BS_GivePlayerMoney(playerid, -cigare);
			PlayerInfo[playerid][pNovac] -= cigare;
    		PlayerInfo[playerid][pCigare] = 20;
    		Kupnja(playerid);
    		}
    		if(listitem == 4)
	        {
	        if(SafeGetPlayerMoney(playerid) < maska) return SCM(playerid, COLOR_RED,"Nemas dovoljno novca!");
	        PlayerInfo[playerid][pArtikl] = 5;
         	format(string, sizeof(string), "~r~-$%d", maska);
    		GameTextForPlayer(playerid, string, 3000, 1);
			AC_BS_GivePlayerMoney(playerid, -maska);
			PlayerInfo[playerid][pNovac] -= maska;
    		PlayerInfo[playerid][pMaska] = 1;
    		Kupnja(playerid);
    		}
    		if(listitem == 5)
	        {
	        if(SafeGetPlayerMoney(playerid) < rucnisat) return SCM(playerid, COLOR_RED,"Nemas dovoljno novca!");
	        PlayerInfo[playerid][pArtikl] = 6;
         	format(string, sizeof(string), "~r~-$%d", rucnisat);
    		GameTextForPlayer(playerid, string, 3000, 1);
			AC_BS_GivePlayerMoney(playerid, -rucnisat);
			PlayerInfo[playerid][pNovac] -= rucnisat;
    		PlayerInfo[playerid][pSat] = 1;
    		Kupnja(playerid);
    		}
    		if(listitem == 6)
	        {
	        if(PlayerInfo[playerid][pGodine] < 18) return SCM(playerid, COLOR_WHITE,"BLAGAJNICA: Momak, nemas 18 godina.");
	        if(SafeGetPlayerMoney(playerid) < pivo) return SCM(playerid, COLOR_RED,"Nemas dovoljno novca!");
	        PlayerInfo[playerid][pArtikl] = 7;
         	format(string, sizeof(string), "~r~-$%d", pivo);
    		GameTextForPlayer(playerid, string, 3000, 1);
			AC_BS_GivePlayerMoney(playerid, -pivo);
			PlayerInfo[playerid][pNovac] -= pivo;
    		PlayerInfo[playerid][pPivo] = 1;
    		Kupnja(playerid);
    		}
    		if(listitem == 7)
	        {
	        if(PlayerInfo[playerid][pSok] != 0) return SCM(playerid, COLOR_RED,"Vec imate jedan sok, prvo njega popijte.");
	        if(SafeGetPlayerMoney(playerid) < cocta) return SCM(playerid, COLOR_RED,"Nemas dovoljno novca!");
	        PlayerInfo[playerid][pArtikl] = 8;
         	format(string, sizeof(string), "~r~-$%d", cocta);
    		GameTextForPlayer(playerid, string, 3000, 1);
			AC_BS_GivePlayerMoney(playerid, -cocta);
			PlayerInfo[playerid][pNovac] -= cocta;
    		PlayerInfo[playerid][pSok] = 1;
    		Kupnja(playerid);
    		}
			if(listitem == 8)
	        {
	        if(PlayerInfo[playerid][pKruh] != 0) return SCM(playerid, COLOR_RED,"Vec imate jedan kruh, prvo njega pojedite.");
	        if(SafeGetPlayerMoney(playerid) < kruh) return SCM(playerid, COLOR_RED,"Nemas dovoljno novca!");
	        PlayerInfo[playerid][pArtikl] = 9;
         	format(string, sizeof(string), "~r~-$%d", kruh);
    		GameTextForPlayer(playerid, string, 3000, 1);
			AC_BS_GivePlayerMoney(playerid, -kruh);
			PlayerInfo[playerid][pNovac] -= kruh;
    		PlayerInfo[playerid][pKruh] = 1;
    		Kupnja(playerid);
    		}
			if(listitem == 9)
	        {
        	if(PlayerInfo[playerid][pKruh] != 0) return SCM(playerid, COLOR_RED,"Vec imate jedan salamu, prvo nju pojedite.");
	        if(SafeGetPlayerMoney(playerid) < piko) return SCM(playerid, COLOR_RED,"Nemas dovoljno novca!");
	        PlayerInfo[playerid][pArtikl] = 10;
         	format(string, sizeof(string), "~r~-$%d", piko);
    		GameTextForPlayer(playerid, string, 3000, 1);
			AC_BS_GivePlayerMoney(playerid, -piko);
			PlayerInfo[playerid][pNovac] -= piko;
    		PlayerInfo[playerid][pPiko] = 1;
    		Kupnja(playerid);
    		}
    	}
	}

Neke slike/video za lakse dobivanje pomoci(neobavezno):

Vidi, na /enter komandi stavi
[MAX_PLAYERS];
ubizu[playerid]
Dakle to definiši kao
new ubizui
na /enter komandi stavi tu varijabilu da setuje u loop-u, to znači ono
for(new i; bla bla
I npr ja sam stavio "i", ti stavi kakav je tebi loop, ugl ovako stavi varijabilu
ubizu[playerid] i;
I onda u dijalozima koristi ovako
new i = ubizu[playerid];

Nerazumijem kakve to veze ima. Pogledaj bolje kodu

Znaci u svakom Listitemu otvara Kupnja public(on je na kraju listitema)

U tome publicu ima provjere koordinata(svih 24/7), i ako je na nekon, onda potavlja tome i tome bizu blagajnu na koliko i koliko

Ima sve tamo

Ovako ti je sigurnije, nisi fino uradio, ti radi kako misliš da ti je bolje bmk..