1. Hi,

    Today i was creating new plugins to allow server owners to limit number of constructible high external walls but i got a litle problem.

    My data file don't get refreshed, i mean it store corretly but when i try to remove key/value on enitydeath, it won't work if someone more experimented can take a look.
     

    Attached Files:

  2. When you store a key does it store correctly? I will keep looking around in it.
     
  3. mistake on line 79
     
  4. i got Puts("listt.Contains fired"); at line 79 , i don't think it's the problem.

    when it store i got something like that

    Code:
    {
      "76561197988704127": [
        19.5835667,
        19.8276539
      ]
    }
    it storing greatly, but i don't know what append when i try to remove
     
  5. You need to SaveData(); Once you do the remove
     
  6. Sorry wrong line was tried last night when I posted that
     
  7. Changed some code and added some SaveData() make it working

    Maybe i am newly confronted to a problem with my plugin, if player use /remove to remove a walls, how i can handle remove item?
     
    Last edited by a moderator: Jun 3, 2016
  8. I think (Remover Tool) destroys the entity, you should be able to use the OnEntityDeath Hook and find the owner of the entity.
     
  9. I already use OnEntityDeath but RemoverTool use KillMessage() so OnEntityKill
    I am trying to use OnEntityKill(BaseNetworkable networkable)
     
  10. That might work then, getting the owner would be a tad bit different.
    [DOUBLEPOST=1464970690][/DOUBLEPOST]
    Wait thats a hook? I looked through the docs and didn't see one named that.
     
  11. Get it working
    Code:
            void OnEntityKill(BaseNetworkable networkable)
            {
                var entity = networkable as BaseEntity;
                if (entity == null) return;
                var buildingblock = entity.GetComponent<SimpleBuildingBlock>();
                if (buildingblock == null) return;
                var name = buildingblock.name;
                if (!name.Contains("wall.external.high.stone")) return;
                float posy = buildingblock.transform.position.y;
                string userid = entity.OwnerID.ToString();
                if (ReverseData[userid] == null)
                {
                    ReverseData[userid] = new List<object>();
                }
                var listt = ReverseData[userid] as List<object>;
                if (listt.Contains(buildingblock.transform.position.y))
                {
                    listt.Remove(buildingblock.transform.position.y);
                    ReverseData[userid] = listt;
                    SaveData();
                }        }
    
    The docs is not uptodate, you should look at the github