Account deletion after 25 days
#1

Hi, I have been wanting to add something like this to my script but I have no idea were to start. What would I need to use to achieve it? If it involves "unix timestamps" then you might have to explain it to me as I don't really understand the tutorial, I suppose I could have another read of it but it'd still be nice if you could explain things to me.

Thanks.
Reply
#2

What are you using to store your files in the first place? If you are using MySQL / SQLite, just add a last logged field and then every day just run a timer that checks if the player has logged in the last 25 days (using the timestamp) on all users and run a query like the following

pawn Code:
new timestamp = gettime() - (60*60*24*25);
new query[100];
format(query, sizeof(query), "DELETE FROM playerinfo WHERE lastlogged < %d", timestamp);
mysql_query(query);
Reply
#3

Yeah, I am using MySQL. I will try that and post back the results. Thanks.

Hmm, it for some reason deletes the account straight away. I have no idea why.
Reply
#4

edit: nvm stupid post
Reply
#5

Still need some help.
Reply
#6

What do you currently have? I'll check it tomorrow when I wake up .
Reply
#7

I have a timer set at 1 minute for testing purposes.
pawn Code:
SetTimer("AccountCheck", 60000, true);
And I have the actual timer function.
pawn Code:
forward AccountCheck();
public AccountCheck()
{
    new timestamp = gettime() - (60*60*24*1);
    new query[100], data[64];
    format(query, sizeof(query), "DELETE FROM `accounts` WHERE `LastLogged` < %d", timestamp);
    mysql_query(query);
    printf("ACCOUNT DELETION: %d - AFFECTED ROWS: %d", timestamp, mysql_affected_rows());
    return 1;
}
Reply
#8

Change %s to '%d'.
Reply
#9

It was like that before, still didn't work.
Reply
#10

Most likely the last logged recording is wrong.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)