placing the right selected weapon from GetPlayerWeaponData into the car trunk at ondialogresponse
#1

hey all,

so i made this small thing, that when a player wants to put something in the trunk of his car, it gets the weapons the player has, and shows them in a dialog, but now my problem is:

how can i check at the dialog response, WHICH weapon is at the case 0, case 1, etc?

because i want to make it that it attaches the object into the trunk, now i already got the weapons that attach at the right place, i just need to know how i can make it that it checks which weapon the player has selected.

my code:

pawn Код:
else if(current == GameMenus[trunkmenu])
    {
        switch(row)
        {
            case STORE_WEAPONS:
            {
                new Count, x;
                new string[128];
                new WeapName[24], slot, weap, ammo;
                for(slot = 0; slot < 14; slot++)
                {
                    GetPlayerWeaponData(playerid, slot, weap, ammo);
                    if( ammo != 0 && weap != 0)
                    Count++;
                }
                if(Count < 1)
                {
                    ShowMenuForPlayer(GameMenus[trunkmenu], playerid);
                    return SendClientMessage(playerid,COLOR_BLUE,"You have no weapons");
                }
                if(Count >= 1)
                {
                    for (slot = 0; slot < 14; slot++)
                    {
                        GetPlayerWeaponData(playerid, slot, weap, ammo);

                        if( ammo != 0 && weap != 0)
                        {
                            GetWeaponName(weap, WeapName, sizeof(WeapName));
                            if(ammo == 65535 || ammo == 1)
                            format(string,sizeof(string),"%s%s (1)",string, WeapName);
                            else format(string,sizeof(string),"%s%s (%d)",string, WeapName, ammo);
                            x++;
                            if(x >= 5)
                            {
                                ShowPlayerDialog(playerid, DIALOG_TRUNKWEAPS, DIALOG_STYLE_LIST, "Deposit your Weapons", string, "Deposit", "Cancel");
                                x = 0;
                                format(string, sizeof(string), "");
                            }
                            else format(string, sizeof(string), "%s,  ", string);
                        }
                        if(x <= 4 && x > 0)
                        {
                            string[strlen(string)-3] = '.';
                            ShowPlayerDialog(playerid, DIALOG_TRUNKWEAPS, DIALOG_STYLE_LIST, "Deposit your Weapons", string, "Deposit", "Cancel");
                        }
                    }
                }
            }
        }
    }
that checks which weapons the player has and puts it in a dialog.

pawn Код:
switch(dialogid)
    {
        case DIALOG_TRUNKWEAPS:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                       
                    }
                }
            }
        }
i want to know which listitem is which weapon that the player has selected in the dialog, anybody knows how i do this?

greets Apenmeeuw
Reply
#2

Anybody? Please, I really want to have this good.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)