11.08.2013, 05:24
pawn Code:
//HERES THE BUY COMMAND
CMD:buy(playerid, params[])
{
{
if(!IsPlayerInRangeOfPoint(playerid, 8.0, 3167.4341, 500.0863, 4.7500)) return SendClientMessage(playerid,-1,"You need to be in the Galaxy Mall."); // change the co-ords to the ones you want
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Galaxy Mall : Ammunition","Spraycan [$100]\nBat [$50]\nGolf Club [$70]\nShovel [$70]\nKatana [$100]\nCamera [$60]","Purchase","Exit");
}
{
if(!IsPlayerInRangeOfPoint(playerid, 8.0, 3164.3389, 522.0725, 11.9411)) return SendClientMessage(playerid,-1,"You need to be in the Galaxy Mall."); // change the co-ords to the ones you want
ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST,"Galaxy Mall : Fashion","Mask [$350]\nRuffles [$10]\nCoca-Cola [$10]\nCheeseburger [$15]","Purchase","Exit");
}
{
if(!IsPlayerInRangeOfPoint(playerid, 8.0, 3071.0244, 532.2115, 11.7497)) return SendClientMessage(playerid,-1,"You need to be in the Galaxy Mall."); // change the co-ords to the ones you want
ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"Galaxy Mall : Bar","Cigarettes [$40]\nBeer [$20]","Purchase","Exit");
}
return 1;
}
//AND HERES THE RESPONSE CODE...
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==1 && response==1)
{
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, "John: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, "John: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, "John: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, "John: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, "John: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, "John: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, "John: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, "John: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, "John: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, "John: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, "John:You purchased a bottle of beer for $20!");
GivePlayerMoney(playerid, -20);
(HasBoughtBeer[playerid] = 1);
}
}
}
return 1;
}