[pomoc] dialog


Započeo El Toni, Jul 05, 2011, 11:19:48 PRE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: GF
Detaljan opis problema: evo ova komanda da napravim u dialogu koij se djelovi trebaju promenit i sta se drugo treba dodavati....moze mi neko fino kazati?
Dio skripte:
if(strcmp(cmd, "/drink", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(IsPlayerInRangeOfPoint(playerid, 5, 1211.5846,-905.1202,42.9272)) // Ovde stavite kordinate gde hocete da vam se nalazi /drink...
 			{
   				if(PlayerDrunk[playerid] < 10)
      			{
	                new Float:health;
	                new x_nr[128];
					x_nr = strtok(cmdtext, idx);
					if(!strlen(x_nr)) {
						SendClientMessage(playerid, COLOR_GREEN, "_______Ladni Pijaloci_______");
						SendClientMessage(playerid, COLOR_WHITE, "Komanda: /drink [ime na pijalok]");
				  		SendClientMessage(playerid, COLOR_GREY, "Momentalno imame: Pivo ($6), Vodka ($10), Viski ($10), Voda ($0), Pepsi ($2)");
						SendClientMessage(playerid, COLOR_GREEN, "________________________");
						return 1;
					}
				    if(strcmp(x_nr,"pivo",true) == 0)
					{
 						if(PlayerInfo[playerid][pAge] < 1)
						{
						    SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete pivo.");
						    return 1;
						}
					    GivePlayerMoney(playerid, - 6);
					    PlayerDrunk[playerid] += 1;
						if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
						if(GetPlayerHealth(playerid, health) < 100)
						{
						    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 15; SetPlayerHealth(playerid, health + hp); }
							else { SetPlayerHealth(playerid, health + 15.0); }
						}
					}
					else if(strcmp(x_nr,"vodka",true) == 0)
					{
					    if(PlayerInfo[playerid][pAge] < 18)
						{
						    SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete Vodka.");
						    return 1;
						}
					    GivePlayerMoney(playerid, - 10);
					    PlayerDrunk[playerid] += 2;
						if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
						if(GetPlayerHealth(playerid, health) < 100)
						{
						    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 25; SetPlayerHealth(playerid, health + hp); }
							else { SetPlayerHealth(playerid, health + 25.0); }
						}
					}
					else if(strcmp(x_nr,"viski",true) == 0)
					{
					    if(PlayerInfo[playerid][pAge] < 18)
						{
						    SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete Viski.");
						    return 1;
						}
					    GivePlayerMoney(playerid, - 10);
					    PlayerDrunk[playerid] += 3;
						if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
						if(GetPlayerHealth(playerid, health) < 100)
						{
						    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 27; SetPlayerHealth(playerid, health + hp); }
							else { SetPlayerHealth(playerid, health + 27.0); }
						}
					}
					else if(strcmp(x_nr,"voda",true) == 0)
					{
					    GivePlayerMoney(playerid, 0);
					    if(GetPlayerHealth(playerid, health) < 100)
						{
						    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
							else { SetPlayerHealth(playerid, health + 5.0); }
						}
					}
					else if(strcmp(x_nr,"pepsi",true) == 0)
					{
					    GivePlayerMoney(playerid, - 2);
					    if(GetPlayerHealth(playerid, health) < 100)
						{
						    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
							else { SetPlayerHealth(playerid, health + 5.0); }
						}
					}
					else
					{
					    SendClientMessage(playerid, COLOR_WHITE, "Kelner: Momentalno nemame takov pijalok.");
					    return 1;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s pije %s.", sendername ,x_nr);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	            }
	            else
	            {
	                SendClientMessage(playerid, COLOR_GREY, "   Nemozete poveke da piete,kje povratite !");
	                return 1;
	            }
	        }
	        else
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Ne ste na sankot !");
	            return 1;
	        }
	    }
	    return 1;
	}

Neke slike/video za lakse dobivanje pomoci(neobavezno):
Poslednja Izmena: Jul 05, 2011, 11:20:09 PRE PODNE od Gigov.so

Samo koristis ShowPlayerDialog i onda ides dalje u OnDialogResponse, ima tutova o tome
Uskoro novi stunt server iStunt. DoÄ'ite i zabavite se!




   
   




