[Help] Writing info to txt file.
#1

Hello!

I'm trying to create a function to write some details in a text file but some how it doesn't write more lines, I just write one and if I decided to save something else it replaces the old line. Any ideas how to fix it?

pawn Код:
new File:file = fopen("/WIPHouses.txt", io_write);
                if(file)
                {
                    new location[MAX_ZONE_NAME], Float:XENT, Float:YENT, Float:ZENT;
                    new Float:XINT, Float:YINT, Float:ZINT, INT, INFO[250];
                    GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
                    GetPlayerPos(playerid,XENT,YENT,ZENT);
                    new vw = 1 + random(9999);
                   
                    if(interior == 1) { XINT = 1.6769; YINT = -3.0880; ZINT = 999.7207; format(INFO,sizeof(INFO),"Trailer"); INT = 2; }
                    else if(interior == 2) { XINT = 244.0677; YINT = 304.9020; ZINT = 999.3876; format(INFO,sizeof(INFO),"1 Bedroom"); INT = 1; }
                    else if(interior == 3) { XINT = 266.8490; YINT = 304.9795; ZINT = 999.4077; format(INFO,sizeof(INFO),"1 Bedroom"); INT = 2; }
                    else if(interior == 4) { XINT = 2468.4285; YINT = -1698.2990; ZINT = 1013.8448; format(INFO,sizeof(INFO),"3 Room Apartment"); INT = 2; }
                    else if(interior == 5) { XINT = 2807.5845; YINT = -1174.3596; ZINT = 1025.9518; format(INFO,sizeof(INFO),"3 Room Apartment"); INT = 8; }
                    else if(interior == 6) { XINT = 318.6843; YINT = 1115.5068; ZINT = 1084.1976; format(INFO,sizeof(INFO),"3 Room Apartment"); INT = 5; }
                    else if(interior == 7) { XINT = 2324.4192; YINT = -1149.0046; ZINT = 1050.8158; format(INFO,sizeof(INFO),"2 Room Apartment"); INT = 12; }
                    else if(interior == 8) { XINT = 2495.9700; YINT = -1693.3440; ZINT = 1015.0005; format(INFO,sizeof(INFO),"2 Room Apartment"); INT = 3; }
                    else if(interior == 9) { XINT = 300.2926; YINT = 311.1059; ZINT = 1003.4186; format(INFO,sizeof(INFO),"2 Room Apartment"); INT = 4; }
                    else if(interior == 10) { XINT = 446.6754; YINT = 507.0100; ZINT = 1001.7108; format(INFO,sizeof(INFO),"Motel Room"); INT = 12; }
                    format(string,sizeof(string),"%f,%f,%f,%f,%f,%f,0,0,0,0,0,0,The State,%s,%d,0,0,%d,1,0,0,0,0,0,0,0,0,6,%d,%d,0,%s,%d\r\n"
                    ,XINT, YENT, ZENT, XINT, YINT, ZINT, INFO, price, INT, level, vw, location, adress);
                    fwrite(file, string);
             
                    fclose(file);
                }
Reply
#2

Maybe change the mode?
pawn Код:
new File:file = fopen("/WIPHouses.txt", io_append);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)