MigratingTo2.5.0

From Official DarkRP Wiki
Jump to: navigation, search
This page is available in the following languages:
Данная версия страницы доступна на следующих языках:
Jarvis-flag 8010.png English | Russia-flag.png Русский | France-flag.png Français

All support for DarkRP 2.4.3 has been dropped. You will need to update to DarkRP 2.5.0 if you want any support from the developers.

DarkRP 2.5.0 can be obtained through several ways. First go to the DarkRP Github page: https://github.com/FPtje/DarkRP

Then you are provided with three options to get DarkRP:

  1. SVN: https://github.com/FPtje/DarkRP
    This option is the fastest and the best option for servers that support SVN. Your server host will be able to update DarkRP with just a click!
  2. Download DarkRP as a zip file. You can upload this zip file to your server immediately and unpack it there. This is the fastest method for server owners if the host does not support SVN.
  3. Clone the git repository:
    git@github.com:FPtje/DarkRP.git
    This option is recommended for power users (people who know how to use git and have a use for it) and people who want to contribute to the DarkRP project.


WHY you should migrate to DarkRP 2.5.0

Oh I hear you, you don't want to move to DarkRP 2.5.0 because you've edited your DarkRP to hell and back. Well now is the time to regret messing with DarkRP files, because DarkRP 2.5.0 is awesome.

  • F4 menu, F1 menu, pocket, language system. ALL recoded and much more awesome now.
  • Put all your modifications in a separate addon (can be downloaded here)
  • Easy as shit to add F4 menu tabs. There's even an example module that adds an extra tab in the mod addon
  • Really easy to update DarkRP because you don't have to edit its files
  • Translating DarkRP to French, Russian or any other language is easier than ever. Just edit the file in the mod addon!
  • Loads faster than DarkRP 2.4.3!

Migrating basic things

First of all, download and install the DarkRP modification addon. https://github.com/FPtje/DarkRPModification

Because from now on, you're going to stop messing with DarkRP files. You leave the DarkRP folder as it is, and you modify the addon instead. Sounds impossible, but it isn't. Bear with me.

ALL of your custom jobs, custom shipments, custom team chats custom whatever things go in the files in the addon.

Note: If you copy (edited) default jobs/shipments/entities/etc. to the addon, you'll end up with two versions of them. Disable the DarkRP original ones in disabled_defaults.lua

Note: Don't just whack your shared.lua in jobs.lua. Copy the jobs from it to jobs.lua, the agendas to agendas.lua etc. Everything has its own file now.

Config files can be found in the addon as well. Just look around and you'll find it.

Advanced stuff

Your custom modules

your HUD replacements, your F4 menu edits and all that kind of stuff.

Here's your biggest problem: most function and hook names have changed. If you have a DarkRP module, it is likely to stop working. This is the error you're likely to get:

SomeFolder/someFile.lua:LinenumberHere Attempt to call method Whatever, a nil value.

There will also be problems with things that happen on events that suddenly stop happening. There will be no errors in such case. Think of

  • Your module does something when players are arrested, but suddenly your module doesn't do that anymore
  • Your module does something with doors (when you buy them or w/e), but it stops doing it without warning or error.

If it's a module that worked before the migration, it is very likely to be a migration problem. Here's some tips:

  • Many DarkRP hooks and functions used to start with an uppercase letter, but in DarkRP 2.5.0 all functions start with lowercase (DarkRP.GetDarkRPVar -> DarkRP.getDarkRPVar)

Try this trick first!

If you know Lua, migrating your module from old to new DarkRP should be easy. However, note the following:

  • The F4 menu has been recoded. If you modified showteamtabs.lua, may your favourite deity be with you, because that file and all of its contents are gone COMPLETELY
  • The F1 menu has been recoded. If you did anything with that (add help categories and help items), that will break
  • The pocket has been recoded. It still looks the same when you're playing, but it does totally different things. For one it doesn't make props invisible anymore. It really removes them now.
  • The language system has been recoded. If you translated DarkRP, you might be able to move some things over to the translation in the mod addon.
  • Pretty much everything that hasn't been recoded, has been moved somewhere else in the DarkRP folder. Everything is restructured. This shouldn't affect you if you didn't mess with DarkRP files.

HUD Replacement

Half of DarkRP servers replaced the HUD. Apparently this is something people wanted to do. Check out the DarkRP mod addon! It has an example HUD replacement. It's just a red health bar, but it shows you how to make your own HUD.

Adding a tab to the F4 menu

This was also done very often. For this there is also an example module in the DarkRP mod addon. You can even edit it to show your community's web page or the rules. It's really easy! Check it out!