Dizajniram za $$$
Popis stvari koje radim:

Wallpaper √  Signature ×  Logo √  Dizajn stranice (Ne kodiranje) √  Baner √  Avatar √  Animacija √  Intro √

Citat: System32 poslato Jul 05, 2011, 11:20:40 PRE PODNE
Samo koristis ShowPlayerDialog i onda ides dalje u OnDialogResponse, ima tutova o tome
ok pokusacu to da napravim pa ko nesta nie uredu stavicu

moze ova tema lock!

ne nemoj locakt, ako zapnes onda ovdje postaj pa cemo ti pomoci
Uskoro novi stunt server iStunt. DoÄ'ite i zabavite se!




   
   




Dizajniram za $$$
Popis stvari koje radim:

Wallpaper √  Signature ×  Logo √  Dizajn stranice (Ne kodiranje) √  Baner √  Avatar √  Animacija √  Intro √

Citat: Gigov.so poslato Jul 05, 2011, 11:19:48 PRE PODNE
if(strcmp(cmd, "/drink", true) == 0)
	{
        ShowPlayerDialog(playerid, TESTDIALOG, DIALOG_STYLE_LIST, "Ladni pijaloci"," Pivo\nVodka\nViski\nVoda\nPepsi ", "Izberi", "Izlez");
		return 1;
	}
	    if(IsPlayerConnected(playerid))
	    {
			if(IsPlayerInRangeOfPoint(playerid, 5, 1211.5846,-905.1202,42.9272)) // Ovde stavite kordinate gde hocete da vam se nalazi /drink...
 			{
   				if(PlayerDrunk[playerid] < 10)
      			{
	                new Float:health;
	                new x_nr[128];
					x_nr = strtok(cmdtext, idx);
					if(!strlen(x_nr)) {
						SendClientMessage(playerid, COLOR_GREEN, "_______Ladni Pijaloci_______");
						SendClientMessage(playerid, COLOR_WHITE, "Komanda: /drink [ime na pijalok]");
				  		SendClientMessage(playerid, COLOR_GREY, "Momentalno imame: Pivo ($6), Vodka ($10), Viski ($10), Voda ($0), Pepsi ($2)");
						SendClientMessage(playerid, COLOR_GREEN, "________________________");
						return 1;
					}
				    if(strcmp(x_nr,"pivo",true) == 0)
					{
 						if(PlayerInfo[playerid][pAge] < 1)
						{
						    SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete pivo.");
						    return 1;
						}
					    GivePlayerMoney(playerid, - 6);
					    PlayerDrunk[playerid] += 1;
						if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
						if(GetPlayerHealth(playerid, health) < 100)
						{
						    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 15; SetPlayerHealth(playerid, health + hp); }
							else { SetPlayerHealth(playerid, health + 15.0); }
						}
					}
					else if(strcmp(x_nr,"vodka",true) == 0)
					{
					    if(PlayerInfo[playerid][pAge] < 18)
						{
						    SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete Vodka.");
						    return 1;
						}
					    GivePlayerMoney(playerid, - 10);
					    PlayerDrunk[playerid] += 2;
						if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
						if(GetPlayerHealth(playerid, health) < 100)
						{
						    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 25; SetPlayerHealth(playerid, health + hp); }
							else { SetPlayerHealth(playerid, health + 25.0); }
						}
					}
					else if(strcmp(x_nr,"viski",true) == 0)
					{
					    if(PlayerInfo[playerid][pAge] < 18)
						{
						    SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete Viski.");
						    return 1;
						}
					    GivePlayerMoney(playerid, - 10);
					    PlayerDrunk[playerid] += 3;
						if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
						if(GetPlayerHealth(playerid, health) < 100)
						{
						    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 27; SetPlayerHealth(playerid, health + hp); }
							else { SetPlayerHealth(playerid, health + 27.0); }
						}
					}
					else if(strcmp(x_nr,"voda",true) == 0)
					{
					    GivePlayerMoney(playerid, 0);
					    if(GetPlayerHealth(playerid, health) < 100)
						{
						    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
							else { SetPlayerHealth(playerid, health + 5.0); }
						}
					}
					else if(strcmp(x_nr,"pepsi",true) == 0)
					{
					    GivePlayerMoney(playerid, - 2);
					    if(GetPlayerHealth(playerid, health) < 100)
						{
						    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
							else { SetPlayerHealth(playerid, health + 5.0); }
						}
					}
					else
					{
					    SendClientMessage(playerid, COLOR_WHITE, "Kelner: Momentalno nemame takov pijalok.");
					    return 1;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s pije %s.", sendername ,x_nr);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	            }
	            else
	            {
	                SendClientMessage(playerid, COLOR_GREY, "   Nemozete poveke da piete,kje povratite !");
	                return 1;
	            }
	        }
	        else
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Ne ste na sankot !");
	            return 1;
	        }
	    }
	    return 1;
	}

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

