hallo also ich habe das problem
das ich zurzeit häuser per .cfg erstellen kann jedoch wollen wir auf einen befehl umstellen also zb /createhouse
hoffe mir kan jemand helfen
so ist das bis jetzt
enum hInfo
{
Float:hEntrancex,
Float:hEntrancey,
Float:hEntrancez,
Float:hExitx,
Float:hExity,
Float:hExitz,
hOwner[MAX_PLAYER_NAME],
hPrice,
hInt,
hLock,
hOwned,
hRent,
hRentabil,
hKasse,
hLevel,
hWorld,
hArmor,
hLeben
}
new HouseInfo[SCRIPT_MAXHOUSES][hInfo];
public LoadProperty()
{
new arrCoords[30][64];
new strFromFile2[256];
new File: file = fopen("houses.cfg", io_read);
if (file)
{
new idx;
while (idx < sizeof(HouseInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
HouseInfo[idx][hEntrancex] = floatstr(arrCoords[0]);
HouseInfo[idx][hEntrancey] = floatstr(arrCoords[1]);
HouseInfo[idx][hEntrancez] = floatstr(arrCoords[2]);
HouseInfo[idx][hExitx] = floatstr(arrCoords[3]);
HouseInfo[idx][hExity] = floatstr(arrCoords[4]);
HouseInfo[idx][hExitz] = floatstr(arrCoords[5]);
strmid(HouseInfo[idx][hOwner], arrCoords[6], 0, strlen(arrCoords[6]), 255);
HouseInfo[idx][hPrice] = strval(arrCoords[7]);
HouseInfo[idx][hInt] = strval(arrCoords[8]);
HouseInfo[idx][hLock] = strval(arrCoords[9]);
HouseInfo[idx][hOwned] = strval(arrCoords[10]);
HouseInfo[idx][hRent] = strval(arrCoords[11]);
HouseInfo[idx][hRentabil] = strval(arrCoords[12]);
HouseInfo[idx][hKasse] = strval(arrCoords[13]);
HouseInfo[idx][hLevel] = strval(arrCoords[14]);
HouseInfo[idx][hWorld] = strval(arrCoords[15]);
HouseInfo[idx][hArmor] = strval(arrCoords[16]);
HouseInfo[idx][hLeben] = strval(arrCoords[17]);
idx++;
}
fclose(file);
}
return 1;
}
public OnPropUpdate()
{
new idx;
new File: file2;
while(idx < sizeof(HouseInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%f,%f,%f,%f,%f,%f,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
HouseInfo[idx][hEntrancex],
HouseInfo[idx][hEntrancey],
HouseInfo[idx][hEntrancez],
HouseInfo[idx][hExitx],
HouseInfo[idx][hExity],
HouseInfo[idx][hExitz],
HouseInfo[idx][hOwner],
HouseInfo[idx][hPrice],
HouseInfo[idx][hInt],
HouseInfo[idx][hLock],
HouseInfo[idx][hOwned],
HouseInfo[idx][hRent],
HouseInfo[idx][hRentabil],
HouseInfo[idx][hKasse],
HouseInfo[idx][hLevel],
HouseInfo[idx][hWorld],
HouseInfo[idx][hArmor],
HouseInfo[idx][hLeben]);
if(idx == 0)
{
file2 = fopen("houses.cfg", io_write);
}
else
{
file2 = fopen("houses.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
idx = 0;
while(idx < sizeof(BizInfo))
{
new coordsstring2[256];
format(coordsstring2, sizeof(coordsstring2), "%f,%f,%f,%f,%f,%f,%s,%i,%i,%i,%i,%i,%i,%i,%i,%i,%s,%i,%i\n",
BizInfo[idx][bEntrancex],
BizInfo[idx][bEntrancey],
BizInfo[idx][bEntrancez],
BizInfo[idx][bExitx],
BizInfo[idx][bExity],
BizInfo[idx][bExitz],
BizInfo[idx][bOwner],
BizInfo[idx][bPrice],
BizInfo[idx][bInt],
BizInfo[idx][bLock],
BizInfo[idx][bOwned],
BizInfo[idx][bKasse],
BizInfo[idx][bLevel],
BizInfo[idx][bWorld],
BizInfo[idx][bProds],
BizInfo[idx][bMaxProds],
BizInfo[idx][bName],
BizInfo[idx][bEintritt],
BizInfo[idx][bProdPreis]);
if(idx == 0)
{
file2 = fopen("biz.cfg", io_write);
}
else
{
file2 = fopen("biz.cfg", io_append);
}
fwrite(file2, coordsstring2);
idx++;
fclose(file2);
}
Update3d(0);
Update3d(1);
printf("Speichere Häuser...");
return 1;
}