Account deletion after 25 days -
Luis- - 18.10.2011
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.
Re: Account deletion after 25 days -
[HiC]TheKiller - 18.10.2011
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);
-
Luis- - 18.10.2011
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.
Re: Account deletion after 25 days -
lolcake - 18.10.2011
edit: nvm stupid post
Re: Account deletion after 25 days -
Luis- - 18.10.2011
Still need some help.
Re: Account deletion after 25 days -
[HiC]TheKiller - 18.10.2011
What do you currently have? I'll check it tomorrow when I wake up
.
Re: Account deletion after 25 days -
Luis- - 18.10.2011
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;
}
Re: Account deletion after 25 days -
Incubator - 18.10.2011
Change %s to '%d'.
Re: Account deletion after 25 days -
Luis- - 18.10.2011
It was like that before, still didn't work.
Re: Account deletion after 25 days -
[MWR]Blood - 18.10.2011
Most likely the last logged recording is wrong.