16.02.2014, 12:57
Try this:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOGWEAPONS)
{
if(response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) <10000) return SendClientMessage(playerid, gun, "You don't have enough money to buy this item!");
SendClientMessage(playerid, gun, "You bought a deagle for 10k!");
GivePlayerMoney(playerid, -10000);
GivePlayerWeapon(playerid,24, 200);
}
case 1:
{
if(GetPlayerMoney(playerid) <2500) return SendClientMessage(playerid, gun, "You don't have enough money to buy this item!");
SendClientMessage(playerid, gun, "You bought a shotgun for 2.5k!");
GivePlayerMoney(playerid, -2500);
GivePlayerWeapon(playerid, 25, 200);
}
case 2:
{
if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid, gun, "You don't have enough money to buy this item!");
SendClientMessage(playerid, gun, "You bought an MP5 for 5k!");
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 29 ,300);
}
case 3:
{
if(GetPlayerMoney(playerid) <13000) return SendClientMessage(playerid, gun, "You don't have enough money to buy this item!");
SendClientMessage(playerid, gun, "You bought a spas12 for 13k!");
GivePlayerMoney(playerid, -13000);
GivePlayerWeapon(playerid, 27, 300);
}
case 4:
{
if(GetPlayerMoney(playerid) <14000) return SendClientMessage(playerid, gun, "You don't have enough money to buy this item!");
SendClientMessage(playerid, gun, "You bought an Ak-47 for 14k!");
GivePlayerMoney(playerid, -14000);
GivePlayerWeapon(playerid,30 ,450);
}
case 5:
{
if(GetPlayerMoney(playerid) <15000) return SendClientMessage(playerid, gun, "You don't have enough money to buy this item!");
SendClientMessage(playerid, gun, "You bought an M4 for 15k!");
GivePlayerMoney(playerid, -15000);
GivePlayerWeapon(playerid, 31, 450);
}
case 6:
{
if(GetPlayerMoney(playerid) <16000) return SendClientMessage(playerid, gun, "You don't have enough money to buy this item!");
SendClientMessage(playerid, gun, "You bought a sniper for 16k!");
GivePlayerMoney(playerid, -16000);
GivePlayerWeapon(playerid, 34, 210);
}
case 7:
{
if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid, gun, "You don't have enough money to buy this item!");
new Float:armour;
GetPlayerArmour(playerid, armour);
if(armour == 100) return SendClientMessage(playerid, gun,"You already have a full Armour!");
SendClientMessage(playerid, gun, "You bought a half armour for 5k!");
GivePlayerMoney(playerid, -5000);
SetPlayerArmour(playerid, 50);
}
case 8:
{
if(GetPlayerMoney(playerid) <10000) return SendClientMessage(playerid, gun, "You don't have enough money to buy this item!");
new Float:armour;
GetPlayerArmour(playerid, armour);
if(armour == 100) return SendClientMessage(playerid, gun, "You already have a full Armour!");
SendClientMessage(playerid, gun, "You bought a full Armour for 10k!");
GivePlayerMoney(playerid, -10000);
SetPlayerArmour(playerid, 100);
}
}
}
return 1;
}