LUA:Custom Money Printer

From DarkRP
Revision as of 18:08, 23 July 2020 by FPtje (talk | contribs) (1 revision imported: attempt import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This page is available in the following languages:
Данная версия страницы доступна на следующих языках:
Jarvis-flag 8010.png English | Russia-flag.png Русский | France-flag.png Français

This tutorial will show you how to create a new money printer, but only by copying and pasting to make it easy for you.

A program that would be useful to you is Sublime Text. You can download it from Here.

Starting Off[edit]

In darkrpmod/lua/entities/entities create a folder called something_moneyprinter (you may rename it to whatever you want it to be).

Create 3 lua files:

  • cl_init.lua
  • init.lua
  • shared.lua

Open them in your text editor.

You will find the default money printer files in darkrp/entities/entities/money_printer. Copy the contents of these files to the files you created in your own money printer folder (copy the stuff from money_printer/cl_init.lua over to something_moneyprinter/cl_init.lua etc.)

Make sure the contents of the three files _match_ before you start editing your money printer!

To get your money printer to work, open darkrpmod/lua/darkrp_customthings/entities.lua. Add an entity for your custom money printer (you can take the existing money printer as an example).

Customizing your printer[edit]

cl_init.lua has the clientside stuff of the money printer (drawing and shit). You can change the text "Money Printer" to say something else, you can change everything between Color(.....) tags to change the colours of things. You can change the font to something else, making sure it exists.

init.lua has the serverside things. The SeizeReward on top is how much money police officers get when they smack that shit with their stunsticks. You can set the model of the money printer in the line where it says self:SetModel("MODEL HERE"). The self.damage line says how much health the money printer has. Raise the number to give it higher health and lower it to decrease it.

Lines that say DarkRP.notify are messages that are sent to the player. You can change the texts in these messages.

The ENT:CreateMoneybag() function has some interesting stuff too, by default there's a one in 22 chance that the thing catches fire. Change the number 22 and you will change the chance of it catching fire. The amount is how much money your printer prints. By default it uses the config value. If you change GAMEMODE.Config.mprintamount to like 1000, it will print 1000 dollars.

The line that says timer.Simple(math.random(blah, blah is how long it takes to print something. By default it's randomly chosen between 100 and 350 seconds. change those numbers and you'll have a different money printing time. Make sure the first number is lower than the other. If you don't, Lua will poop and mess things up.

shared.lua has the authors and print name. Don't change the Base or the Type, that'll fuck shit up. Don't change the numbers in the lines that say self:NetworkVar. Those numbers probably don't mean what you think they mean. Changing them will probably fuck shit up.