08.04.2013, 20:45
You could also use
It's not much different from what Silver posted, it's just a lot easier to edit
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;
}