PlayerDatabase

Big database with light weight way to save it to prevent lag

Total Downloads: 2,478 - First Release: May 30, 2016 - Last Update: Jan 11, 2017

5/5, 8 likes
  1. This does not work for legacy... Loads in perfectly but any plugin linked to it says "You must have the PlayerDataBase plugin to use this plugin"
    [DOUBLEPOST=1491005676][/DOUBLEPOST]So prod works fine it's just House Locations for Rust Legacy | Oxide
     
    Last edited by a moderator: Apr 1, 2017
  2. solved.
     
  3. There seems to be an issue when the plugin registers names with weird characters, for whatever reason the plugin didn't close the quote on a name and it messed up the entire database (MySql, don't know about any other database type). Lazy solution below.

    Replace line 6 with:
    Code:
                    try
                    {
                        d = GetPlayerData(userid, "name");
                    }
                    catch (JsonReaderException)
                    {
                        continue;
                    }
     
  4. Getting Error while compiling: PlayerDatabase.cs(515,14): error CS0234: The type or namespace name `MySql' does not exist in the namespace `Oxide.Core'. Are you missing an assembly reference? with Oxide Build 2.0.3589
     
  5. Which game are you using?
     
  6. Wulf

    Wulf Community Admin

    Replace the // Reference: Oxide.Core.MySql with // Reference: Oxide.MySql
     
  7. Game's Rust
    [DOUBLEPOST=1508595807][/DOUBLEPOST]
    Thank you, this resolved it.
     
  8. Couldn't get columns. Database might be corrupted.

    It connects to the database but doesn't make the table.
     
  9. It works now, the host changed firewall settings.

    The only problem is, the ID is always 0 now. I gave id primary key and Auto Increment but now it doesn't add anything to the database anymore.
     
  10. Code:
    (05:52:43) | Unloaded plugin EnhancedBanSystem v5.2.1 by Reneb/Slut
    (05:52:43) | Failed to call hook 'OnServerInitialized' on plugin 'EnhancedBanSystem v5.2.1' (NullReferenceException: Object reference not set to an instance of an object)
      at Oxide.Plugins.EnhancedBanSystem.PlayerDatabase_Load () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.EnhancedBanSystem.OnServerInitialized () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.EnhancedBanSystem.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
    (05:52:43) | Loaded plugin EnhancedBanSystem v5.2.1 by Reneb/Slut

    Not sure what's going on here to be honest, I use EBS alongside PlayerDB. Any idea @Slut?



    This'll happen OnSave:
    Code:
    (05:43:16) | Failed to call hook 'OnServerSave' on plugin 'EnhancedBanSystem v5.2.1' (NullReferenceException: Object reference not set to an instance of an object)
      at Oxide.Plugins.EnhancedBanSystem.Save_Files () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.EnhancedBanSystem.OnServerSave () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.EnhancedBanSystem.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0

    This'll happen every-time someone joins the server:
    Code:
    (05:41:41) | MySql handle raised an exception (Exception: Connection is null)
      at Oxide.Core.MySql.Libraries.MySql+MySqlQuery.Handle () [0x00000] in <filename unknown>:0
    (05:41:41) | MySql handle raised an exception (Exception: Connection is null)
      at Oxide.Core.MySql.Libraries.MySql+MySqlQuery.Handle () [0x00000] in <filename unknown>:0
     
  11. Nothing to do with this plugin try posting in correct plugin topic for support
     
  12. I dont understand how to install this.

    Do i have to change this?

    {
    "Data Type : 0 (Files) or 1 (SQLite) or 2 (MySQL)": 2,
    "MySQL - Database Name": "rust",
    "MySQL - Host": "localhost",
    "MySQL - Password": "toor",
    "MySQL - Port": 3306,
    "MySQL - Username": "root",
    "SQLite - Database Name": "playerdatabase.db"
    }
     
  13. So i finish installing this plugin got all player information in mysql, So how do i add Economics plugin to work in the database ?
     
  14. @Wulf Do you know what data type the "Time Played" column is? I've tried seconds and minutes but then it's just all wrong. I also tried unix time stamp but I doubt its that. Sorry for tagging you. It seems that Reneb isnt active so I tagged you.
     
    Last edited by a moderator: Apr 22, 2018
  15. Wulf

    Wulf Community Admin

    No, I’ve never used this plugin.
     
  16. First you need to use Player Informations (link embedded) in conjunction with this plugin as that enables all the extra features such as this one.

    If you type /played "playername" It gives you their time played in days, hours, and minutes.... for example "Captain Nebulous has played __d __h __s"

    You don't specify what the format is yourself, it just tells you in that format. And it's /played, not /timeplayed
     
  17. LOL sorry. I'm reading the data straight from the database file for our custom web panel. I got it sorted. It seems to be seconds so all you need to do is round and then divide it by 16 and then you get minutes.

    Example in pascal:
    Code:
    query := 'SELECT [Time Played] FROM PlayerDatabase WHERE [name]=''"' + sname + '"''';
        Log(query);
        try
          sqlqueryPlayers.SQL.Text := query;
          sqlqueryPlayers.Active := true;
        except
          on E: Exception do
          begin
            mmo1.Lines.Add('Exception raised with message: ' + E.Message);
            lblNickname.Caption := '';
            lblSteamID.Caption := '';
            lblLastSeen.Caption := '';
            lblTimePlayed.Caption := '';
            exit;
          end;
        end;
        if not sqlqueryPlayers.IsEmpty then
        begin
          sqlqueryPlayers.First;      names := TStringList.Create;
          try
            sqlqueryPlayers.GetFieldNames(names);
            while not sqlqueryPlayers.Eof do
            begin
              currentLine := '';
              for i := 0 to names.Count - 1 do
              begin
                currentField := sqlqueryPlayers.FieldByName(names[i]);
                currentLine := currentLine + ' ' + currentField.AsString;
              end;
              Trim(currentLine);
              currentLine := StringReplace(currentLine, '.', ',', [rfReplaceAll, rfIgnoreCase]);
              Delete(currentLine, 1, 2);
              Delete(currentLine, Length(currentLine), 1);
              if currentLine <> '' then
              begin
                lastseen := StrToFloat(currentLine);
                lastseen := lastseen / 60;
                ilastseen := Round(lastseen);
                lblTimePlayed.Caption := FloatToStr(ilastseen) + ' Minutes';
              end
              else if Trim(currentLine) = '' then
                lblTimePlayed.Caption := 'No data';
              sqlqueryPlayers.Next;
            end;
          finally
            names.Free;
          end;    end;
     
  18. Divide by 60*