Hel with adding to variable and saving it
#1

I want to do that each time player writes /payborder 500 adds to the file, but what happens is it allways stays 500 even if I do it multiple times.

Thanks in advance

pawn Код:
if(!strcmp(cmd, "/payborder"))
    {
        if(canopen == 1)
        {
            new File:ftw=fopen("armymoneycollect.txt", io_write);
            new empety;
            new string[256];
            if(IsPlayerInRangeOfPoint(playerid, 8, 631.2999900,-1193.0000000,19.3000000))
            {
                MoveDynamicObject(tunnel, 631.2999900,-1193.0000000, 14.89999961853, 5);
                SendClientMessage(playerid, COLOR_BLUE,"* Border Sucessfully opened, closing in 5 seconds!");
                SetTimer("tunnelc", 5000, false);
                GivePlayerMoney(playerid, -500);
                empety += 500;
                format(string,sizeof(string),"%d", empety);
                SendClientMessage(playerid, -1, string);
                if(ftw)
                {
                    fread(ftw, string);
                    format(string,sizeof(string),"%d", empety);
                    fwrite(ftw, string);
                    fclose(ftw);
                }
            }
Reply
#2

You are just setting 500.

You should read, get, then add 500 to the obtained value, then save.
Reply
#3

thanks to both but the thing is that the server im scriptong for isn't using y_ini.
So how can read the fule and then add to it? pr is there a way to stock y_ini?
Reply
#4

I know about including it, but they don't have it, im not scripting for myself
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)