LoadBusinesses() {
if(!fexist("businesses.cfg")) return 1;
new
szFileStr[1024],
File: iFileHandle = fopen("businesses.cfg", io_read),
iIndex;
while(iIndex < sizeof(BizInfo) && fread(iFileHandle, szFileStr)) {
sscanf(szFileStr, "p<|>iiis[128]s[24]ffffffffiiiff",
BizInfo[iIndex][bOwned],
BizInfo[iIndex][bLevel],
BizInfo[iIndex][bHInteriorWorld],
BizInfo[iIndex][bDescription],
BizInfo[iIndex][bOwner],
BizInfo[iIndex][bExteriorX],
BizInfo[iIndex][bExteriorY],
BizInfo[iIndex][bExteriorZ],
BizInfo[iIndex][bExteriorR],
BizInfo[iIndex][bInteriorX],
BizInfo[iIndex][bInteriorY],
BizInfo[iIndex][bInteriorZ],
BizInfo[iIndex][bInteriorR],
BizInfo[iIndex][bValue],
BizInfo[iIndex][bPickupID],
BizInfo[iIndex][bCustomInterior],
BizInfo[iIndex][bCustomExterior],
BizInfo[iIndex][bExteriorA],
BizInfo[iIndex][bInteriorA]
);
if(BizInfo[iIndex][bOwned]) {
format(szFileStr, sizeof(szFileStr), "%s\n[Owner: %s]\nLevel: %d\nID: %d",BizInfo[iIndex][bDescription],BizInfo[iIndex][bOwner],BizInfo[iIndex][bLevel],iIndex);
DestroyDynamicPickup(BizInfo[iIndex][bPickupID]);
BizInfo[iIndex][bPickupID] = CreateDynamicPickup(1274, 23, BizInfo[iIndex][bExteriorX], BizInfo[iIndex][bExteriorY], BizInfo[iIndex][bExteriorZ]);
}
else format(szFileStr, sizeof(szFileStr), "%s\n[Owner: None]\nCost: $%d\n Level: %d\nID: %d\nTo buy this business type /buybiz",BizInfo[iIndex][bDescription],BizInfo[iIndex][bValue],BizInfo[iIndex][bLevel],iIndex);
DestroyDynamicPickup(BizInfo[iIndex][bPickupID]);
BizInfo[iIndex][bPickupID] = CreateDynamicPickup(1274, 23, BizInfo[iIndex][bExteriorX], BizInfo[iIndex][bExteriorY], BizInfo[iIndex][bExteriorZ]);
BizInfo[iIndex][bTextID] = CreateDynamic3DTextLabel(szFileStr, COLOR_LIGHTBLUE, BizInfo[iIndex][bExteriorX], BizInfo[iIndex][bExteriorY], BizInfo[iIndex][bExteriorZ]+0.5,30.0, .testlos = 1, .streamdistance = 30.0);
++iIndex;
}
return fclose(iFileHandle);
}
p<|>iiis[128]s[24]ffffffffiiiff
i BizInfo[iIndex][bOwned],
i BizInfo[iIndex][bLevel],
i BizInfo[iIndex][bHInteriorWorld],
s[128] BizInfo[iIndex][bDescription],
s[24] BizInfo[iIndex][bOwner],
f[1] BizInfo[iIndex][bExteriorX],
f[2] BizInfo[iIndex][bExteriorY],
f[3] BizInfo[iIndex][bExteriorZ],
f[4] BizInfo[iIndex][bExteriorR],
f[5] BizInfo[iIndex][bInteriorX],
f[6] BizInfo[iIndex][bInteriorY],
f[7] BizInfo[iIndex][bInteriorZ],
f[8] BizInfo[iIndex][bInteriorR],
i[1] BizInfo[iIndex][bValue],
i[2] BizInfo[iIndex][bPickupID],
i[3] BizInfo[iIndex][bCustomInterior],
f[1] BizInfo[iIndex][bCustomExterior],
f[2] BizInfo[iIndex][bExteriorA],
?? BizInfo[iIndex][bInteriorA]
PHP код:
|
sscanf("1,2,3","p<,>iii", var0, var1, var2);
// var0 = 1
// var1 = 2
// var3 = 3
p will change the delimiter
so instead of exploding the text by space, it will explode by | PHP код:
|