muukis / l4dstats

SourceMod plugin (Custom Player Stats) for collecting statistics and creating player ranking in Left 4 Dead and Left 4 Dead 2 games
https://forums.alliedmods.net/showthread.php?t=115965
17 stars 9 forks source link

new syntax #20

Closed maclarens closed 1 year ago

maclarens commented 1 year ago

Hello!this plugin great and can u update him on 1.11 syntax becaose too many depracted codes and not working some functions

maclarens commented 1 year ago

1.11 compilling now!ty exept l4d_stats_adm_cleanoldplayers "1"// i can old player statistics remove only manualy

muukis commented 1 year ago

It can be triggered only manually from the rank menu options (as an administrator) if I remember correctly. That part of code should reply to your chat if successful or not, when you trigger it from the rank menu.

Can you tell me how do you expect it to work? Am I forgetting something? :)

This part of the code is doing the cleaning:

// Handler for RANKADMIN panel.
public CleanPlayersPanelHandler(Handle menu, MenuAction:action, param1, param2)
{
    if (action != MenuAction_Select)
        return;

    if (param2 == 1)
    {
        new LastOnTimeMonths = GetConVarInt(cvar_AdminPlayerCleanLastOnTime);
        new PlaytimeMinutes = GetConVarInt(cvar_AdminPlayerCleanPlatime);

        if (LastOnTimeMonths || PlaytimeMinutes)
        {
            bool Success = true;

            if (LastOnTimeMonths)
                Success &= DoFastQuery(param1, "DELETE FROM %splayers WHERE lastontime < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL %i MONTH))", DbPrefix, LastOnTimeMonths);

            if (PlaytimeMinutes)
                Success &= DoFastQuery(param1, "DELETE FROM %splayers WHERE %s < %i AND lastontime < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 HOUR))", DbPrefix, DB_PLAYERS_TOTALPLAYTIME, PlaytimeMinutes);

            if (Success)
                StatsPrintToChatPreFormatted(param1, "Player cleaning successful!");
            else
                StatsPrintToChatPreFormatted(param1, "Player cleaning failed!");
        }
        else
            StatsPrintToChatPreFormatted(param1, "Player cleaning is disabled by configurations!");
    }
    //else if (param2 == 2)
    //  cmd_RankAdmin(param1, 0);
}
maclarens commented 1 year ago

this cvar l4d_stats_adm_cleanoldplayers "1" must auto remove old players after 1 monts in mysql table "players", without admin manually command,other function workinf good!ty :) my players in mysql table "players" old more l4d_stats_adm_cleanoldplayers "1" and its still not auto remove( and this cvar set allways l4d_stats_adm_cleanplaytime "0" or maybe im wrong?its not autoremove?

muukis commented 1 year ago

I think that functionality is working as intended. I don't think there is an autocleaner functionality.

If you want such a feature, I would read this tutorial on how to create scheduled events on MySQL database. Using that functionality, you can delete old players for example once per day. Sadly, I must say, I don't have time to create such new features to the plugin.

maclarens commented 1 year ago

got it thx