Započeo El Toni
•5. Jul 2011.• Zaključano[pomoc] dialog
876
pregleda
9
postova
Made Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
450
Postovi:
135
Teme:
Pridružio se:Jun 2010
5. Jul 2011.
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:
Neke slike/video za lakse dobivanje pomoci(neobavezno):
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 < 10)
{
new Float:health;
new x_nr;
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 < 1)
{
SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete pivo.");
return 1;
}
GivePlayerMoney(playerid, - 6);
PlayerDrunk += 1;
if(PlayerDrunk >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo > 0) { PlayerDrunk += 1; new hp = 2 * PlayerInfo; hp += 15; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 15.0); }
}
}
else if(strcmp(x_nr,"vodka",true) == 0)
{
if(PlayerInfo < 18)
{
SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete Vodka.");
return 1;
}
GivePlayerMoney(playerid, - 10);
PlayerDrunk += 2;
if(PlayerDrunk >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo > 0) { PlayerDrunk += 1; new hp = 2 * PlayerInfo; hp += 25; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 25.0); }
}
}
else if(strcmp(x_nr,"viski",true) == 0)
{
if(PlayerInfo < 18)
{
SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete Viski.");
return 1;
}
GivePlayerMoney(playerid, - 10);
PlayerDrunk += 3;
if(PlayerDrunk >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo > 0) { PlayerDrunk += 1; new hp = 2 * PlayerInfo; 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 > 0) { new hp = 2 * PlayerInfo; 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 > 0) { new hp = 2 * PlayerInfo; 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):
Made Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
450
Postovi:
135
Teme:
Pridružio se:Jun 2010
5. Jul 2011.
System32 wrote on July 5, 2011, 9:20 am:
Samo koristis ShowPlayerDialog i onda ides dalje u OnDialogResponse, ima tutova o tome
moze ova tema lock!
Made Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
450
Postovi:
135
Teme:
Pridružio se:Jun 2010
5. Jul 2011.
Gigov.so wrote on July 5, 2011, 9:19 am:
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 < 10)
{
new Float:health;
new x_nr;
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 < 1)
{
SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete pivo.");
return 1;
}
GivePlayerMoney(playerid, - 6);
PlayerDrunk += 1;
if(PlayerDrunk >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo > 0) { PlayerDrunk += 1; new hp = 2 * PlayerInfo; hp += 15; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 15.0); }
}
}
else if(strcmp(x_nr,"vodka",true) == 0)
{
if(PlayerInfo < 18)
{
SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete Vodka.");
return 1;
}
GivePlayerMoney(playerid, - 10);
PlayerDrunk += 2;
if(PlayerDrunk >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo > 0) { PlayerDrunk += 1; new hp = 2 * PlayerInfo; hp += 25; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 25.0); }
}
}
else if(strcmp(x_nr,"viski",true) == 0)
{
if(PlayerInfo < 18)
{
SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete Viski.");
return 1;
}
GivePlayerMoney(playerid, - 10);
PlayerDrunk += 3;
if(PlayerDrunk >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo > 0) { PlayerDrunk += 1; new hp = 2 * PlayerInfo; 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 > 0) { new hp = 2 * PlayerInfo; 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 > 0) { new hp = 2 * PlayerInfo; 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;
}Wheel Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
90 / 100 XP
Početnik(0)
39
Postovi:
1
Teme:
Pridružio se:Maj 2011
5. Jul 2011.
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 < 1)
{
SendClientMessage(playerid, COLOR_WHITE, "Kelner: Izvinite,morate da imate najamlku 16 godini za da piete pivo.");
return 1;
}
GivePlayerMoney(playerid, - 6);
PlayerDrunk += 1;
if(PlayerDrunk >= 5) { GameTextForPlayer(playerid, "~w~Vie ste~n~~p~pijan", 3500, 1); }
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo > 0) { PlayerDrunk += 1; new hp = 2 * PlayerInfo; 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.
Morate biti prijavljeni da biste odgovorili na ovu temu.
Prijava