09.08.2011, 06:16
pawn Код:
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pBizKey] == -1)
{
SendClientMessage(playerid, COLOR_GREY, " You do not own a business.");
return 1;
}
new business = PlayerInfo[playerid][pBizKey];
new x_nr[32];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "{CC1100}USAGE: {FFFFFF} /biz [name]");
SendClientMessage(playerid, COLOR_GRAD1, "Available names: EntryFee, Lock, Till, Restock");
if(business == 1)
SendClientMessage(playerid, COLOR_GRAD1, "Available names: Gate");
return 1;
}
pawn Код:
if(!inbusiness && !IsPlayerInRangeOfPoint(playerid, 2.0, BizInfo[business][bOutsideX], BizInfo[business][bOutsideY], BizInfo[business][bOutsideZ]))
Here's another one:
pawn Код:
else if(strcmp(x_nr,"restock",true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,25.0,BizInfo[business][bInsideX],BizInfo[business][bInsideY],BizInfo[business][bInsideZ]))
{
if(GetPlayerVirtualWorld(playerid) == business)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "{CC1100}USAGE: {FFFFFF} /biz restock [amount]");
format(string, sizeof(string), " Your business has %d products.", BizInfo[business][bProducts]);
SendClientMessage(playerid,COLOR_YELLOW,string);
return 1;
}
new amount = strval(tmp);
if(amount > PlayerInfo[playerid][pProducts]) return SendClientMessage(playerid,COLOR_GREY," You don't have that many products.");
if(amount < 1 || amount > 500) return SendClientMessage(playerid,COLOR_GREY," Cannot restock below 1 product or above 500 products.");
if(amount + BizInfo[business][bProducts] > 500) return SendClientMessage(playerid,COLOR_GREY," Your business can only hold 500 max products.");
BizInfo[business][bProducts] += amount;
PlayerInfo[playerid][pProducts] -=amount;
format(string, sizeof(string), " You have restocked %d products into your business. Total Products: %d", amount,BizInfo[business][bProducts]);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
}
}
else
{
return SendClientMessage(playerid,COLOR_GREY," You are not inside your business.");
}
}
See:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,25.0,BizInfo[business][bInsideX],BizInfo[business][bInsideY],BizInfo[business][bInsideZ]))