I am not really understanding it. I have the code below that I am working on:
pawn Код:
if(dialogid == DIALOG_SELLWEAPON)
{
if(response == 0)
{
SendClientMessage(playerid, COLOR_ERROR, "You canceled the purchase.");
return 1;
}
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 2500)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Silenced 9mm");
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
return 1;
}
GivePlayerMoney(playerid,-2500);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Silenced 9mm. You were charged $2500");
GivePlayerWeapon(playerid,23,100);
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
}
case 1:
{
if(GetPlayerMoney(playerid) < 3900)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy Tec9 ($3900)");
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
return 1;
}
GivePlayerMoney(playerid,-3900);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought Tec9. You were charged $3900");
GivePlayerWeapon(playerid,32,500);
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
}
case 2:
{
if(GetPlayerMoney(playerid) < 4000)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Sawn Off Shotguns ($4000)");
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
return 1;
}
GivePlayerMoney(playerid,-4000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Sawn Off Shotguns. You were charged $4000");
GivePlayerWeapon(playerid,26,30);
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
}
case 3:
{
if(GetPlayerMoney(playerid) < 20000)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy Sniper Rifle ($20000)");
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
return 1;
}
GivePlayerMoney(playerid,-20000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought Sniper Rifle. You were charged $20000");
GivePlayerWeapon(playerid,34,30);
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
}
case 4:
{
if(GetPlayerMoney(playerid) < 8000)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a AK-47 ($8000)");
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
return 1;
}
GivePlayerMoney(playerid,-8000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought a AK-47. You were charged $8000");
GivePlayerWeapon(playerid,30,200);
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
}
case 5:
{
if(GetPlayerMoney(playerid) < 500)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy Armor ($500)");
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
return 1;
}
GivePlayerMoney(playerid,-500);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought Armor. You were charged $500");
SetPlayerArmour(playerid, 100);
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
}
case 6:
{
if(GetPlayerMoney(playerid) < 4000)
{
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase Failed_|");
SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy 3 Blocks of C4 ($4000)");
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
return 1;
}
if(HasC4[playerid] == 1)
{
SendClientMessage(playerid, COLOR_ERROR, "You already have C4 on you. You cannot buy more C4.");
return 1;
}
GivePlayerMoney(playerid,-4000);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Purchase_|");
SendClientMessage(playerid, 0x00C7FFAA, "You have bought 3 Blocks of C4. You were charged $4000");
HasC4[playerid] =1;
ShowPlayerDialog(playerid, DIALOG_SELLWEAPON, DIALOG_STYLE_LIST, "{33CCFF}Weapon Dealer","{33CCFF}1. {FFFFFF}[100 Ammo] Silenced 9mm ($2500)\n{33CCFF}2. {FFFFFF}[500 Ammo] Tec9 ($3900)\n{33CCFF}3. {FFFFFF}[30 Ammo] Sawn Off Shotguns ($4000)\n{33CCFF}4. {FFFFFF}[30 Ammo] Sniper Rifle ($20000)\n{33CCFF}5. {FFFFFF}[200 Ammo] AK-47 ($8000)\n{33CCFF}6. {FFFFFF}Armor ($500)\n{33CCFF}7. {FFFFFF}3 Blocks of C4 ($4000)","Okay","Cancel");
}
}
}