BGrade

Moved

Total Downloads: 18,674 - First Release: Apr 8, 2015 - Last Update: Mar 15, 2018

5/5, 52 likes
  1. Here is a working version, last is fucked as well
    removed CanAutoGrade hook as the code was commented and completely useless
     
  2. I have revoked my permissions to build with no res, and yet it is still only consuming wood.
     
  3. @sami37
    "removed CanAutoGrade hook" don't remove stuff what you don't know. This hook (code example) used in other plugins to control when auto grade allowed. For example: NoEscape for Rust | Oxide and by removing this code you actually broke it feature to block bgrade command.

    And what is wrong with current code?
     
  4. @AlexALX_[rus-ua]
    A commented line can't be executed at all, except if you plan something else for it, that i doubt when i look the actual hook, it was just useless.

    Code:
    /* Example of hook usage
            int CanAutoGrade(BasePlayer player, int grade, BuildingBlock buildingBlock, Planner planner) {
                //return -1; // Block upgrade, but create twig part
                //return 0; // Obey plugin settings (block on construct if enabled or not)
                //return 1; // Block upgrade and block build
                return; // allow upgrade
            }*/
    
    Code:
                    var result = Interface.CallHook("CanAutoGrade", new object[] { player, pgrade, buildingBlock, planner });
                    if (result is int) {
                        if ((int)result==0 && !block || (int)result<0) return;
                        var items = buildingBlock.blockDefinition.grades[(int)buildingBlock.grade].costToBuild;
                        foreach (ItemAmount itemAmount in items)
                        {
                            player.Command(string.Concat(new object[] { "note.inv ", itemAmount.itemid, " ", (int)itemAmount.amount }), new object[0]);
                            player.inventory.GiveItem(ItemManager.CreateByItemID(itemAmount.itemid, (int)itemAmount.amount),player.inventory.containerMain);
                        }
                        gameObject.GetComponent<BaseEntity>().KillMessage();
                        return;
                    }
    
    this will never be trigerred, maybe i can be wrong but it's just the same in all language...
    What doesn't work? Well the code i just removed doesn't work as you don't make a check if it's null or using conditional expression
     
  5. I used this:
    oxide.revoke group admin autogrades.nores
    not sure why but now it works for everyone on my server consuming resources like it should.
     
  6. I had to run that command twice...not even sure if that fixed it. But I did get it working right.
     
  7. @sami37
    Commented code is actually example for other plugins developers with explanation of how to use it. Its not "useless" or for planning something in future.

    Actually it seems like you don't know what is "hook" at all. Hooks is like an API, so other developers can use it in own plugins and do something. Whole oxide is also uses own hooks, for example do you think that this is never called Oxide/OxideMod.cs at develop · OxideMod/Oxide · GitHub ? This is basic hook what used in other plugins (and without returning result). And its descrition is here Oxide API for Rust

    Exactly same is with "CanAutoGrade" hook what i added to other developers so they can interact with my plugin. If you read plugin description there's written:

    And now go and look into NoEscape plugin:

    Code:
            object CanAutoGrade(BasePlayer player, int grade, BuildingBlock buildingBlock, Planner planner)
            {
                if (CanRaidCommand(player.UserIDString, "bgrade") || CanCombatCommand(player.UserIDString, "bgrade"))
                    return -1;
                return null;
            }
    When "CanAutoGrade" hook called in my plugin, NoEscape is checking if it allowed to autograde right now and return -1 to block if not, otherwise return null as this is required to in order for the hook to work in other plugins too.

    So like i said - if you don't understand code and thinks that is "useless" doesn't mean that it is true. Hope this information will be useful for your in future as for developer.

    -----------

    Anyway i checked my plugin like two weeks ago and it was working fine without errors, so if those code errors for your - maybe conflicting plugin or corrupted oxide. But also possible that hook code changed somehow, not sure, will check again bit latter. But anyway it should work without errors.
     
  8. I am trying to revoke bgrade for all users, excluding admin. But nothing I do seems to make any difference. I have run the commands to remove for default adn it says they have no permissions, I have removed for my individual username, but still I can use the tool. any ideas?
     
  9. AlexALX_[rus-ua] updated Automatic Build Grades with a new update entry:

    0.0.8


    [DOUBLEPOST=1492011471][/DOUBLEPOST]Damn, there is something wrong with plugin upload, i'm fail to update it properly. Will try again later. Sorry guys.
     
    Last edited by a moderator: Apr 12, 2017
  10. AlexALX_[rus-ua] updated Automatic Build Grades with a new update entry:

    0.0.9



    ps due to upload issues version 0.0.8 missing and replaced with 0.0.9.
     
  11. Is there a way to set it so that if a player is being raided that this plugin is disabled until they stop raiding them

    IE: wall is destroyed and theres a 90 second timer before they can use bgrade again
     
  12. @NekoCore

    ask plugin developer, its possible if he use CanAutoGrade hook. No Escape plugin already have compatibility with those feature.
     
  13. Hey alex, i keep getting failed to callhook.

    http://i.imgur.com/HvIrvhR.png

    Failed to call hook 'ChatBuildGrade' on plugin 'AutoGrades v0.0.9' (FormatException: Input string was not in the correct format)
    Failed to run a 30.00 timer in 'AutoGrades v0.0.9' (KeyNotFoundException: The given key was not present in the dictionary.)
     
    Last edited by a moderator: Apr 13, 2017
  14. @Pur3x

    You have something wrong with you translation files, remove them, let it recreate it (/lang/AutoGrades-en.json etc)
     
  15. To remove the timer (so make it work like previous version) you need to set AllowTimer to "false" and DefaultTimer to "0". At least that worked for me.
     
  16. AlexALX_[rus-ua] updated Automatic Build Grades with a new update entry:

    0.0.10

     
  17. talking out of my rear end again ignore this one
     
    Last edited by a moderator: Apr 21, 2017
  18. hi guys need some help its minor but how to i allow all members access to this plugin? at the min only the admins have this ?
     
  19. All the info is in the overview page:

    Oxide permissions:
    You can change who will access command and what grades they will can use via oxide permissions.

    For example if you need allow auto update for wood&stone with consume resources for players, you need type in server console:

    oxide.grant group default autogrades.1
    oxide.grant group default autogrades.2


    Build grade levels are listed on the same page.
     
  20. Code:
    20:23 [Error] Failed to run a 30.00 timer in 'AutoGrades v0.0.10' (KeyNotFoundException: The given key was not present in the dictionary.)
    20:23 [Stacktrace]   at System.Collections.Generic.Dictionary`2[System.String,Oxide.Plugins.AutoGrades+PlayerGrades].get_Item (System.String key) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.AutoGrades.turnoff (System.String steamid, .BasePlayer player) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.AutoGrades+<UpdateTimer>c__AnonStorey0.<>m__0 () [0x00000] in <filename unknown>:0
      at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00000] in <filename unknown>:0