Political Survival

Become the President, tax the server, and subjugate everyone!

Total Downloads: 772 - First Release: May 13, 2016 - Last Update: Jun 10, 2018

5/5, 13 likes
  1. Jonty, love the plugin. Had it running for about 12 hours, then server crashed. Removed this plugin and seems to be fine again.

    What logs/information would you require to debug?

    Thanks
     
  2. (17:05:05) | [Oxide] 17:05 [Error] Failed to call hook 'SetTaxChestCommand' on plugin 'PoliticalSurvival v0.2.0' (KeyNotFoundException: The given key was not present in the dictionary.)

    (17:05:05) | [Oxide] 17:05 [Debug] at System.Collections.Generic.Dictionary`2[BasePlayer,Oxide.Plugins.PoliticalSurvival+StrayPlayer].get_Item (.BasePlayer key) [0x00000] in <filename unknown>:0

    at Oxide.Plugins.PoliticalSurvival.SetTaxChestCommand (.BasePlayer Player, System.String Command, System.String[] Arguments) [0x00000] in <filename unknown>:0

    at Oxide.Plugins.PoliticalSurvival.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0

    at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0

    at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0

    at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
     
  3. Hello I am sorry for my English What is the solution that I am getting an error
    Code:
    15:48 [Info] PoliticalSurvival was compiled successfully in 4734ms
    15:48 [Info] Loaded plugin PoliticalSurvival v0.2.0 by Jonty
    15:48 [Warning] PoliticalSurvival has replaced the 'settaxchest' chat command previously registered by PoliticalSurvival
    15:48 [Warning] PoliticalSurvival has replaced the 'info' chat command previously registered by PoliticalSurvival
    15:48 [Warning] PoliticalSurvival has replaced the 'claimpresident' chat command previously registered by PoliticalSurvival
    15:48 [Warning] PoliticalSurvival has replaced the 'settax' chat command previously registered by PoliticalSurvival
    15:48 [Warning] PoliticalSurvival has replaced the 'realmname' chat command previously registered by PoliticalSurvival
    15:48 [Warning] PoliticalSurvival has replaced the 'pm' chat command previously registered by PoliticalSurvival
    15:48 [Warning] PoliticalSurvival has replaced the 'players' chat command previously registered by PoliticalSurvival
    15:48 [Info] [PoliticalSurvival] Political Survival is starting...
    15:48 [Info] [PoliticalSurvival] Realm name is The land of the Free
    15:48 [Info] [PoliticalSurvival] Tax level is 20
    15:48 [Info] [PoliticalSurvival] President is 0
    15:48 [Error] Failed to initialize plugin 'PoliticalSurvival v0.2.0' (InvalidOperationException: Connection must be valid and open.)
    15:48 [Debug]   at MySql.Data.MySqlClient.ExceptionInterceptor.Throw (System.Exception exception) [0x00000] in <filename unknown>:0
      at MySql.Data.MySqlClient.MySqlConnection.Throw (System.Exception ex) [0x00000] in <filename unknown>:0
      at (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlConnection:Throw (System.Exception)
      at MySql.Data.MySqlClient.MySqlCommand.Throw (System.Exception ex) [0x00000] in <filename unknown>:0
      at MySql.Data.MySqlClient.MySqlCommand.CheckState () [0x00000] in <filename unknown>:0
      at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader (CommandBehavior behavior) [0x00000] in <filename unknown>:0
      at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader () [0x00000] in <filename unknown>:0
      at MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PoliticalSurvival.GetPlayerFromDatabase (.BasePlayer Player) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PoliticalSurvival.AddPlayer (.BasePlayer Player) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PoliticalSurvival.Init () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PoliticalSurvival.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x00000] in <filename unknown>:0
    15:48 [Info] Unloaded plugin PoliticalSurvival v0.2.0 by Jonty
    15:48 [Info] No previous version to rollback plugin: PoliticalSurvival
     
  4. What will happen if the chest that has been setup to receive the stuff gets full of stuff ?
     
  5. Hello, I don't understand how we set a chest for the taxe .. It's not working .. Someone can help me ?
     
  6. I, like many people presumably, rent a server from a game server hosting company. I would love to install this plugin, but my host doesn't give me SQL access. Is this plugin an option for people like me? Can I install MySQL on my home computer and use this plugin, or no, because it's not always connected to the server?
     
  7. Oxide] 16:05 [Error] Failed to initialize plugin 'PoliticalSurvival v0.2.0' (NullReferenceException: Object reference not set to an instance of an object)
    [Oxide] 16:05 [Debug] at MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar () [0x00000] in <filename unknown>:0
    at Oxide.Plugins.PoliticalSurvival.GetPlayerFromDatabase (.BasePlayer Player) [0x00000] in <filename unknown>:0
    at Oxide.Plugins.PoliticalSurvival.AddPlayer (.BasePlayer Player) [0x00000] in <filename unknown>:0
    at Oxide.Plugins.PoliticalSurvival.Init () [0x00000] in <filename unknown>:0
    at Oxide.Plugins.PoliticalSurvival.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
    at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
    at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
    at Oxide.Core.Plugins.CSPlugin.HandleAddedToManager (Oxide.Core.Plugins.PluginManager manager) [0x00000] in <filename unknown>:0
    [Oxide] 16:05 [Info] Unloaded plugin PoliticalSurvival v0.2.0 by Jonty
     
  8. Yeap, is breaking right over here:

    Code:
    Line 483: bool Exists = Command.ExecuteScalar() != null ? true : false;
    Can't get my head around it and what is wrong...
     
  9. Update this plugin

    Thanks you
     
  10. @Jonty and Everyone,

    Does the Political Survival plugin still work?
     
  11. So this is probably a stupid question but how do i go about getting this plugin working on my server? ive installed the plugin, im able to use everything except for settaxchest, this doesnt work at all for me

    "Failed to call hook 'SetTaxChestCommand' on plugin 'PoliticalSurvival v0.2.0' (KeyNotFoundException: The given key was not present in the dictionary.)" get this when i use /settaxchest

    Thanks for any help guys :)
     
  12. Update, Plugin works but has some bugs
     
  13. line 514 is where bug is, the position/location values of the tax chest are stored as floats, and the if statement is checking for exact accuracy, you have to check for slight accuracy, the float values have slight inaccuracies

    Change:

    Code:
    if (ContPosition.x == TaxChestX && ContPosition.y == TaxChestY && ContPosition.z == TaxChestZ)
    to

    Code:
    if (((-0.1 < (ContPosition.x - TaxChestX)) && ((ContPosition.x - TaxChestX) < 0.1)) &&
        ((-0.1 < (ContPosition.y - TaxChestY)) && ((ContPosition.y - TaxChestY) < 0.1)) &&
        ((-0.1 < (ContPosition.z - TaxChestZ)) && ((ContPosition.z - TaxChestZ) < 0.1)))
     
  14. Code:
    Calling 'OnDispenserGather' on 'PoliticalSurvival v0.54.0' took 215ms
    Calling 'OnDispenserGather' on 'PoliticalSurvival v0.54.0' took 614ms
    Calling 'OnPlayerAttack' on 'PoliticalSurvival v0.54.0' took average 2851ms
    Calling 'OnDispenserGather' on 'PoliticalSurvival v0.54.0' took 671ms
    Calling 'OnDispenserGather' on 'PoliticalSurvival v0.54.0' took 544ms
    Calling 'OnDispenserGather' on 'PoliticalSurvival v0.54.0' took 259ms
    Calling 'OnPlayerAttack' on 'PoliticalSurvival v0.54.0' took average 3318ms
    Calling 'OnDispenserGather' on 'PoliticalSurvival v0.54.0' took 620ms
    Calling 'OnDispenserGather' on 'PoliticalSurvival v0.54.0' took 211ms
    Calling 'OnDispenserGather' on 'PoliticalSurvival v0.54.0' took 287ms
    Calling 'OnDispenserGather' on 'PoliticalSurvival v0.54.0' took average 3030ms
    In the case where a tax chest is not set, every time a player gathers materials, SaveTaxContainer() and LoadTaxContainer() are called, so basically every time someones hitting a hatchet on a tree, a SQL update command is executed and waited on, and then all storage containers are looped through checking for equal position float values

    So I just added an if check, at beginning of SaveTaxContainer() and LoadTaxContainer(), checking if all tax chest coordinates are 0, if so I return
    Code:
    if (TaxChestX == 0 && TaxChestY == 0 && TaxChestZ == 0) { return; }
    The default values of TaxChestX, etc are 0, and they get set to that also when TaxChest can't be found
    I dont think my solution should cause problems, but we shall see, the lag is gone though :)
     
  15. I was wondering if is possible or would be possible to make it where you lose the presidency if you are offline for more than a set # of time?
     
  16. Hi,

    Sorry for no responses and basically leaving this project to the wind. Had uni, did some travelling and didn't really do any coding stuff.

    Picking rust back up with a friend tonight, might do some work on this. @Togoshige thanks for the helpful posts.
     
  17. Hey - this plugin seems pretty cool, it'd be nice if we had an update on its viability.
     
  18. Political Survival for Rust is dead, or at least the plugin dev. has not updated hes plugin for a while, so it no longer works. But I think this plugin is awsome and why can't I just fix it? Without any programming skills. Um.

    With some changes to the code with the help of code Togoshige submitted, I got the plugin working. So it works as it should, I can not see it creating any lag. But im getting a constant error in console.

    Code:
    Failed to call hook 'OnPlayerAttack' on plugin 'PoliticalSurvival v0.2.0' (NullReferenceException: Object reference not set to an instance of an object)
      at Oxide.Plugins.PoliticalSurvival.OnPlayerAttack (.BasePlayer Attacker, .HitInfo Info) [0x00000] in :0
      at Oxide.Plugins.PoliticalSurvival.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in :0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in :0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in :0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in :0 
    Can anyone see if they find the error and if its possible to correct. Ps: Mysql info was removed before posting.
     
    Last edited by a moderator: Aug 8, 2017
  19. here is a fixed version
     
    Last edited by a moderator: Aug 8, 2017
  20. Thanks for helping, Sami. After the fix it creates this error:
    Code:
    Failed to call hook 'OnPlayerAttack' on plugin 'PoliticalSurvival v0.2.0' (KeyNotFoundException: The given key was not present in the dictionary.)
      at System.Collections.Generic.Dictionary`2[BasePlayer,Oxide.Plugins.PoliticalSurvival+StrayPlayer].get_Item (.BasePlayer key) [0x00000] in :0
      at Oxide.Plugins.PoliticalSurvival.OnPlayerAttack (.BasePlayer Attacker, .HitInfo Info) [0x00000] in :0
      at Oxide.Plugins.PoliticalSurvival.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in :0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in :0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in :0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in :0