Was getting a strange error when people tried to sell items in the store. They could sell things, but get no confirmation from the UI, and an error was thrown in RCON.
At first I thought it was due to an pending Oxide update, but it persisted afterwards. In case anyone else gets the error, I'll post the error message and my solution:
Error (I've obscured part of my file path with "----"):
What I found is that cmdSell is the only logger that uses "ConVar.Server.Log" instead of LogToFile", so I made this change:Code:(13:01:30) | Failed to call hook 'cmdSell' on plugin 'ServerRewards v0.4.41' (DirectoryNotFoundException: Could not find a part of the path "c:\-----\108_61_109_142_28026\----\ruste\server\----\oxide\logs\ServerRewards-SoldItems_2017-05-08.txt".) (13:01:30) | at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0 at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare) at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) [0x00000] in <filename unknown>:0 at System.IO.StreamWriter..ctor (System.String path, Boolean append) [0x00000] in <filename unknown>:0 at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool) at System.IO.File.AppendAllText (System.String path, System.String contents) [0x00000] in <filename unknown>:0 at ConVar.Server.Log (System.String strFilename, System.String strMessage) [0x00000] in <filename unknown>:0 at Oxide.Plugins.ServerRewards.cmdSell (.Arg arg) [0x00000] in <filename unknown>:0 at Oxide.Plugins.ServerRewards.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 hook, System.Object[] args) [0x00000] in <filename unknown>:0
Original (around line 1320)
Change (same location):Code:ConVar.Server.Log($"oxide/logs/ServerRewards-SoldItems_{dateTime}.txt", message);
Code:LogToFile($"SoldItems", $"[{DateTime.Now.ToString("hh:mm:ss")}] {message}", this);
ServerRewards
Moved
Total Downloads: 14,033 - First Release: Mar 2, 2016 - Last Update: Jun 9, 2018
- 5/5, 61 likes
-
Thank you for this fix. I have the same issue on my linux server.
-
[DOUBLEPOST=1494380163][/DOUBLEPOST]
[DOUBLEPOST=1494380211][/DOUBLEPOST]Anyone know the format for adding kits, items, commands and other such nonsense via the Data files? Adding everything back to the shop via chat commands would take up several days worth of time. If not, do the old versions of the plugin still work with the latest Rust update?Last edited by a moderator: May 10, 2017 -
/rewards add command "TeleVIP" "grant user $player.id NTeleportation.vip"
If you want to sell time limited permissions, you could consider using Timed Permissions plug-in which would allow you to sell the permission for a set time period. Also, the Console Message is handy for giving the player additional information. I'll include an example of those below.
For items, I've been using the command as I don't sell much.
For commands, the syntax is pretty straight forward. Open the reward_data.json file and head down to commands. It helps if you add a test command or two to start with. Here's a snippit from my config. I use Timed Permissions and Console Message for my permissions:
Code:"commands": { "Backpack": { "displayName": "Backpack. Yup - Backpack", "description": "Got a lot of loot and need to move it? Get more storage spots for one week. Expensive but worth it.", "iconName": null, "commands": [ "cm.say $player.name You have purchased a backpack for 1 week. Press the 'b' key to access. ", "grantperm $player.id backpacks.use 7d", "grantperm $player.id backpacks.use.large 7d" ], "cost": 40 }, "Backpack - Limited": { "displayName": "Backpack - Limited Access", "description": "Locked out of your backpack full of ill-gotten gains? It's not gone! Get One Hour of access to your backpack. Great for casual players.", "iconName": null, "commands": [ "cm.say $player.name You have purchased a backpack for 1 hour. Press the 'b' key to access. ", "grantperm $player.id backpacks.use 1h", "grantperm $player.id backpacks.use.large 1h" ], "cost": 1 }, "Teleport VIP": { "displayName": "Teleport VIP", "description": "Teleport in style with more than twice the number of teleports. Lasts one week.", "iconName": null, "commands": [ "cm.say $player.name You have purchased 1 week of VIP Teleporting.", "grantperm $player.id NTeleportation.vip 7d" ], "cost": 15 },
Quick Note: Using FileZilla, I had to choose to "Finish editing and delete local file" in order for the plug-in to be able to load the file. It might have been specific to my server, but though I'd mention it.Last edited by a moderator: May 10, 2017 -
Edit: This actually wont work. Each player would have to have their own button as it is being applied by ID. I would like it to apply to anyone who so chooses to buy it. Seems to be a tricky one lol.Last edited by a moderator: May 10, 2017 -
You can also use the timed permissions plugin to set a time limit on the permissions to do things like, allow players to use the remove command for a couple hours. Anything really. -
Does anyone know of a way to add a new category to the shop?
-
Looks like there's still an issue of hard coding with sell logs
Code:(21:33:45) | Failed to call hook 'cmdSell' on plugin 'ServerRewards v0.4.41' (DirectoryNotFoundException: Could not find a part of the path "C:\TCAFiles\Users\******\364\server\28015\oxide\logs\ServerRewards - SoldItems_2017-05-11.txt".)
-
Wulf Community Admin
-
-
Wulf Community Admin
-
Anyone have a config of literally every item on sale in the items section?
-
-
grant user $player.id NTeleportation.vip
get's run by the server as
grant user 123456781234 NTeleportation.vip
You can use $player.name instead but I'd advise against it. SteamID is less error prone. -
How do you remove an item from the shop now that nothing has an ID number in the rewards file?
EDIT: '/rewards list items' doesnt output to console like it says it should.Last edited by a moderator: May 12, 2017 -
-
-
Item ID's are essentially "shortname_skinid", this changes if you have multiple items with the same skin ID, I don't see why you would ever do that though -
k1lly0u updated ServerRewards with a new update entry:
0.4.5
-
or is it just background stuff. Whadya think of the admin mode to put x's on the items and make em clickable?