1. Hey. I put the below code inside notepad++. I save it as 'purge.js' (a javascript file). I upload it into my plugins folder and try for it to work. I get an error such as 'unknown file name 0' or something along the lines of that.

    Code:
    var purge = {
        Title : "purge",
        Description : "Informs players of the Purge",
        Author : "Matthew Lang",
        Version : V(0, 1, 0),
        ResourceId : 0    Init: function() {
            print("Init works!");
        }
           
        Unload: function() {
            print("Plugin unloaded.");
        }
           
        OnPlayerSpawn: function(player) {
            rust.ForcePlayerPosition(player, 1400, 6, -1882);
            rust.SendChatMessage(player, "RUST:RP", "You've been spawned at the Trading Zone!");
            rust.SendChatMessage(player, "RUST:RP", "Think you were killed on sight and it is not a purge? Contact an admin.");
        }
       
        command.AddChatCommand("purge", self.purge, "purge")
       
    }
     
  2. Wulf

    Wulf Community Admin

    Your plugin isn't properly formatting, you're missing commas after the end of each section.
     
  3. Sorry to be a pain, I am new to this so yeah... This still doesn't seem to work
    Code:
    var purge = {
        Title : "purge",
        Description : "Informs players of the Purge",
        Author : "Matthew Lang",
        Version : V(0, 1, 0),
        ResourceId : 0,    Init: function() {
            print("Init works!");
        },
           
        Unload: function() {
            print("Plugin unloaded.");
        },
           
        OnPlayerSpawn: function(player) {
            rust.ForcePlayerPosition(player, 1400, 6, -1882);
            rust.SendChatMessage(player, "RUST:RP", "You've been spawned at the Trading Zone!");
            rust.SendChatMessage(player, "RUST:RP", "Think you were killed on sight and it is not a purge? Contact an admin.");
        }
    }
     
  4. Wulf

    Wulf Community Admin

    That works fine here. Are you getting any errors? Make sure you named the file purge.js to match your main class.
     
  5. The file name is 'purge.js' and is inside the plugins folder, where all the other working plugins are. I am running the server off a VPS, and the console goes fast and is hard to read/interpret as when you scroll up it takes you back to the bottom.

    Here is the latest logs I found inside 'my_server_identity\oxide\logs' I cannot make anything of them, and I do not see anything saying Purge either. Again, I am sorry to be a pain.

    http://pastebin.com/5Vajx6fm
     
  6. Wulf

    Wulf Community Admin

    That's the log file for the C# (.cs) compiler, you won't see any info about JavaScript plugins in there. Check the logs prefixed with oxide_ instead.
     
  7. I checked the log, and still I do not see anything related to 'purge.js', however I did notice this line:
    12:01 AM [Error] Failed to load plugin '1' (no source found)

    This is not the full log, as pastebin can only take 512 KB. I looked through it however, and there is no more plugins being loaded.
    http://pastebin.com/b1vEFDKy
     
  8. Wulf

    Wulf Community Admin

    From the looks of your log, you do not seem to have purge.js in the right location, otherwise you'd see some indication that it at least tried to load it.

    You also seem to be trying to load a lot of Oxide 1.18 plugins, which is what all the "missing version" error messages are for.

    You can use the "Upload a File" button here. The Failed to load error is from using "-load" in your startup script.
     
  9. 11.PNG 12.PNG
    Thank you very much for trying to help me!
    [DOUBLEPOST=1438503291][/DOUBLEPOST]
    By the way, the command is CmdPurge, no longer CmdNotice
     

    Attached Files:

  10. Wulf

    Wulf Community Admin

    Okay, so if you look in your log and search from the bottom up for "purge", you'll see your issue. You are trying to use C# function formatting for the arguments on line 27, so remove the first part of each arg and your current error should go away. Also keep in mind that there is no "OnHurt" hook in Oxide 2.0 for Rust. I'd recommend looking at our docs to see the available hooks for the version of Rust you are developing for. You seem to still have a mix of Experimental and Legacy going on. ;)
     
  11. You're a genius! Thank you so much for your assistance and time!
    [DOUBLEPOST=1438503989][/DOUBLEPOST]I did that, and it now loads. It says 'init works' etc. However this block of red text appears.
    [Oxide] 10;24 AM [Error] Failed to initialize plugin purge
    File: purge.js Line: 10 Column: 8 ReferenceError self is not defined:
    then tons of Jint.Native things that I cannot understand. What should self.Plugin be?
     
  12. Wulf

    Wulf Community Admin

    Add self as the first argument in each function.

    Init : function(self) {

    OnPlayerRespawned : function (self, player) {

    Make note that renamed the OnPlayerSpawn hook to the correct name. ;)
     
  13. Ok. What does the 'self' indicate?
     
  14. Wulf

    Wulf Community Admin

    Actually, I was thinking of Python, so disregard the self comment!

    For your issue, replace self.Plugin with this.Plugin. What it does is pass the plugin instance.