28.04.2015, 20:28
i want a cmd to reset inactive players accounts every 2 weeks mean any player has 2 weeks with out join server with this cmd his account will be removed auto after i used the cmd!! help
COMMAND:clearunusedaccounts(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
{
return Error(playerid, "You are not logged into rcon!");
}
new mnth, yr;
if(sscanf(params, "ii", mnth, yr))
{
return MessageBox(playerid, "~r~~h~~h~USAGE", "/clearunusedaccounts <month> <year>");
}
new days;
if(IsMonth31(mnth))
days = 31;
else if(mnth == 2 && IsMonth29(yr))
days = 29;
else if(mnth == 2 && !IsMonth29(yr))
days = 28;
else
days = 30;
for(new i = 0; i < days; i++)
{
mysql_query(sprintf("DELETE FROM players WHERE LastOn='%d/%d/%d'", i, mnth, yr));
}
return 1;
}
// OnLoggedIn
new tmpip[64],day,month,year;
getdate(year,month,day);
format(tmpip,sizeof tmpip,"%d/%d/%d",day,month,year);
format(PData[playerid][laston], 64, "%s", tmpip);
// OnLoggedIn
new tmpip[64],dayy,monthh,yearr;
getdate(yearr,monthh,dayy);
format(tmpip,sizeof tmpip,"%d/%d/%d",dayy,monthh,yearr);
format(PData[playerid][laston], 64, "%s", tmpip);