1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Oxide for Rust Legacy has been discontinued and is no longer supported. No updates or additions will be made, and Rust Legacy-specific plugin submissions will no longer be accepted. We recommend upgrading to the latest version of Rust as able.
    Dismiss Notice

Solved On plugin unload

Discussion in 'Legacy Development' started by PreFiX, May 7, 2016.

  1. PreFiX

    PreFiX Plugin Developer

    Code (Text):

            void OnPluginUnloaded(Plugin name) {
                if(name == this) {
                    if(PlayerClient.All.Count > 0) {
                        List<NetUser> netusers = PlayerClient.All.Select(pc => pc.netUser).ToList();
                        if(!netusers.Any()) { Puts("Found players, but couldn't make a list.... Odd..."); return; }
                        foreach (NetUser netuser in netusers) SaveUserData(netuser);
    Why it doesn't work? I want to save my users data after plugin "reload/edit"...
  2. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Use Unload(), not OnPluginUnloaded. The OnPluginUnloaded hook is meant for listening for other plugins.