06.02.2014, 09:59
pawn Код:
CMD:buy(playerid, params[])
{
new idx = GetPlayerVirtualWorld(playerid)-100, string[128], price, bizlevel;
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 && BizInfo[idx][bType] != 7 || idx < 1 || idx > MAX_BIZ) return SendClientMessage(playerid, COLOR_GREY, "You are not inside a business.");
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.");
if(BizInfo[idx][bLevel] < bizlevel) return SendClientMessage(playerid, COLOR_GREY, "This business doesn't have this product yet.");
if(BizInfo[idx][bType] == 1)// return SendClientMessage(playerid, COLOR_GRAD2, " You are not at the 24/7 Market!");
{
if(!strcmp(params, "speedometer", true))
{
if(GetPlayerMoney(playerid) >= price)
{
GivePlayerCash(playerid, -5000);
PlayerInfo[playerid][pSpeedo] = 1;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "Speedometer purchased.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /speedo to use.");
BizInfo[idx][bProducts] --;
BizInfo[idx][bSold] ++;
if(PlayerInfo[playerid][pDonateRank] >= 2)
{
GivePlayerCash(playerid, -(80*price)/100);
BizInfo[idx][bMoney] += price;
format(string, sizeof(string), "VIP: You have received 20 percent off this product. Instead of paying $%d, you paid $%d.", price, (80*price)/100);
SendClientMessageEx(playerid, COLOR_YELLOW, string);
}
else
{
BizInfo[idx][bMoney] += price;
GivePlayerCash(playerid, -price);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
}
}
else if(BizInfo[idx][bType] == 3)// return SendClientMessage(playerid, COLOR_GRAD2, " You are not at the Goverment Ammunation!");
{
if(!strcmp(params, "vest", true))
{
if(GetPlayerMoney(playerid) >= price)
{
format(string, sizeof(string), "* %s has bought a vest for $%d.", GetPlayerNameEx(playerid), price);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerArmour(playerid, 100.00);
BizInfo[idx][bProducts] --;
BizInfo[idx][bSold] ++;
if(PlayerInfo[playerid][pDonateRank] >= 2)
{
GivePlayerCash(playerid, -(80*price)/100);
BizInfo[idx][bMoney] += price;
format(string, sizeof(string), "VIP: You have received 20 percent off this product. Instead of paying $%d, you paid $%d.", price, (80*price)/100);
SendClientMessageEx(playerid, COLOR_YELLOW, string);
}
else
{
BizInfo[idx][bMoney] += price;
GivePlayerCash(playerid, -price);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You are not at the Goverment Ammunation!");
}
}
return 1;
}