SA-MP Forums Archive
Managing Inactive accounts - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Managing Inactive accounts (/showthread.php?tid=576042)



Managing Inactive accounts - perfectboy - 31.05.2015

Hi guys i have a server and today when i logged in to my vps i say 13k files in my users folder so is there any way to delete inactive users .The server lags a bit when there are 40+ players because of these extra files.

I use ladmin and examples of .sav files

Код:
password_hash=182845945
ip=216.172.142.176
registered=1
RegisteredDate=27/5/2015
Nick=$$M@ster$$
loggedin=0
banned=0
level=0
LastOn=27/5/2015
money=86207
Score=47
kills=2
deaths=0
hours=1
minutes=52
seconds=40
dRank=0
Help Operator=0
Donor=0
x1=165
y1=1971
z1=19
interior1=0
weap1=24
weap1ammo=100
weap2=27
weap2ammo=279
weap3=0
weap3ammo=0
weap4=31
weap4ammo=163
weap5=0
weap5ammo=0
weap6=0
weap6ammo=0
health=100
armour=1
TimesOnServer=2
My code for saving

Код:
	if (udb_Exists(PlayerName2(playerid)))
    {
	  if(PlayerInfo[playerid][LoggedIn] == 0)
	  {

	      ShowPlayerDialog(playerid, 125, DIALOG_STYLE_PASSWORD, ""cred"Account Login",""ccolor"This account is registered!"cgreen" Please login To continue","Login","Kick");
      }
    }
    if (!udb_Exists(PlayerName2(playerid)))
	{
      if(PlayerInfo[playerid][Registered] == 0)
	  {
	      new string[200];
		  format(string, sizeof(string),""cgreen"Welcome To Real World At War 2™ "cred"%s "ccolor"You are not Registered\n"corange"Please Enter a password to register an account", PlayerName2(playerid));
	      ShowPlayerDialog(playerid, 126, DIALOG_STYLE_PASSWORD, "Register",string,"Register","Kick");
      }
    }
    if(PlayerInfo[playerid][LoggedIn] == 1)
    {
        new pname[128];
	    new file[128];
	    GetPlayerName(playerid, pname, sizeof(pname));
        format(file, sizeof(file), savefolder,pname);
        if(!dini_Exists(file))
		{
	        dini_Create(file);
	        dini_IntSet(file, "Score", 0);
	        dini_IntSet(file, "Money", 0);
	        SetPlayerScore(playerid, dini_Int(file, "Score"));
	        SetPlayerMoney(playerid, dini_Int(file, "Money"));
        }

        else
		{
	        SetPlayerScore(playerid, dini_Int(file, "Score"));
	        SetPlayerMoney(playerid, dini_Int(file, "Money"));
	    }
	}



Re: Managing Inactive accounts - perfectboy - 31.05.2015

So can someone make a cmd to delete the inactive users i mean if last login less more that 10 days


Re: Managing Inactive accounts - Vince - 31.05.2015

Because you use files, it is too inefficient to do it in Pawn. Write a shell script that deletes files that were modified more than X days in the past.

And oh, server lag isn't created by files just sitting there doing nothing. The lag is more than likely caused by this outdated and slow contraption known as dini, which opens and closes the file each time it writes a value.


Re: Managing Inactive accounts - Pottus - 31.05.2015

Quote:
Originally Posted by Vince
Посмотреть сообщение
Because you use files, it is too inefficient to do it in Pawn. Write a shell script that deletes files that were modified more than X days in the past.

And oh, server lag isn't created by files just sitting there doing nothing. The lag is more than likely caused by this outdated and slow contraption known as dini, which opens and closes the file each time it writes a value.
That seems like a quick and very easy way to do it on the other hand as you mentioned how outdated dini is the issues go deeper than deleting files.
http://www.howtogeek.com/howto/ubunt...days-on-linux/