Hallo Community,
in meinen Gogfather wollen sich die Bizzes nicht erstellen...
Code:
LoadSBizz();//Geschäfte
for(new sb = 0; sb < sizeof(SBizzInfo); sb++)
{
new string4[128];
if(SBizzInfo[sb][sbOwned] == 0)
{
format(string4, sizeof(string4), "[Zu verkaufendes Biz! - %s]\nPreis: %d$\nLevel: %d", SBizzInfo[sb][sbMessage],SBizzInfo[sb][sbBuyPrice],SBizzInfo[sb][sbLevelNeeded]);
SBizzInfo[sb][sbText] = Create3DTextLabel(string4,Grun,SBizzInfo[sb][sbEntranceX], SBizzInfo[sb][sbEntranceY], SBizzInfo[sb][sbEntranceZ]+1,15.0,0);
}
if(SBizzInfo[sb][sbOwned] == 1)
{
format(string4, sizeof(string4), "[%s]\nBesitzer: %s\nProdukte: %d/%d", SBizzInfo[sb][sbMessage],SBizzInfo[sb][sbOwner],SBizzInfo[sb][sbProducts],SBizzInfo[sb][sbMaxProducts]);
SBizzInfo[sb][sbText] = Create3DTextLabel(string4,COLOR_RED,SBizzInfo[sb][sbEntranceX], SBizzInfo[sb][sbEntranceY], SBizzInfo[sb][sbEntranceZ]+1,15.0,0);
}
}
for(new h = 0; h < sizeof(SBizzInfo); h++)
{
if(SBizzInfo[h][sbOwned] == 0)
{
AddStaticPickup(1272, 1, SBizzInfo[h][sbEntranceX], SBizzInfo[h][sbEntranceY], SBizzInfo[h][sbEntranceZ]);
pickups++;
}
if(SBizzInfo[h][sbOwned] == 1)
{
AddStaticPickup(1239, 1, SBizzInfo[h][sbEntranceX], SBizzInfo[h][sbEntranceY], SBizzInfo[h][sbEntranceZ]);
pickups++;
}
}
stock LoadSBizz()
{
new arrCoords[16][64];
new strFromFile2[256];
new File: file = fopen("sbizz.cfg", io_read);
if (file)
{
new idx;
while (idx < sizeof(SBizzInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, '|');
SBizzInfo[idx][sbOwned] = strval(arrCoords[0]);
strmid(SBizzInfo[idx][sbOwner], arrCoords[1], 0, strlen(arrCoords[1]), 255);
strmid(SBizzInfo[idx][sbMessage], arrCoords[2], 0, strlen(arrCoords[2]), 255);
SBizzInfo[idx][sbEntranceX] = floatstr(arrCoords[4]);
SBizzInfo[idx][sbEntranceY] = floatstr(arrCoords[5]);
SBizzInfo[idx][sbEntranceZ] = floatstr(arrCoords[6]);
SBizzInfo[idx][sbLevelNeeded] = strval(arrCoords[7]);
SBizzInfo[idx][sbBuyPrice] = strval(arrCoords[8]);
SBizzInfo[idx][sbTill] = strval(arrCoords[10]);
SBizzInfo[idx][sbProducts] = strval(arrCoords[13]);
SBizzInfo[idx][sbMaxProducts] = strval(arrCoords[14]);
printf("SBizzInfo:%d Owner:%s Message:%s Till:%d Products:%d/%d.\n",
//LOGSPAMM
idx,
SBizzInfo[idx][sbOwner],
SBizzInfo[idx][sbMessage],
SBizzInfo[idx][sbTill],
SBizzInfo[idx][sbProducts],
SBizzInfo[idx][sbMaxProducts]);
idx++;
}
fclose(file);
}
return 1;
}
forward OnPropUpdate();
public OnPropUpdate()
{
new idx;
new File: file2;
idx = 0;
while (idx < sizeof(SBizzInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%f|%f|%f|%d|%d|%d|%d|%d\n",
SBizzInfo[idx][sbOwned],
SBizzInfo[idx][sbOwner],
SBizzInfo[idx][sbMessage],
SBizzInfo[idx][sbEntranceX],
SBizzInfo[idx][sbEntranceY],
SBizzInfo[idx][sbEntranceZ],
SBizzInfo[idx][sbLevelNeeded],
SBizzInfo[idx][sbBuyPrice],
SBizzInfo[idx][sbTill],
SBizzInfo[idx][sbProducts],
SBizzInfo[idx][sbMaxProducts]);
if(idx == 0)
{
file2 = fopen("sbizz.cfg", io_write);
}
else
{
file2 = fopen("sbizz.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
Ich hoffe mir kann einer helfen
LG