Skip to content

Conversation

@t1ger-scripts
Copy link
Contributor

@t1ger-scripts t1ger-scripts commented Oct 6, 2024

Added an export CreateJobAccount() to add new job accounts in runtime. Very useful for scripts utilizing in-game job/shop creators.

EDIT:
Also added GetJobAccountt() to retrieve a cached job account if it exists

Added an export CreateJobAccount() to add new job accounts in runtime. Very useful for scripts utilizing in-game job/shop creators.
@solareon
Copy link
Contributor

Is there a reason to return the cachedAccount table back to the export caller? I believe this should return true/false with true being the account was created and false if the account exists or fails to create.

@t1ger-scripts
Copy link
Contributor Author

t1ger-scripts commented Oct 29, 2024

Is there a reason to return the cachedAccount table back to the export caller? I believe this should return true/false with true being the account was created and false if the account exists or fails to create.

Very useful when creating accounts in runtime, avoiding calling another export to retrieve the account data of the newly created account. If you prefer true/false return, I can rework the commit - however; imo it makes sense to return the created account.

t1ger-scripts and others added 4 commits February 18, 2025 21:29
improved function with parameter checks, database insert succession and return true/false
Changed function behavior to return the account table instead of boolean and string.

Errors are now raised instead of returning false, providing better debugging with the invoking resource name.

Returning the account table allows direct access to account data without needing to use an export to retrieve it separately. 
This improves usability by ensuring that the function itself provides the necessary data instead of requiring an additional call.
Added the `GetJobAccount` function to retrieve a cached job account if it exists.

- Returns the job account table if found, otherwise `nil`.
- Raises an error if `jobName` is invalid (not a string or empty).
- Uses `GetInvokingResource()` for clearer debugging when an invalid job name is provided.
- Exposes the function as an export (`exports('GetJobAccount', GetJobAccount)`) for external access.

This improves usability by providing a way to fetch job account details and not just the account balance
@uShifty uShifty merged commit ecd0a7e into Renewed-Scripts:main Feb 19, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants