[HELP]: Weapon Dialog
#6

You could also use

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == WEAPON_DIALOG)
    {
        if(!response) return 1;
       
        new wepid, ammo, price;
        switch(listitem)
        {
            case 0: { wepid=23; ammo=500; price=500; }
            case 1: { wepid=30; ammo=650; price=2000; }
            case 2: { wepid=31; ammo=650; price=3000; }
            case 3: { wepid=24; ammo=500; price=500; }
            case 4: { wepid=22; ammo=500; price=200; }
            case 5: { wepid=29; ammo=450; price=300; }
            case 6: { wepid=28; ammo=450; price=200; }
            case 7: { wepid=27; ammo=550; price=500; }
            case 8: { wepid=25; ammo=550; price=400; }
            case 9: { wepid=34; ammo=350; price=1500; }
            case 10: { wepid=26; ammo=550; price=500; }
        }
        if(GetPlayerMoney(playerid) < price) return SendClientMessage(playerid, 0xCC0000AA, "You don't have enough money!");

        new string[128];
        format(string, sizeof(string), "%s bought for $%d with %d ammo!", Weapon_Name(wepid), price, ammo);
        SendClientMessage(playerid, COLOR_GREEN, string);
        GivePlayerWeapon(playerid, wepid, ammo);
        GivePlayerMoney(playerid, -price);
        return 1;
    }
    return 0;
}
CMD:weapons(playerid, params[])
{
    ShowPlayerDialog(playerid,WEAPON_DIALOG,DIALOG_STYLE_LIST,"Weapons","Silence $500\nAK-47 $2000\nM4 $3000\nDesert Eagle $500\n9mm $200\nMP5 $300\nMicro SMG $200\nCombat Shotgun $500\nShotgun $400\nSniper Rifle $1500\nSawnoff Shotgun $500","Ok","Exit");
    return 1;
}
stock Weapon_Name(wepid)
{
    new string[35];
    switch(wepid)
    {
        case 18: format(string, sizeof(string), "Molotov");
        case 44: format(string, sizeof(string), "Night Vision Goggles");
        case 45: format(string, sizeof(string), "Thermal Goggles");
        default: GetWeaponName(wepid, string, sizeof(string));
    }
    return string;
}
It's not much different from what Silver posted, it's just a lot easier to edit
Reply


Messages In This Thread
[HELP]: Weapon Dialog - by Areax - 08.04.2013, 17:26
Re: [HELP]: Weapon Dialog - by Riddick94 - 08.04.2013, 17:28
Re: [HELP]: Weapon Dialog - by Areax - 08.04.2013, 18:09
Re: [HELP]: Weapon Dialog - by ReVo_ - 08.04.2013, 19:57
Re: [HELP]: Weapon Dialog - by SilverKiller - 08.04.2013, 20:24
Re: [HELP]: Weapon Dialog - by [ABK]Antonio - 08.04.2013, 20:45
Re: [HELP]: Weapon Dialog - by LukisHard - 08.04.2013, 23:51
Re: [HELP]: Weapon Dialog - by Areax - 09.04.2013, 04:04
Re: [HELP]: Weapon Dialog - by Faisal_khan - 09.04.2013, 05:23

Forum Jump:


Users browsing this thread: 1 Guest(s)