Reign of Kings Turn off ropes
Discussion in 'Plugin Requests' started by Upperking, May 30, 2015.
-
Rather than posting my own thread its the same idea.
Any way to make a "Only rope at Night" plugin? to work with KoS Night?
I have looked into it myself and had nothing but failures.
Thanks. -
I will try to do this rly fast before i go to sleep ;x
-
You are a legend
-
-
ok i will test it now.
-
Could you please share this plugin even if it doesn't work? Sharing is caring, thank you ^^
-
-
Any way to remove an item from someone when its day? aka ropes? or even stop them equipping a rope? Just throwing out ideas other than what you've already tried.
Thanks for your interest though much appreciated. -
Hello,
I've been following this thread for a while now and since nobody has any improvement over this, I decided to completely remove ropes and iron shackles to avoid player capturing for now -- I also tried to make OnPlayerCapture work without success.
I simply set up a timer which remove ropes every X seconds when it finds one in someones inventory. Point me in the right direction if anything is wrong here
Code:timer.Repeat(5,0,DeleteCaptureDevices); public void DeleteCaptureDevices() { foreach(Player player in Server.AllPlayers) { if ( player != null && player.DisplayName != null && player.DisplayName != "Server" && player.GetInventory() != null && player.GetInventory().Contents != null ) { if (Server.PlayerIsOnline(player.DisplayName)) { var inventory = player.GetInventory().Contents; foreach (var item in inventory.Where(item => item != null)) // InvGameItemStack { if (item.Name == "Rope" || item.Name == "Iron Shackles") { inventory.SplitItem(item, 1, true); } } } } } }
Last edited by a moderator: Oct 30, 2015 -
Looks pretty good to me, Maybe that could even be hooked into the time of day, So it only removes the ropes when it hits a certain time of day, Thanks for your input i will try it out and see how it goes.
Much appreciated.
[DOUBLEPOST=1446231652][/DOUBLEPOST]For some reason this part isn't working.
Code:foreach (var item in inventory.Where(item => item != null)) // InvGameItemStack { if (item.Name == "Rope" || item.Name == "Iron Shackles") { inventory.SplitItem(item, 1, true); } }
-
Hello again,
I did some debugging and found out that "if (Server.PlayerIsOnline(player.DisplayName))" is excluding some of the players from Server.AllPlayers
I removed this if check and it seems to work without problems now. I will check this thoroughly when lots of players fill the server in afternoon. -
Cheers for the reply, What i meant to say was it executes fine when i debugged your script, Its just no one's rope were removed? I may be missing something.