Dynamic door problem - 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: Dynamic door problem (
/showthread.php?tid=573346)
Dynamic door problem -
IndependentGaming - 06.05.2015
Hello,
I have made a Dynamic door system in my gamemode but i got 1 problems.
when i place doors ingame i can only place 1 door ingame then the first door is gone.
For example if i place door id 0 and then 1 0 is gone if i do it with doorid 1 and place doorid 2 doorid 1 is gone
and my doors are not saving i see in the txt file that the door is placed and when i restart the server the door is gone but still is the txt file
Re: Dynamic door problem -
IndependentGaming - 06.05.2015
PHP код:
stock SaveDynamicDoors()
{
new
szFileStr[512],
File: fHandle = fopen("dynamicdoors.cfg", io_write);
for(new iIndex; iIndex < MAX_DDOORS; iIndex++) {
format(szFileStr, sizeof(szFileStr), "%s|%d|%d|%d|%d|%d|%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%s|%d|%d\r\n",
DDoorsInfo[iIndex][ddDescription],
DDoorsInfo[iIndex][ddCustomInterior],
DDoorsInfo[iIndex][ddExteriorVW],
DDoorsInfo[iIndex][ddExteriorInt],
DDoorsInfo[iIndex][ddInteriorVW],
DDoorsInfo[iIndex][ddInteriorInt],
DDoorsInfo[iIndex][ddExteriorX],
DDoorsInfo[iIndex][ddExteriorY],
DDoorsInfo[iIndex][ddExteriorZ],
DDoorsInfo[iIndex][ddExteriorA],
DDoorsInfo[iIndex][ddInteriorX],
DDoorsInfo[iIndex][ddInteriorY],
DDoorsInfo[iIndex][ddInteriorZ],
DDoorsInfo[iIndex][ddInteriorA],
DDoorsInfo[iIndex][ddCustomExterior],
DDoorsInfo[iIndex][ddAdmin],
DDoorsInfo[iIndex][ddColor],
DDoorsInfo[iIndex][ddPickupModel]
);
fwrite(fHandle, szFileStr);
}
return fclose(fHandle);
}
Re: Dynamic door problem -
ihatetn931 - 06.05.2015
What are you using to load the doors?
Re: Dynamic door problem -
IndependentGaming - 06.05.2015
PHP код:
stock LoadDynamicDoors()
{
new arrCoords[26][64];
new strFromFile2[256];
new File: file = fopen("dynamicdoors.cfg", io_read);
if(file)
{
new idx;
while (idx < sizeof(DDoorsInfo))
{
fread(file, strFromFile2);
splits(strFromFile2, arrCoords, '|');
strmid(DDoorsInfo[idx][ddDescription], arrCoords[0], 0, strlen(arrCoords[0]), 128);
DDoorsInfo[idx][ddCustomInterior] = strval(arrCoords[1]);
DDoorsInfo[idx][ddExteriorVW] = strval(arrCoords[2]);
DDoorsInfo[idx][ddExteriorInt] = strval(arrCoords[3]);
DDoorsInfo[idx][ddInteriorVW] = strval(arrCoords[4]);
DDoorsInfo[idx][ddInteriorInt] = strval(arrCoords[5]);
DDoorsInfo[idx][ddExteriorX] = floatstr(arrCoords[6]);
DDoorsInfo[idx][ddExteriorY] = floatstr(arrCoords[7]);
DDoorsInfo[idx][ddExteriorZ] = floatstr(arrCoords[8]);
DDoorsInfo[idx][ddExteriorA] = floatstr(arrCoords[9]);
DDoorsInfo[idx][ddInteriorX] = floatstr(arrCoords[10]);
DDoorsInfo[idx][ddInteriorY] = floatstr(arrCoords[11]);
DDoorsInfo[idx][ddInteriorZ] = floatstr(arrCoords[12]);
DDoorsInfo[idx][ddInteriorA] = floatstr(arrCoords[13]);
DDoorsInfo[idx][ddCustomExterior] = strval(arrCoords[14]);
DDoorsInfo[idx][ddAdmin] = strval(arrCoords[18]);
DDoorsInfo[idx][ddColor] = strval(arrCoords[21]);
DDoorsInfo[idx][ddPickupModel] = strval(arrCoords[22]);
if(!isnull(DDoorsInfo[idx][ddDescription]))
{
CreateDynamicDoor(idx);
}
idx++;
}
fclose(file);
}
return 1;
}
Re: Dynamic door problem -
Luis- - 06.05.2015
Could I recommend you use MySQL for saving and loading things, it's much more quicker and a lot more stable.