[Pomoc] Telefon

Započeo Adi_Corleone, Januar 09, 2014, 19:28:19 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: UP
Detaljan opis problema: Pozdrav radi se o up modu kupovina telefona na 24/7 telefon kupis 1 mozes opet da kupis kolko god puta oces i broj se menja kako taj bug da sredim evo vam dialog i cmd
Dio skripte:
YCMD:kupi(playerid, params[], help)
{
    #pragma unused help
    if(UlogovanProvera[playerid] == 0) return SCM(playerid,-1,"MC:RP | "CRVENA"Moras se ulogovati da bi koristio ovu komandu!");
	new x;
	for(new i; i < MAX_FIRMI; i++)
    {
		if(IsPlayerInRangeOfPoint(playerid, 25.0, FirmaInfo[i][fIzlazX], FirmaInfo[i][fIzlazY], FirmaInfo[i][fIzlazZ]) && GetPlayerVirtualWorld(playerid) == FirmaInfo[i][fVW])
		{
			if(FirmaInfo[i][fVrsta] == VRSTA_MARKET)
			{
				x++;
				if(FirmaInfo[UsaoFirma[playerid]][fProizvodi] <= 0) return SCM(playerid,-1,""SPLAVA"[Firma]: "BELA"Nemamo vise proizvoda!");
			    new string1[275], string2[275], string[550];
				format(string1,sizeof(string1),""SPLAVA"- "BELA"Mobilni Telefon (150$)\n"CRVENA"- "BELA"Imenik (50$)\n"CRVENA"- "BELA"Cigare (20$)\n"CRVENA"- "BELA"Upaljac (10$)\n"CRVENA"- "BELA"Dopuna od 50$\n"CRVENA"- "BELA"Dopuna od 100$\n"CRVENA"- "BELA"Kanap (350$)\n");
				format(string2,sizeof(string2),""SPLAVA"- "BELA"Naocare (300$)\n"CRVENA"- "BELA"Cvece (100$)\n"CRVENA"- "BELA"Sok (10$)\n"CRVENA"- "BELA"Pivo (10$)\n"CRVENA"- "BELA"Kockica (15$)\n"CRVENA"- "BELA"Sprej (70$)\n"CRVENA"- "BELA"Sat (130$)\n"CRVENA"- "BELA"Marama (500$)\n"CRVENA"- "BELA"Hrana (300$)");
			    format(string, sizeof(string), "%s%s", string1, string2);
			    SPD(playerid, MARKET_KUPOVINA, DIALOG_STYLE_LIST, ""BELA"Market Kupovina", string, "Kupi", "Izlaz");
				break;
			}
			else if(FirmaInfo[i][fVrsta] == VRSTA_SEXSHOP)
			{
				x++;
				if(FirmaInfo[UsaoFirma[playerid]][fProizvodi] <= 0) return SCM(playerid,-1,""SPLAVA"[Firma]: "BELA"Nemamo vise proizvoda!");
				SPD(playerid, KUPOVINA_SEXSHOP, DIALOG_STYLE_LIST, ""BELA"Sex Shop", ""LJUB"- "BELA"Sivi Vibrator (50$)\n"LJUB"- "BELA"Beli Vibrator (50$)\n"LJUB"- "BELA"Ljubicasti Vibrator (70$)\n"LJUB"- "BELA"Cvece (10$)", "Kupi", "Izlaz");
				break;
			}
			else if(FirmaInfo[i][fVrsta] == VRSTA_GUNSHOP)
			{
				x++;
				if(FirmaInfo[UsaoFirma[playerid]][fProizvodi] <= 0) return SCM(playerid,-1,""SPLAVA"[Firma]: "BELA"Nemamo vise proizvoda!");
			    if(PlayerInfo[playerid][pLevel] < 2) return SCM(playerid,-1, "MC:RP | "ZUTA"Morate biti najmanje level 2 da bi mogli kupovati oruzije!");
				if(PlayerInfo[playerid][pGunDozvola] == 0) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Morate imati dozvolu za oruzije da bi kupili oruzije!");
				SPD(playerid, KUPOVINA_GUNSHOP, DIALOG_STYLE_LIST, ""BELA"Gun Shop", ""SPLAVA"- "BELA"Noz (100$)\n"SPLAVA"- "BELA"Adia (60$)\n"SPLAVA"- "BELA"Shotgun (500$)\n"SPLAVA"- "BELA"Padobran (250$)\n"SPLAVA"- "BELA"Dezert (600$)\n"SPLAVA"- "BELA"M4 (1000$)\n"SPLAVA"- "BELA"AK-47 (1000$)\n"SPLAVA"- "BELA"MP5 (900$)\n"SPLAVA"- "BELA"Sniper (2000$)", "Kupi", "Izlaz");
				break;
			}
			else if(FirmaInfo[i][fVrsta] == VRSTA_KLADIONICA)
   			{
   			    x++;
   			    new broj, brojk = random(300), string[128];
				if(FirmaInfo[UsaoFirma[playerid]][fProizvodi] <= 0) return SCM(playerid,-1,""SPLAVA"[Firma]: "BELA"Nemamo vise proizvoda!");
   			    if(sscanf(params, "i",broj)) return SCM(playerid, -1, ""SPLAVA"MC:RP Pomoc | "BELA"/kupi [BROJ 1- 300 (50$)]");
                if(broj < 1 || broj > 300) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "BELA"Ne mozete ici ispod 1 i vise od 300!");
				if(PlayerInfo[playerid][pNovacDzep] < 50) return SCM(playerid,-1,""SPLAVA"MC:RP | "SIVA"Nemate dovoljno novca!");
				KladionicaBroj[playerid] = broj; g_NovacMinus(playerid, 50);
				if(KladionicaBroj[playerid] == brojk)
			    {
			        SCM(playerid,-1,""SPLAVA"[Kladionica]: "SIVA"Cestitamo pogodili ste broj, osvojili ste 1500$!");
	                g_NovacPlus(playerid, 1500);
	                format(string,sizeof(string),"[MC:RP] "SPLAVA"Igrac %s je osvojio na kladionici 1500$!",GetName(playerid));
					AdminGameMaster(-1, string);
					FirmaInfo[UsaoFirma[playerid]][fProizvodi]--; FirmaNovac(UsaoFirma[playerid], 50);
			    }
			    else
			    {
			        SCM(playerid,-1,""SPLAVA"[Kladionica]: "SIVA"Zao nam je ovaj put niste osvojili na kladionici!");
                    FirmaInfo[UsaoFirma[playerid]][fProizvodi]--; FirmaNovac(UsaoFirma[playerid], 50);
				}
				break;
   			}
		}
	}
	for(new i = 86; i < 91; i++)
   	{
   	    if(IsPlayerInRangeOfPoint(playerid, 5.0, FirmaInfo[i][fUlazX], FirmaInfo[i][fUlazY], FirmaInfo[i][fUlazZ]))
		{
   			if(FirmaInfo[i][fVrsta] == VRSTA_SBIZZ)
			{
				x++;
				KioskKupovina[playerid] = i;
				SPD(playerid, DIALOG_TRAFIKA, DIALOG_STYLE_LIST, ""BELA"Trafika", ""SPLAVA"- "BELA"Dopuna (20$)\n"CRVENA"- "BELA"Dopuna (50$)\n"CRVENA"- "BELA"Dopuna (100$)\n"CRVENA"- "BELA"Sok (10$)\n"CRVENA"- "BELA"Cigare (20$)\n"CRVENA"- "BELA"Upaljac (10$)\n"CRVENA"- "BELA"Cokoladica (10$)", "Odaberi", "Izlaz");
                break;
			}
   		}
	}
	return 1;
}


