About trunks.
#6

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
Its just storing weapon ID and Ammo
Same like any other system...

I see that delimiter is , so you will find split/explode or sscanf on trunk load
System as for houses,cars ect....

At server start you read data from file and store them to variables (enum) and when server shut down you save them (Some people save them after every change or every X amount of time)
I know that it uses a delimiter, that's not a problem at all, as SQLite uses columns, which is better.

But I get stuck at understanding the following code.
pawn Код:
new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%i,%i,%i,%i,%i,%i,%i,%i,%i,%f\n",
        vehTrunk[idx][1],
        vehTrunkAmmo[idx][1],
        vehTrunk[idx][2],
        vehTrunkAmmo[idx][2],
        vehTrunk[idx][3],
        vehTrunkAmmo[idx][3],
        vehTrunk[idx][4],
        vehTrunkAmmo[idx][4],
        vehTrunkCounter[idx],
        vehTrunkArmour[idx]);
        if(idx == 1)
        {
            file2 = fopen("LARP/Trunks/trunk.cfg", io_write);
        }
        else
        {
            file2 = fopen("LARP/Trunks/trunk.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
Ok, the part that I don't understand is
pawn Код:
if(idx == 1)
        {
            file2 = fopen("LARP/Trunks/trunk.cfg", io_write);
        }
        else
        {
            file2 = fopen("LARP/Trunks/trunk.cfg", io_append);
        }
Does it re-write them or "update" ?

Also this code is part of a while function, and the idx integer value is 184, why?
Reply


Messages In This Thread
About trunks. - by Zh3r0 - 14.07.2011, 17:36
Re: About trunks. - by Steven82 - 14.07.2011, 19:28
Re: About trunks. - by Flyfishes - 14.07.2011, 19:28
Re: About trunks. - by Zh3r0 - 14.07.2011, 20:29
Re: About trunks. - by DRIFT_HUNTER - 14.07.2011, 21:01
Re: About trunks. - by Zh3r0 - 14.07.2011, 21:03
Re: About trunks. - by DRIFT_HUNTER - 14.07.2011, 21:10
Re: About trunks. - by Zh3r0 - 14.07.2011, 21:13

Forum Jump:


Users browsing this thread: 2 Guest(s)