07.02.2012, 22:23
pawn Код:
CMD:sellprods(playerid, params[])
{
new ammount;
new price;
new string[128];
for(new b= 0; b < sizeof(BizzInfo); b++)
{
format(file6, sizeof(file6), "realityrp/bizzes/%d.ini", b);
BizzInfo[b][benx] = dini_Float(file6, "benx");
BizzInfo[b][beny] = dini_Float(file6, "beny");
BizzInfo[b][benz] = dini_Float(file6, "benz");
if(sscanf(params, "i", ammount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /sellprods [ammount]");
if(PlayerInfo[playerid][pJob] != pJob_8) return SendClientMessage(playerid, COLOR_GREY, "You must be a trucker to do this!");
if(vjob[GetPlayerVehicleID(playerid)] != 8) return SendClientMessage(playerid, COLOR_GREY, "You must be in a delivery truck!");
if(!IsPlayerInRangeOfPoint(playerid, 15.0, BizzInfo[b][benx],BizzInfo[b][beny], BizzInfo[b][benz])) return SendClientMessage(playerid, COLOR_GREY, "You are not near a business!");
if(PlayerInfo[playerid][Prods] <= ammount) return SendClientMessage(playerid, COLOR_GREY, "You do not have enough products for that!");
if(ammount + BizzInfo[b][bprods] >= 300) return SendClientMessage(playerid, COLOR_GREY, "Business can not have more then 300 products!");
price = ammount * 8;
GivePlayerCash(playerid, price);
BizzInfo[b][bprods] = BizzInfo[b][bprods] + ammount;
PlayerInfo[playerid][Prods] = PlayerInfo[playerid][Prods] - ammount;
format(string, sizeof(string), "You just sold %d products for $%d!", ammount, price);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
return 1;
}