DIALOG
if(dialogid == MARKET_KUPOVINA)
	{
		if(!response) return 1;
		if(FirmaInfo[UsaoFirma[playerid]][fProizvodi] <= 0) return SCM(playerid,-1,""SPLAVA"[Firma]: "BELA"Nemamo vise proizvoda!");
		FirmaInfo[UsaoFirma[playerid]][fProizvodi]--;
		switch(listitem)
		{
			case 0:
			{
				if(PlayerInfo[playerid][pMobilni] == 1) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Vec posedujes mobilni telefon!");
				if(PlayerInfo[playerid][pNovacDzep] < 150) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 150$!");
			    new br = 100000 + random(899000);
				PlayerInfo[playerid][pMobilni] = br;
				g_NovacMinus(playerid,150);
				FirmaNovac(UsaoFirma[playerid],150);
				SCMF(playerid,-1,""ZELENA"Kupili ste mobilni telefon | Broj vaseg mobilnog je: "SIVA"%d!",br);
				SavePlayer(playerid);
			}
			case 1:
			{
				if(PlayerInfo[playerid][pImenik] == 1) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Vec posedujes imenik!");
				if(PlayerInfo[playerid][pNovacDzep] < 50) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 50$!");
				PlayerInfo[playerid][pImenik] = 1;
				g_NovacMinus(playerid,50);
				FirmaNovac(UsaoFirma[playerid],50);
				SCM(playerid,-1,""ZELENA"Kupili ste imenik za 50$! | /broj [Za listu brojeva]");
				SavePlayer(playerid);
			}
			case 2:
			{
				if(PlayerInfo[playerid][pCigare] != 0) return SCMF(playerid,-1,""SPLAVA"[MC:RP] "SIVA"Vec imas %d cigara prvo ih popusi!",PlayerInfo[playerid][pCigare]);
			   	if(PlayerInfo[playerid][pNovacDzep] < 20) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 20$!");
				PlayerInfo[playerid][pCigare] = 20;
				g_NovacMinus(playerid,20);
				FirmaNovac(UsaoFirma[playerid],20);
				SCM(playerid,-1,""ZELENA"Kupili ste cigare | Sada mozete zapliti cigaru (/zaAdiigaru | /ugasicigaru)!");
				SavePlayer(playerid);
			}
			case 3:
			{
				if(PlayerInfo[playerid][pUpaljac] == 1) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Vec posedujes upaljac!");
			   	if(PlayerInfo[playerid][pNovacDzep] < 10) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 10$!");
				PlayerInfo[playerid][pUpaljac] = 10;
				g_NovacMinus(playerid,10);
				FirmaNovac(UsaoFirma[playerid],10);
				SCM(playerid,-1,""ZELENA"Kupili ste upaljac za 10$!");
				SavePlayer(playerid);
			}
			case 4:
			{
				if(PlayerInfo[playerid][pMobilni] == 0) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate mobilni telefon!");
			   	if(PlayerInfo[playerid][pNovacDzep] < 50) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 50$!");
				PlayerInfo[playerid][pMobKredit] += 50;
				g_NovacMinus(playerid,50);
				FirmaNovac(UsaoFirma[playerid],50);
				SCM(playerid,-1,""ZUTA"INFO | "SIVA"Kupili ste 50 kredita za 50$!");
				SavePlayer(playerid);
			}
			case 5:
			{
				if(PlayerInfo[playerid][pMobilni] == 0) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate mobilni telefon!");
			   	if(PlayerInfo[playerid][pNovacDzep] < 100) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 100$!");
				PlayerInfo[playerid][pMobKredit] += 100;
				g_NovacMinus(playerid,100);
				FirmaNovac(UsaoFirma[playerid],100);
				SCM(playerid,-1,""ZUTA"INFO | "SIVA"Kupili ste 100 kredita za 100$!");
				SavePlayer(playerid);
			}
			case 6:
			{
				if(PlayerInfo[playerid][pKanap] == 1) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Vec posedujes kanap!");
			   	if(PlayerInfo[playerid][pNovacDzep] < 350) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 350$!");
				PlayerInfo[playerid][pKanap] = 1;
				g_NovacMinus(playerid,350);
				FirmaNovac(UsaoFirma[playerid],350);
				SCM(playerid,-1,""ZUTA"INFO | "SIVA"Kupili ste kanap za 350$!");
				SCM(playerid,-1,""ZUTA"INFO | "SIVA"Sada mozete nekoga kindapovati | /zavezi | /odvezi!");
				SavePlayer(playerid);
			}
			case 7:
			{
				if(PlayerInfo[playerid][pNaocare] == 1) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Vec posedujes kolekciju naocara!");
			   	if(PlayerInfo[playerid][pNovacDzep] < 300) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 300$!");
				PlayerInfo[playerid][pNaocare] = 1;
				g_NovacMinus(playerid,300);
				FirmaNovac(UsaoFirma[playerid],300);
				SCM(playerid,-1,""ZUTA"INFO | "SIVA"Kupili ste naocare za 300$!");
				SCM(playerid,-1,""ZUTA"INFO | "SIVA"Sada mozete staviti naocare /naocare!");
				SavePlayer(playerid);
			}
			case 8:
			{
			   	if(PlayerInfo[playerid][pNovacDzep] < 100) return SCM(playerid,-1, ""SPLAVA"[MC:RP]"SIVA"Nemate dovoljno novca 100$!");
				g_NovacMinus(playerid,100);
				FirmaNovac(UsaoFirma[playerid],100);
				g_GivePlayerWeapon(playerid, 14, 1);
				SCM(playerid,-1,""ZELENA"Kupili ste cvece za 100$!");
			}
			case 9:
			{
			   	if(PlayerInfo[playerid][pNovacDzep] < 10) return SCM(playerid,-1, ""SPLAVA"[MC:RP]"SIVA"Nemate dovoljno novca 10$!");
				g_NovacMinus(playerid,10);
				FirmaNovac(UsaoFirma[playerid],10);
				SetPlayerSpecialAction( playerid, SPECIAL_ACTION_DRINK_SPRUNK);
				SCM(playerid,-1,""ZELENA"Kupili ste sok za 10$!");
			}
			case 10:
			{
			   	if(PlayerInfo[playerid][pNovacDzep] < 10) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 10$!");
				g_NovacMinus(playerid,10);
				FirmaNovac(UsaoFirma[playerid],10);
				SetPlayerSpecialAction( playerid, SPECIAL_ACTION_DRINK_BEER);
				SCM(playerid,-1,""ZELENA"Kupili ste pivo za 10$!");
			}
			case 11:
			{
				if(Kockica[playerid] == 1) return SCM(playerid,-1,""SPLAVA"[MC:RP] "SIVA"Vec imas kockicu!");
			   	if(PlayerInfo[playerid][pNovacDzep] < 15) return SCM(playerid,-1, ""SPLAVA"(GRESKA) "SIVA"Nemate dovoljno novca 15$!");
				g_NovacMinus(playerid,15);
				FirmaNovac(UsaoFirma[playerid],15);
				Kockica[playerid] = 1;
				SCM(playerid,-1,""ZELENA"Kupili ste kockicu za 15$ (/kockica)!");
			}
			case 12:
			{
			   	if(PlayerInfo[playerid][pNovacDzep] < 70) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 70$!");
				g_NovacMinus(playerid,70);
				FirmaNovac(UsaoFirma[playerid],70);
				g_GivePlayerWeapon(playerid, 41, 500);
				SCM(playerid,-1,""ZELENA"Kupili ste sprej za 70$!");
			}
			case 13:
			{
				if(PlayerInfo[playerid][pSat] == 1) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Vec posedujes sat!");
			   	if(PlayerInfo[playerid][pNovacDzep] < 130) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 130$!");
				g_NovacMinus(playerid,130);
				FirmaNovac(UsaoFirma[playerid],130);
				PlayerInfo[playerid][pSat] = 1;
				SCM(playerid,-1,""ZELENA"Kupili ste sat za 130$ (/vreme)!!");
			}
			case 14:
			{
				if(Marama[playerid] == 1) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Vec posedujes maramu!");
			   	if(PlayerInfo[playerid][pNovacDzep] < 500) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 500$!");
				g_NovacMinus(playerid,500);
				FirmaNovac(UsaoFirma[playerid],500);
				Marama[playerid] = 1;
				SCM(playerid,-1,""ZELENA"Kupili ste maramu za 500$ (/marama)!");
			}
			case 15:
			{
				if(PlayerInfo[playerid][pHrana] == 5) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Ne mozete imati vise od 5 hrane!");
			   	if(PlayerInfo[playerid][pNovacDzep] < 300) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Nemate dovoljno novca 300$!");
				g_NovacMinus(playerid,300);
				FirmaNovac(UsaoFirma[playerid],300);
				PlayerInfo[playerid][pHrana] ++;
				SCM(playerid,-1,""ZELENA"Kupili ste hranu (/koristi)!");
			}
		}
	}


