25.05.2013, 00:42
Add this line to after every line in the /buy command.
For example:
HINT: make sure to look for the //RIGHT HERE VVVVVVVVVVVV messages
For example:
HINT: make sure to look for the //RIGHT HERE VVVVVVVVVVVV messages
pawn Код:
CMD:buy(playerid, params[])
{
new idx = GetPlayerVirtualWorld(playerid)-100, string[128], type, price;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(idx > 0 && idx < MAX_BIZ && BizInfo[idx][bType] != 1 && BizInfo[idx][bType] != 2 && BizInfo[idx][bType] != 3 && BizInfo[idx][bType] != 4 && BizInfo[idx][bType] != 6 || idx < 1 || idx > MAX_BIZ) return SendClientMessage(playerid, COLOR_GREY, "You are not inside a business.");
if(BizInfo[idx][bType] == 1)
{
if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buy [item]");
if(BizInfo[idx][bProducts] < 1) return SendClientMessage(playerid, COLOR_GREY, "This business is currently out of products.");
//RIGHT HERE VVVVVVVVVVVV
if(BizInfo[idx][bLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "This 24/7 Market doesn't have this product yet."); //ADD THIS DEPENDING ON THE LEVEL
//THIS LINE HERE ^^^^^^^^^^
if(!strcmp(params, "cellphone", true))
{
if(PlayerInfo[playerid][pMoney] < 100) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this.");
new randphone = random(1000) + random(8999);//minimum 100 max 9999
PlayerInfo[playerid][pNumber] = randphone;
PlayerInfo[playerid][pHasCellphone] = 1;
BizInfo[idx][bMoney] += 100;
BizInfo[idx][bProducts] --;
BizInfo[idx][bSold] ++;
GiveDodMoney(playerid, -100);
format(string, sizeof(string), "* %s has bought a cellphone for $100.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessage(playerid, COLOR_WHITE, " (( Check /stats to check your new Phone Number ))");
}
if(!strcmp(params, "phonebook", true))
{