Interio system help? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Interio system help? (
/showthread.php?tid=598657)
Interio system help? -
N0FeaR - 15.01.2016
I making an interior system but won't load mabye u guys can help me out.
PHP Code:
enum iInfo
{
iDiscription[MAX_PLAYER_NAME],
iType,
iWorld,
iInt,
Float:iEntrancex,
Float:iEntrancey,
Float:iEntrancez,
Float:iExitx,
Float:iExity,
Float:iExitz,
iIcon,
iIconT,
iPick,
iPickT,
};
new IntInfo[36][iInfo];
PHP Code:
forward LoadInts();
public LoadInts()
{
new arrCoords[14][64];
new strFromFile2[256];
new File: file = fopen("interiors.cfg", io_read);
if (file)
{
new idx;
while (idx < sizeof(IntInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
strmid(IntInfo[idx][iDiscription], arrCoords[0], 0, strlen(arrCoords[6]), 255);
IntInfo[idx][iType] = strval(arrCoords[1]);
IntInfo[idx][iWorld] = strval(arrCoords[2]);
IntInfo[idx][iInt] = strval(arrCoords[3]);
IntInfo[idx][iEntrancex] = floatstr(arrCoords[4]);
IntInfo[idx][iEntrancey] = floatstr(arrCoords[5]);
IntInfo[idx][iEntrancez] = floatstr(arrCoords[6]);
IntInfo[idx][iExitx] = floatstr(arrCoords[7]);
IntInfo[idx][iExity] = floatstr(arrCoords[8]);
IntInfo[idx][iExitz] = floatstr(arrCoords[9]);
IntInfo[idx][iIcon] = strval(arrCoords[10]);
IntInfo[idx][iIconT] = strval(arrCoords[11]);
IntInfo[idx][iPick] = strval(arrCoords[12]);
IntInfo[idx][iPickT] = strval(arrCoords[13]);
idx++;
}
}
fclose(file);
return 1;
}
PHP Code:
forward SaveInts();
public SaveInts()
{
new idx;
new File: file2;
while (idx < sizeof(IntInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%s|%d|%d|%d|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d\n",
IntInfo[idx][iDiscription],
IntInfo[idx][iType],
IntInfo[idx][iWorld],
IntInfo[idx][iInt],
IntInfo[idx][iEntrancex],
IntInfo[idx][iEntrancey],
IntInfo[idx][iEntrancez],
IntInfo[idx][iExitx],
IntInfo[idx][iExity],
IntInfo[idx][iExitz],
IntInfo[idx][iIcon],
IntInfo[idx][iIconT],
IntInfo[idx][iPick],
IntInfo[idx][iPickT]);
if(idx == 0)
{
file2 = fopen("interiors.cfg", io_write);
}
else
{
file2 = fopen("interiors.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
}