Big Respect: Bugi :)


ja mislim da vidim problem
napravio si proveru
if(PlayerInfo[playerid][pMobilni] == 1) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Vec posedujes mobilni telefon!");


a taj enum koristis da ti upisiva broj telefona logicno da ti nece radit
69

Citat: C++ poslato Januar 09, 2014, 19:32:20 POSLE PODNE
ja mislim da vidim problem
napravio si proveru
if(PlayerInfo[playerid][pMobilni] == 1) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Vec posedujes mobilni telefon!");


a taj enum koristis da ti upisiva broj telefona logicno da ti nece radit

mozs mi rec kako da sredim brate hitno mi je :) hvala nemoj se samnom mucit objasnjavat poslo nemam pojma


Big Respect: Bugi :)


pa kad kupis telefon postavis mu pMobilni na 1
kreiras novi enum pBroj i upisivas mu broj
to je to.
69

Citat: C++ poslato Januar 09, 2014, 19:41:01 POSLE PODNE
pa kad kupis telefon postavis mu pMobilni na 1
kreiras novi enum pBroj i upisivas mu broj
to je to.

jbg brate nisam umjetnik ko ti mozes mi dat kodove na pastebin.com i rec ovo stavi ovdje ovo tamo :/ ? unapred hvala i izvini na smetnji


Big Respect: Bugi :)


Citat: C++ poslato Januar 09, 2014, 19:32:20 POSLE PODNE
ja mislim da vidim problem
napravio si proveru
if(PlayerInfo[playerid][pMobilni] == 1) return SCM(playerid,-1, ""SPLAVA"[MC:RP] "SIVA"Vec posedujes mobilni telefon!");


a taj enum koristis da ti upisiva broj telefona logicno da ti nece radit

Ili jedonstavno == 1 zameni sa >= 1 :D
RESPECT: Blaeks, Yui_Sang, Gagi, Kapetan Husein, Luksa, Slay, Denis_Lapi, Zoran(Dude)

Programski jezici koje koristim: C, C#, Visual Basic, HTML, CSS, PHP (tek ucim).


Najbolje da definises neki nevalidan broj mobitela (recimo -2048)
#define INVALID_PHONE_NR -2048


I da kod registriranja postavljas broj umjesto na 0 da stavis INVALID_PHONE_NR (-2048)

I kod provjere jednostavno stavljas ako mu je broj telefona INVALID_PHONE_NR (-2048), znaci da nema teleon i da moze kupit, inace ne moze!?

Nije se to trebalo Bugi hvala ti si mi pomogao :) LOCK


Big Respect: Bugi :)