15.07.2016, 12:05
Hi! I just finished editing my friend's script, but when I tested the dynamic businesses, it doesn't show the if(sscanf(params function. It just says the "Businesses are between 1 and 8." command error. Here is the full line of /createbiz
pawn Код:
CMD:createbiz(playerid, params[])
{
new type, string[128];
if(PlayerInfo[playerid][pBizMengm] == 1)
if(sscanf(params, "i", type))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createbiz [type]");
SendClientMessage(playerid, COLOR_GREY, "TYPES: 1) 24/7 | 2) Clothes Shop | 3) Ammunation | 4) Club");
SendClientMessage(playerid, COLOR_GREY, "TYPES: | 5) Advertisement Agency[Buggd] | 6) Fast Food | 7) Gym | 8) VIP");
return 1;
}
if(type < 1 || type > 8) return SendClientMessage(playerid, COLOR_GREY, "Businesses are between 1 and 8.");
for(new idx=1; idx<MAX_BIZ; idx++)
{
if(!BizInfo[idx][bType])
{
// Getting Business Setup
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
// Making Business
BizInfo[idx][bType] = type;
format(BizInfo[idx][bOwner], 32, "The State");
BizInfo[idx][bX] = X;
BizInfo[idx][bY] = Y;
BizInfo[idx][bZ] = Z;
BizInfo[idx][bMoney] = 0;
BizInfo[idx][bProducts] = 0;
BizInfo[idx][bSold] = 0;
BizInfo[idx][bLevel] = 1;
BizInfo[idx][bPrice] = 5000000;
BizInfo[PlayerInfo[playerid][pBiz]][bStatus] = 1;
BizInfo[idx][bPickup] = CreateDynamicPickup(1274, 1, X, Y, Z, 0);
format(string, sizeof(string), "ID: %d\n%s\nOwner: %s\nStatus: For Sale\nPrice: $%d", idx, RBT(idx), BizInfo[idx][bOwner], BizInfo[idx][bPrice]);
BizInfo[idx][bText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, X, Y, Z, 15);
format(string, sizeof(string), "AdmWarn: %s has created business ID %d.", RPN(playerid), idx);
ABroadCast(COLOR_DARKRED, string, 2 );
SaveBiz();
idx = MAX_BIZ;
}
}
return 1;
}