Heyo,
Anyone know how to call an API method in JavaScript? I've looked through Oxide's GitHub files and looked at the docs without any luck. I'm curious if it's even supported for JS, I really hope so
Here's what I'd like to transform into JS (From ServerRewards):
Thanks in advance <3Code:object AddPoints(ulong playerID, int amount) // Returns true if successful, otherwise returns null object TakePoints(ulong playerID, int amount) // Returns true if successful, otherwise returns null object object CheckPoints(ulong ID) // Returns int, or null if no data is saved//Example [PluginReference] Plugin ServerRewards; void ExampleFunction(BasePlayer player) { ServerRewards?.Call("AddPoints", new object[] { player.userID, 5 }); ServerRewards?.Call("TakePoints", new object[] { player.userID, 5 }); }
Solved Calling an API method with JavaScript
Discussion in 'Rust Development' started by Scriptzyy, Oct 22, 2016.
-
Wulf Community Admin
For every language other than C#, you'd need to store a plugins.Find reference instead of PluginReference, then use that to Call the hook desired.
-
Yes! Thank you Wulf, it works <3
-
See the following post for future reference: Classes | Oxide
(In this case, see the "Libraries" bullet point) -
Oh cool, thanks sqroot!

