U vezi dialoga

Započeo [BU-RP] Pajke, Septembar 21, 2017, 16:20:49 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim:B-RP
Detaljan opis problema:Zelim npr kada igrac kuca /donweapon1 ili nebitno /donweapon da mu otvori dialog i on u tom dialogu da bira oruzje,evo vidite kodove, jako bih bio zahvalan jer ja da uradim nema sanse svasta sam pokusavao ... Znaci da bude u dialogu a ne ovako samo da mu da oruzije
Dio skripte:
if(strcmp(cmd, "/donweapon1", true) == 0 || strcmp(cmd, "/donoruzje1", true) == 0)
{
 if(PlayerInfo[playerid][pDonateRank] == 0 || PlayerInfo[playerid][pDonateRank] == 1 || PlayerInfo[playerid][pDonateRank] == 2 || PlayerInfo[playerid][pDonateRank] == 3)
	{
		SendClientMessage(playerid, COLOR_GREY, "Morate biti minimum VIP Donator da biste imali ovu funkciju.");
		return 1;
		}
		if(PlayerInfo[playerid][pCash] < 12000)
		{
			SendClientMessage(playerid, COLOR_GREY, "Nemate dovoljno novca za to oruzije.");
			return 1;
		}
		else
		{
			SendClientMessage(playerid, COLOR_WHITE, "Iskoristili ste donatorsku komandu za oruzije!");
			SendClientMessage(playerid, COLOR_WHITE, "Vas racun iznosi 12000$!");
			SafeGivePlayerMoney(playerid, - 12000);
			JBC_SetPlayerName(playerid, OldUsername[playerid]);
			SafeGivePlayerWeapon(playerid, 30, 250);
			return 1;
			}
	return 1;
}
if(strcmp(cmd, "/donweapon2", true) == 0 || strcmp(cmd, "/donoruzje2", true) == 0)
{
 if(PlayerInfo[playerid][pDonateRank] == 0 || PlayerInfo[playerid][pDonateRank] == 1 || PlayerInfo[playerid][pDonateRank] == 2 || PlayerInfo[playerid][pDonateRank] == 3)
	{
		SendClientMessage(playerid, COLOR_GREY, "Morate biti minimum VIP Donator da biste imali ovu funkciju.");
		return 1;
		}
		if(PlayerInfo[playerid][pCash] < 12000)
		{
			SendClientMessage(playerid, COLOR_GREY, "Nemate dovoljno novca za to oruzije.");
			return 1;
		}
		else
		{
			SendClientMessage(playerid, COLOR_WHITE, "Iskoristili ste donatorsku komandu za oruzije!");
			SendClientMessage(playerid, COLOR_WHITE, "Vas racun iznosi 12000$!");
			SafeGivePlayerMoney(playerid, - 12000);
			JBC_SetPlayerName(playerid, OldUsername[playerid]);
   			SafeGivePlayerWeapon(playerid, 29, 250);
			return 1;
			}
	return 1;
}

Neke slike/video za lakse dobivanje pomoci(neobavezno):
Owner na Balkan Underground Evolution
- www.bu-rp.com -


Okej, a kod?
Owner na Balkan Underground Evolution
- www.bu-rp.com -

Prvo moras da kreiras jedan dialog, to radis ovako

#define DIALOG_WEAPONS 3
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "AK47\nM4\nSniper Rifle", "Close");


Onda u ovom public-u odradjues sta ce se desiti kada se klikne na odredju opciju iz tog dialoga

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_WEAPONS)
    {
        if(response) // If they clicked 'Select' or double-clicked a weapon
        {
            // Give them the weapon
            switch(listitem)
            {
                case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Give them a desert eagle
                case 1: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47
                case 2: GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Give them a Combat Shotgun
            }
        }
        return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    }
 
    return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}


BTW Ne moras da koristis switch ovo je samo ovaj primer

Ovo si mogao da nadjes i sam da si malo otisao na Google, bukvalno je na SAMP wiki dat primer koji ti trazis.
Poz!