Dynamic door problem
#1

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
Reply
#2

PHP код:
stock SaveDynamicDoors()
{

    new
        
szFileStr[512],
        
FilefHandle fopen("dynamicdoors.cfg"io_write);

    for(new 
iIndexiIndex MAX_DDOORSiIndex++) {
        
format(szFileStrsizeof(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(fHandleszFileStr);
    }
    return 
fclose(fHandle);

Reply
#3

What are you using to load the doors?
Reply
#4

PHP код:
stock LoadDynamicDoors()
{
    new 
arrCoords[26][64];
    new 
strFromFile2[256];
    new 
Filefile fopen("dynamicdoors.cfg"io_read);
    if(
file)
    {
        new 
idx;
        while (
idx sizeof(DDoorsInfo))
        {
            
fread(filestrFromFile2);
            
splits(strFromFile2arrCoords'|');
            
strmid(DDoorsInfo[idx][ddDescription], arrCoords[0], 0strlen(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;

Reply
#5

Could I recommend you use MySQL for saving and loading things, it's much more quicker and a lot more stable.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)