15.07.2013, 19:08
This should work:
Anyway if it doesn't work, show me what errors you are getting.
pawn Код:
CMD:buyproducts(playerid, params[])
{
new string2[128];
if(PlayerInfo[playerid][pBizKey] != INVALID_BIZZ_ID && (IsPlayerInRangeOfPoint(playerid, 2.0, BizInfo[PlayerInfo[playerid][pBizKey]][IXCoord], BizInfo[PlayerInfo[playerid][pBizKey]][IYCoord], BizInfo[PlayerInfo[playerid][pBizKey]][IZCoord])))
{
if(GetPlayerCash(playerid < params[0]*10))
{
if(sscanf(params, "i", params[0])) return SendClientMessageEx(playerid, COLOR_GRAD3, "USAGE: /buyproducts [amount]");
GivePlayerCash(playerid, -params[0]*10);
BizInfo[PlayerInfo[playerid][pBizKey]][Products] += params[0];
SaveBizInfo(PlayerInfo[playerid][pBizKey]);
format(string2,sizeof(string2),"You have bought %d amount of business products", params);
SendClientMessageEx(playerid, COLOR_GRAD3, string2);
return 1;
}
else return SendClientMessageEx(playerid, COLOR_GRAD2, "You don't have 100$ for each product.");
}
else return SendClientMessageEx(playerid, COLOR_GRAD2, "You don't own a business, or are not inside one of them.");
return 1;
}