Jump to content
RAGE Multiplayer Community

MoneyAPI 1.0.2

   (12 reviews)

3 Screenshots

About This File

This resource probably won't get future updates, check out Currency API instead.

Easy to use money system for your server. It handles saving&loading and provides you a custom data key to get/set a player's money.

Installing

  1. Put the files you downloaded in their respective places
  2. Add require('moneyapi') to client_packages/index.js
  3. Open packages/moneyapi/constants.js and put your MySQL info (maybe edit the settings too while you're at it...)
  4. Congrats, you're all done

Settings (packages/moneyapi/constants.js):

  • startingMoney use this setting to change how much money players start with. Default: 0
  • autoSaveInterval use this setting to change how frequent auto saving happens (in minutes), you can set it to 0 if you want to disable auto saving. Default: 5

Example

You can access a player's money from customMoney property using either .data.customMoney or .getVariable("customMoney").

mp.events.addCommand("smoney", (player, _, money) => {
    // set the player's money to the specified amount
    money = parseInt(money);

    if (!isNaN(money)) {
        player.data.customMoney = money;
    } else {
        player.outputChatBox("Invalid amount specified.");
    }
});

mp.events.addCommand("cmoney", (player, _, amount) => {
    // change the player's money by the specified amount
    amount = parseInt(amount);

    if (!isNaN(amount)) {
        player.data.customMoney += amount;
    } else {
        player.outputChatBox("Invalid amount specified.");
    }
});

mp.events.addCommand("buyhp", (player) => {
    // refill a player's health for $100
    if (player.data.customMoney >= 100) {
        player.health = 100;
        player.data.customMoney -= 100;
        player.outputChatBox("Refilled health for $100.");
    } else {
        player.outputChatBox("You don't have $100.");
    }
});

Notes

  • First of all, thanks to @Donboo for their MySQL example which you can find here.
  • This script won't save while the server is shutting down but will save player money when they disconnect or when autosave happens.
  • This script uses an int(11) field to store a player's money. If you think $2147483647 isn't enough, you might want to change it.
  • For some reason, MoneyAPI HUD elements will be off position in 1914x1080 windowed resolution.
  • This script won't update the money display on the ESC/pause menu. (This note is obsolete if you're using the GameHUD version)

What's New in Version 1.0.2   See changelog

Released

Added a version that uses GTA V's money HUD. Just replace the contents of your client_packages/moneyapi/index.js with the downloaded file. (MoneyAPI GameHUD.zip)

Amount of money you have will also be displayed on the pause menu with this version.

gQs63wc.png

xeMzU47.png

zxv8Gqo.png

  • Like 5
  • Mask 1
 Share


User Feedback

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest

Hazes

   4 of 4 members found this review helpful 4 / 4 members

Glad to see one of the best resource makers here. Great work.

Link to review
ynhhoJ

   4 of 4 members found this review helpful 4 / 4 members

Keep it up!

Link to review
Jer

   1 of 1 member found this review helpful 1 / 1 member

nice money

Link to review
Belekasnu

   1 of 1 member found this review helpful 1 / 1 member

Hello everything seems fine but im getting this error in console money works perfect but what is this error? thanx

(node:9580) [DEP0096] DeprecationWarning: timers.unenroll() is deprecated. Please use clearTimeout instead.

Link to review
hubba

   1 of 3 members found this review helpful 1 / 3 members

hello 

Link to review
ragempdev

   0 of 6 members found this review helpful 0 / 6 members

ok....................................

Link to review
Guest Boyd MacRory

  
Since 2012 Mailbanger.com has been selling marketing lists with customer name/contact information to many small and startup businesses.


we have lists for USA/UK/Australia/Canada and many more countries


Here are some of our packages:

USA Business database with executive contact info - Over 30 million records:
https://www.mailbanger.com/2020-usa-business-database-executive-edition/


2021 USA Homeowner and Residential – 248 million records:
https://www.mailbanger.com/2021-usa-homeowner-and-residential-248-million-records/


108 million USA consumers with age,cell/home phone/address/email:
https://www.mailbanger.com/108-million-usa-consumers-mega-edition/


Cell/SMS Marketing package of over 50 million USA Customers:
https://www.mailbanger.com/2022-usa-50-million-consumer-cell-phone-numbers-premium-edition/


Monthly optin USA sales leads (a fresh new package every month!):
https://www.mailbanger.com/monthly-usa-sales-leads


USA Charity donors:
https://www.mailbanger.com/usa-charity-donor-leads


850 000 Weight loss customers:
https://www.mailbanger.com/weight-loss-diet-leads-lists


we have many more lists - stop wasting thousands on pay per click or other expensive forms of advertising, and market direct for super affordable prices.

All lists are updated regularly, buy once and its yours so you can use them for many campaigns. They come in Excel files with sortable categories


Regards
Mailbanger.com
Link to review
Marcox360

  
(node:21232) [DEP0096] DeprecationWarning: timers.unenroll() is deprecated. Please use clearTimeout instead.

I just started with RageMP and your resource is easy and well explained... i get this error :(

Link to review
JamesBeast

  

SUCH AN BESTIALITY @rootcause

 

you released this for my birthday too ))))) 🎉🎂🎈🎉🎂🎈🎉🎂🎈🎉🎂🎈

  • Like 1
Link to review
×
×
  • Create New...