Dialog Help
#1

I am trying to make a list dialog which lists players all weapons he have. For example you do a command and a dialog pops up and then you see a list of your weapons.

I have tried this for about few hours but no luck it shows me only 1 weapon that player has.

Код:
new weapons[13][2], wipons[368];
for(new i=0; i<13; i++)
{
	GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
	if(weapons[i][0] == pInfo[playerid][pWeapon][i] && weapons[i][1] != 0)
	{
		format(wipons, sizeof(wipons), "%s Ammo: %d", Wname(weapons[i][0]), weapons[i][1]);
		ShowPlayerDialog(playerid, 300, DIALOG_STYLE_LIST, "Inventory", wipons, "Close", "");
        }
}
If I do that with a SendClientMessage(playerid, RED, wipons); it works perfectly it lists all weapons but not in a dialog for some reason. Any help would be appreciated!
Reply
#2

You try to show 13 dialogs, instead of looping you need to append the text each time
pawn Код:
new
    wipons[512]
;
for(new i, weapon, ammo; i < 13; i++) {
    GetPlayerWeaponData(playerid, i, weapon, ammo);

    if((ammo != 0) && (weapon == pInfo[playerid][pWeapon][i])) {
        format(wipons, sizeof wipons, "%s\n%s Ammo: %d", wipons, Wname(weapon), ammo);
    }
}
if(wipons[0] == EOS) {
    ShowPlayerDialog(playerid, 300, DIALOG_STYLE_LIST, "Inventory", "No weapon", "Close", "");
} else {
    ShowPlayerDialog(playerid, 300, DIALOG_STYLE_LIST, "Inventory", wipons[1], "Close", "");
}
Reply
#3

That really actually worked thank you very much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)