public static void Load(BasePlayer player, bool created = false) { if (player == null) { return; } if (!created) { plug.Puts($"Loading player [{player.UserIDString}]"); } Database.Query(Database.Build("SELECT * FROM users WHERE steam_id = @0 LIMIT 1;", player.UserIDString), records => { // Check if the user has been created, but still not able to find if (records.Count == 0 && created == true) { plug.Puts($"Cannot fint he player after creation. Player has been kicked!"); player.Kick("Account creation failed, contact us at rust.gamelimits.com/discord"); return; } // Check if the user does not exists, in that case, create a new user and restart the loading process if (records.Count == 0) { plug.Puts($"Creating new player record [{player.UserIDString}]"); Database.Insert(Database.Build("INSERT INTO users (steam_id, display_name) VALUES (@0, @1);", player.UserIDString, player.displayName), result => Load(player, true)); return; } PData pdata = new PData() { id = Convert.ToUInt32(records[0]["id"]), admin = Convert.ToBoolean(records[0]["is_admin"]), }; datas.Add(player.userID, pdata); pdata.LoadRewardPoints(); pdata.LoadSubscriptions(); pdata.LoadCooldowns(); pdata.LoadSettings(); plug.Puts($"Player loaded (id: {pdata.id})"); }); }