#How can I override the PlayerData template?

1 messages · Page 1 of 1 (latest)

north pawn
#

I found the template, but I’m not sure if it’s a good idea to try changing it through a plugin.

north pawn
#
return function(Vargs)
    local server = Vargs.Server
    local service = Vargs.Service

    local Settings = server.Settings
    local Functions, Commands, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Deps =
        server.Functions, server.Commands, server.Admin, server.Anti, server.Core, server.HTTP, server.Logs, server.Remote, server.Process, server.Variables, server.Deps
    
    Core.DefaultPlayerData = function(p)
        return {
            Custom = {
                Test = "..."
            },
            Donor = {
                Cape = {
                    Image = "0";
                    Color = "White";
                    Material = "Neon";
                };
                Enabled = false;
            };
            Banned = false;
            TimeBan = false;
            AdminNotes = {};
            Keybinds = {};
            Aliases = {};
            Client = {};
            Warnings = {};
        }
    end;
end
#

works

lime sapphire
# north pawn ```Lua return function(Vargs) local server = Vargs.Server local service ...

I'd suggest function hooking like so, you don't have to change it in case Adonis decides to add new values if you do it this way

local oldFunc = Core.DefaultPlayerData

Core.DefaultPlayerData = function(p)
  local ret = oldFunc(p) --// This calls what the function is in standard adonis
  ret.Custom = { --// You can add your custom properties here now and don't have to worry about updating it when adonis adds new values
    test = "..."
  }
  return ret
end
north pawn
#

Ok, thanks