24.06.2013, 22:32
pawn Код:
#define DIALOG_SHOP 1
CMD_shop(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "SHOP", "AK-47\nM4A1\nCombat Shotgun", "Choose", "Quit"); //In the command
return 1;
}
//AK is Case 0
//M4 is Case 1
//Combat Shotgun is case 2
//On Dialog Response
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_SHOP:
{
if (!response)
{
return 1;
}
if (response)
{
switch(listitem)
{
case 0://AK
{
if(GetPlayerMoney(playerid) < 2500)
{
SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this weapon");
return 1;
}
SendClientMessage(playerid, COLOR_GREEN, "You have bought an AK for 2500$.");
GivePlayerWeapon(playerid, 30, 300);
}
case 1://M4
{
if(GetPlayerMoney(playerid) < 2500)
{
SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this weapon");
return 1;
}
SendClientMessage(playerid, COLOR_GREEN, "You have bought an M4 for 2500$.");
GivePlayerWeapon(playerid, 31, 300);
}
case 2://Combat Shotgun
{
if(GetPlayerMoney(playerid) < 2500)
{
SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this weapon");
return 1;
}
SendClientMessage(playerid, COLOR_GREEN, "You have bought an AK for 2500$.");
GivePlayerWeapon(playerid, 27, 300);
}
}
}
}
}
return 1;
}