PDA

View Full Version : /buy Command Help


Threshold
20/06/2013, 01:12 AM
Hello,
I got a /buy command for businesses like, 24/7 etc. Concentrated on a RP script. I got the command, But when i type it in a business like a 24/7 shop, It says "You are not inside a business". Please i need some help here, Ive tried everything i know.

CMD:buy(playerid, params[])
{
new idx = GetPlayerVirtualWorld(playerid)-100;
if(idx > 0 && idx < MAX_BUSINESSES && BusinessInfo[idx][bType] != 1 && BusinessInfo[idx][bType] != 2 && BusinessInfo[idx][bType] != 3 && BusinessInfo[idx][bType] != 4 && BusinessInfo[idx][bType] != 5 || idx < 1 || idx > MAX_BUSINESSES) return SendClientMessage(playerid, COLOR_GREY, "You are not inside a business.");
if(BusinessInfo[idx][bType] == 1)
{
if(BusinessInfo[idx][bSupplies] == 0)
{
SendClientMessage(playerid, -1, "There is not stock left at the store, check back later!");
}
else
{
ShowPlayerDialogEx(playerid, STOREMENU, DIALOG_STYLE_LIST, "24/7","Phone Book $200\nDice $50\nCondom $5\nSpraycan $20\nRope $100\nCigar $5\nSprunk $1\nMask $5000", "Buy", "Cancel");
}
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You are not in a General Store!");
}

if(BusinessInfo[idx][bType] == 3)
{
if(BusinessInfo[idx][bSupplies] == 0)
{
SendClientMessage(playerid, -1, "There is not stock left at the store, check back later!");
}
else
{
if(PlayerInfo[playerid][pFaction] == 0 && PlayerInfo[playerid][pLeader] == 0 && PlayerInfo[playerid][pDonator] == 0)
ShowPlayerDialogEx(playerid, 3495, DIALOG_STYLE_INPUT, "Skin Selection","Please enter a Skin ID!\n\nNote: Skin Changes cost $250.", "Buy", "Cancel");
else
ShowPlayerDialogEx(playerid, 3495, DIALOG_STYLE_INPUT, "Skin Selection","Please enter a Skin ID!\n\nNote: Your skin changes are free.", "Buy", "Cancel");
}
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You're not in a Clothing Shop!");
}

if(BusinessInfo[idx][bType] == 4)
{
if(BusinessInfo[idx][bSupplies] == 0)
{
SendClientMessageEx(playerid, -1, "There is not stock left at the store, check back later!");
}
else
{
ShowPlayerDialogEx(playerid, 6241, DIALOG_STYLE_LIST, "Bar Drinks!", "Vodka($18)\nWKD($14)\nSmirn-Off Ice($16)\nWhisky($20)\nCarling($7)", "Buy Drink", "Cancel");
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You are not in a Bar!");
}

if(BusinessInfo[idx][bType] == 5)
{
if(BusinessInfo[idx][bSupplies] == 0)
{
SendClientMessageEx(playerid, -1, "There is not stock left at the store, check back later!");
}
else
{
ShowPlayerDialogEx(playerid, 921, DIALOG_STYLE_LIST, "Electronic Store", "Cell Phone $50\nCD Player $5\nPortable Radio $500\nCamera $40", "Select", "Cancel");
}
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You are not in an Electronic Store!");
}
if(BusinessInfo[idx][bType] == 2)
{
if(BusinessInfo[idx][bSupplies] == 0)
{
SendClientMessageEx(playerid, -1, "There is not stock left at the store, check back later!");
}
else
{
ShowPlayerDialogEx(playerid, 94, DIALOG_STYLE_LIST, "Ammunation Gun Store", "Golf Club - $80\nShovel - $100\nCane - $180\nKatana - $240\n9MM - $525\nShotgun - $700\nSilenced Pistol - $560\nMP5 - $925\nParachute - $475\n","Buy","Cancel");
}
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You are not in an Ammunation!");
}
if(BusinessInfo[idx][bType] == 6)
{
if(BusinessInfo[idx][bSupplies] == 0)
{
SendClientMessageEx(playerid, -1, "There is not stock left at the store, check back later!");
}
else
{
ShowPlayerDialogEx(playerid, 920, DIALOG_STYLE_LIST, "Cluckin' Bell", "Chicken Grill Menu - $250\nChicken Delight Menu - $200\nBeef McWrap Menu - $300\nHamburger & Lipton Ice Tea - $150\nBig Tasty Meny - $500\nCrispy Chicken McWrap Menu - $450\n","Buy","Cancel");
}
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You are not in a Cluckin' Bell!");
}
return 1;
}