Scriptfiles saving to folder?
#1

Hey everyone, I got a little question, actualy i`m trying to figure a thing out:
So here`s the plan... You know a medium populated server like mine (70-80 players) can always have problems with the scriptfiles folder, like you know, some noob admin banning players or someone setting players skins to 123456 and making their game crash and sh^t like that, well i am trying to make some kind of a Scriptfiles backup system, like backup-ing the scriptfiles folder at every PayDay (yes, i`m using a GF edit)
So, under :

public PayDay() , we have :

SendClientMessage(i, COLOR_GREEN, "|___ BANK STATMENT ___|");
format(string, sizeof(string), " Paycheck: $%d Tax Money: -$%d", checks, TaxValue);
SendClientMessage(i, COLOR_WHITE, string);
if(PlayerInfo[i][pPhousekey] != 255 || PlayerInfo[i][pPbiskey] != 255)
{
format(string, sizeof(string), " Electricity Bill: -$%d", ebill);
SendClientMessage(i, COLOR_GRAD1, string);
}
format(string, sizeof(string), " Balance: $%d", account - checks);
SendClientMessage(i, COLOR_WHITE, string);
format(string, sizeof(string), " Interest Rate: 0.%d percent",tmpintrate);
SendClientMessage(i, COLOR_GRAD2, string);
format(string, sizeof(string), " Interest Gained $%d", interest);
SendClientMessage(i, COLOR_GRAD3, string);
SendClientMessage(i, COLOR_GREEN, "|--------------------------------------|");
format(string, sizeof(string), " New Balance: $%d", PlayerInfo[i][pAccount]);
SendClientMessage(i, COLOR_GRAD5, string);
format(string, sizeof(string), " Rent: -$%d", rent);
SendClientMessage(i, COLOR_GRAD5, string);
format(string, sizeof(string), "~y~PayDay~n~~w~Check paid into your account");
GameTextForPlayer(i, string, 5000, 1);
PlayerHasRobbedBank[i] = 0;

Now, what i`m trying to do is to make a new public function, like let`s say

public SaveAccounts()
{
new File:file;
bla bla..
}

And this SaveAccounts(); will be added under PlayerHasRobbedBank[i] = 0; , you know? So that the accounts are always saved in some kind of a Backup folder INSIDE the scriptfiles folder, every hour.

So, what i`m asking here: Give me an idea, how to make the SaveAccounts(); function save ALL the accounts and everything that is inside the scriptfiles folder. I just have no freaking idea how to do that! I`m good with timers and crap, but i got noooo idea about saving files outside the script.

Anticipated thanx
Reply
#2

Do you have a current SaveAccounts(); function? If so please paste it here in [!pawn] [!/pawn] brackets.
Reply
#3

no no no i don`t that`s what i`m trying to look for..
Reply
#4

Backuping files every hour is a little... too much?
Just do it manually every day and you'll be fine.
Reply
#5

I assume you're using Godfather / LA-RP?
Reply
#6

I don't think its possible to copy and back up your script files, try using MySQL if you have issues with this a lot, or someone can make a plugin to back up server files at a specific time maybe every 12 hours or so the plugin makes a back up. I myself am trying to make a plugin, but I have no idea and experience of C++.
Reply
#7

No, but it would be simple to create a new function to save it in an alternate folder every hour, wouldn't it?
Reply
#8

You can create two folders in scriptfiles folder, one with Current the second with Backup names

and each PD its save new things and old things is write into Backup folder, its quiet simple^^
Reply
#9

Quote:
Originally Posted by Shadow™
Посмотреть сообщение
No, but it would be simple to create a new function to save it in an alternate folder every hour, wouldn't it?
There we go, that`s what i`m trying to do... I`m still learning from the wiki things with fcreate, fremove, fwrite, etc.

And no, saving all the accounts in a new folder isn`t so... much, but i`m trying to make this automaticly, u know ?

Oh, and yes, i`m using a GF edit.
Reply
#10

Anyone? An idea?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)