08.07.2013, 10:02
pawn Код:
Dialog:Test(playerid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 2013:
{
if(response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
SendClientMessage(playerid,-1,"You purchased a Spraycan for $100!");
GivePlayerWeapon(playerid, 41, 100);
GivePlayerMoney(playerid, -100);
}
case 1:
{
if(GetPlayerMoney(playerid) <50) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
SendClientMessage(playerid, -1, "You purchased a Baseball Bat for $50!");
GivePlayerWeapon(playerid, 5, 1);
GivePlayerMoney(playerid, -50);
}
case 2:
{
if(GetPlayerMoney(playerid) <70) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
SendClientMessage(playerid, -1, "You purchased a Golf Club for $70!");
GivePlayerWeapon(playerid, 2, 1);
GivePlayerMoney(playerid, -70);
}
case 3:
{
if(GetPlayerMoney(playerid) <70) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
SendClientMessage(playerid, -1, "You purchased a Shovel for $70!");
GivePlayerWeapon(playerid, 6, 1);
GivePlayerMoney(playerid, -70);
}
case 4:
{
if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
SendClientMessage(playerid, -1, "You purchased a Katana for $100!");
GivePlayerWeapon(playerid, 8, 1);
GivePlayerMoney(playerid, -100);
}
case 5:
{
if(GetPlayerMoney(playerid) <60) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
SendClientMessage(playerid, -1, "You purchased a Camera for $60!");
GivePlayerMoney(playerid, -60);
GivePlayerWeapon(playerid, 43, 100);
}
case 6:
{
if(GetPlayerMoney(playerid) <350) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
SendClientMessage(playerid, -1, "You purchased a Mask for $350! ((/maskon & /maskoff))");
GivePlayerMoney(playerid, -350);
(HasBoughtMask[playerid] = 1);
}
case 7:
{
if(GetPlayerMoney(playerid) <10) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
new Float:pHealth;
GetPlayerHealth(playerid, Float:pHealth);
SendClientMessage(playerid, -1, "You purchased a pack of Ruffles for $10! ((+20 HP))");
ApplyAnimation(playerid,"VENDING", "vend_eat1_P",4.1,0,1,1,1,1,1);
GivePlayerMoney(playerid, -10);
SetPlayerHealth(playerid, pHealth+20);
}
case 8:
{
if(GetPlayerMoney(playerid) <10) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
new Float:pHealth;
GetPlayerHealth(playerid, Float:pHealth);
SendClientMessage(playerid, -1, "You purchased a bottle of Coca-Cola for $10! ((+10 HP))");
GivePlayerMoney(playerid, -10);
SetPlayerHealth(playerid, pHealth+10);
}
case 9:
{
if(GetPlayerMoney(playerid) <15) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
new Float:pHealth;
GetPlayerHealth(playerid, Float:pHealth);
SendClientMessage(playerid, -1, "You purchased a Cheese Burger for $15! ((+30 HP))");
ApplyAnimation(playerid,"VENDING", "vend_eat1_P",4.1,0,1,1,1,1,1);
GivePlayerMoney(playerid, -15);
SetPlayerHealth(playerid, pHealth+30);
}
case 10:
{
if(GetPlayerMoney(playerid) <40) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
SendClientMessage(playerid, -1, "You purchased a box of cigars for $40! ((/cigar))");
GivePlayerMoney(playerid, -40);
(HasBoughtCigar[playerid] = 1);
}
case 11:
{
if(GetPlayerMoney(playerid) <20) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
SendClientMessage(playerid, -1, "You purchased a bottle of beer for $20!");
GivePlayerMoney(playerid, -20);
(HasBoughtBeer[playerid] = 1);
}
}
}
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
pawn Код:
CMD:buy(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(playerid, 7.0, 2246.4563,53.0431,26.6671)) return SendClientMessage(playerid,-1,"You need to be in a 24/7 store."); // change the co-ords to the ones you want
ShowDialog(playerid, Show:Test ,DIALOG_STYLE_LIST,"24/7 Store","Spraycan [$100]\nBat [$50]\nGolf Club [$70]\nShovel [$70]\nKatana [$100]\nCamera [$60]\nMask [$350]\nRuffles [$10]\nCoca-Cola [$10]\nCheeseburger [$15]\nCigarettes [$40]\nBeer [$20]","Purchase","Exit");
return 1;
}