jel to tako treba stajati gore showplayerdialog???
i ovo jel treba da trgnim
if(!strlen(x_nr)) {
						SendClientMessage(playerid, COLOR_GREEN, "_______Ladni Pijaloci_______");
						SendClientMessage(playerid, COLOR_WHITE, "Komanda: /drink [ime na pijalok]");
				  		SendClientMessage(playerid, COLOR_GREY, "Momentalno imame: Pivo ($6), Vodka ($10), Viski ($10), Voda ($0), Pepsi ($2)");
						SendClientMessage(playerid, COLOR_GREEN, "________________________");
						return 1;
					}

ne, posljec ti ja napravit, i ne koristi IsPlayerConnected
Uskoro novi stunt server iStunt. DoÄ'ite i zabavite se!




   
   




Dizajniram za $$$
Popis stvari koje radim:

Wallpaper √  Signature ×  Logo √  Dizajn stranice (Ne kodiranje) √  Baner √  Avatar √  Animacija √  Intro √

X

*

if(strcmp(cmd, "/drink", true) == 0)
	{
		if(IsPlayerInRangeOfPoint(playerid, 5, 1211.5846,-905.1202,42.9272)//ako je igrac na toj koordinati prikazuje mu dialog
		{
			ShowPlayerDialog(playerid, TESTDIALOG, DIALOG_STYLE_LIST, "Ladni pijaloci","Pivo\nVodka\nViski\nVoda\nPepsi ", "Izberi", "Izlez");
			return 1;
		}
		else //igrac nije na toj koordinati pa mu vraca poruku
		{
			SendClientMessage(playerid, COLOR_GREY, "   Ne ste na sankot !");
			return 1;
		}
		return 1;
	}


Sad kreiras dialog response, tj sta ce se desiti kada u nekom odredjenom dijalogu, u tvom slucaju, odaberes nesto sa liste.
Nadji public OnDialogResponse i ispod njega dodajes:
if(dialogid == TESTDIALOG)
	{
		if(response)
		{
			if(listitem == 0)//ako odabere ono sto je prvo na listi odradi sljedeci kod, u ovom slucaju pivo, tu kopiraj ono sto ti se nalazi ispod onog dijela "if(strcmp(x_nr,"pivo",true) == 0)"
			{
				if(PlayerInfo[playerid][pAge] < 1)
				{
					SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete pivo.");
					return 1;
				}
				GivePlayerMoney(playerid, - 6);
				PlayerDrunk[playerid] += 1;
				if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
				if(GetPlayerHealth(playerid, health) < 100)
				{
					if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 15; SetPlayerHealth(playerid, health + hp); }
					else { SetPlayerHealth(playerid, health + 15.0); }
				}
			}
			else if(listitem ==1)//ako odabere drugu opciju odradi sljedeci kod, itd, itd
			{
			}
			.
			.
			.
		}
	}


Nadam se da ti je jasnije
Pod dialog response, mozes umjesto if,else if strukture koristiti i switch, ali ce ti i ovako raditi.

eto on ti je dao samo, ne treba ele if u OnDialogResonse samo if(listitem..
Uskoro novi stunt server iStunt. DoÄ'ite i zabavite se!




   
   




Dizajniram za $$$
Popis stvari koje radim:

Wallpaper √  Signature ×  Logo √  Dizajn stranice (Ne kodiranje) √  Baner √  Avatar √  Animacija √  Intro √