How can i change a part in a specific line in a file.
#1

Hello i was busy trying to make my own house system and thought it be fun
to make a 'sale' sign in the front yard of the house with a price on it using 3Dtext;

pawn Код:
AddSaleSign(signmodel,saleid, Float:entX, Float:entY, Float:entZ, Float:entA,Price )
{
    new File:pr_file,prstr[130];

   
    signs[saleid][sex] = entX;
    signs[saleid][sey] = entY;
    signs[saleid][sez] = entZ;
    signs[saleid][sea] = entA;
    signs[saleid][cost] = Price;

    pr_file = fopen( propFile[5], io_append );
   
    if(pr_file)SignObject[saleid] = saleid;
    {
    format( prstr, 130, "%d,%d,%f, %f, %f, %f, %d ;// %s\r\n",signmodel,saleid,entX,entY,entZ,entA,Price);
    fwrite( pr_file, prstr );
    fclose( pr_file );
    printf( "PropDB - %s", prstr );

    signs[saleid][sid]= CreateDynamicObject(19470,entX,entY,entZ,0.000000,0.000000,entA,0,-1,-1,50);
        Create3DTextLabel(Price,0xEEEE88FF,entX,entY,entZ+0.75,20.0,0,1);

    }
    return -1;
}

This part basicly returns the following into a file

Код:
19470,0,2268.674560, 35.834636, 26.484375, 178.891632, 50000 ;// 
19470,2,2245.197753, 34.113197, 26.484375, 180.142669, 50000 ;//
The second number is the ID that should be linked later on with the house that it is for
and the last number (50000) is the price

Now the question;

What if i want to change the price ingame ? How would i do that ? does the entire line in the file needs to be deleted ?
Or can i just change the last value somehow ?

If you do know how to then please give me an example.
iknow its kind of an old system but i realy hope it can be done in just one line using just these filefunctions


Thanks in advance
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)