Tutorial : How to create extension
Tutorial: Creating an Extension for CustomRewards
In this tutorial, we'll guide you through creating a functional extension for the CustomRewards
plugin using Oxide. We'll use the PlaytimeReward
extension as an example, which integrates with the PlaytimeTracker
plugin. This choice provides a practical scenario where players are rewarded based on their playtime, showcasing how CustomRewards
can be integrated with other plugins.
Prerequisites
Basic knowledge of Oxide plugin development.
Installed
CustomRewards
plugin.
1. Setting Up Your Extension
Start by creating a new class for your extension:
2. Interacting with CustomRewards
Fetching Points with Additional Data:
We're using Get_Owner_WithString_API
because we want to retrieve not just the points but also an additional string value, which represents the total playtime.
Giving Points with Additional Data:
We use Give_Owner_WithString_API
because we want to store additional data (the playtime) alongside the points.
3. Core Logic of Your Extension
Fetching Playtime:
This method fetches the playtime of a player:
Awarding Points Based on Playtime:
This method calculates and awards points based on the player's playtime:
Refreshing Points:
Before showing the UI, refresh the player's points based on their playtime:
4. CustomRewards Hooks
Implement hooks to interact with the CustomRewards
plugin:
5. Conclusion
By following this tutorial, you can create a functional extension for the CustomRewards
plugin using Oxide. This guide focuses on the integration aspect with CustomRewards
, ensuring that by the end, you have a complete and operational plugin. The choice of methods (..._WithString_API
vs. the simpler versions) is based on the need to store and retrieve additional data, showcasing the flexibility of CustomRewards
. Adapt the logic and methods based on your extension's specific requirements. Happy coding!
Last updated