Creating New Document

This section will show you step-by-step how to properly register a new document.

Taking advantage of these steps will ensure that your document is prepared as expected.


1. Create your document theme

  1. Open PSD file: Launch Adobe Photoshop and open the id_card.psd file, or if you don't have the aforementioned program, use the one you have and import an already finished file, such as id_card.png or use an already created document background, in which case go to 2. Document registration.

  2. Customize content: You can change the colors or modify the entire layout.

  3. Save Changes: After editing, save the document background in PNG format for use in the script.

  4. Upload PNG: Upload your new .png file to vms_documentsv2/html/images/


2. Document registration

To ensure the document is functional, you need to register it in config.lua. Let's create a weapon license document as an example. This license will contain information fields such as the individual's first name, last name, and height. To achieve this, open the config.lua file and locate Config.Documents. Then, create a new document object with the relevant details.

  1. Open config.lua: This file holds configurations for documents and makes them useable.

  2. Create a New Document: Inside Config.Documents, add a unique entry using the template provided. For example:

Create a New Document
  • type: Specifies the document type ('document' or 'badge').

  • itemName: Name of the item to inventory.

  • identificationIdPrefix: A prefix for the document ID.

  • image: Background image file for the document.

  • animations: Defines the animations used for viewing or showing the document.

  • prop: Prop that player will have in hand when using the item.

  • data: Information fields displayed on the document (e.g., firstName, ssn, height).

  • licenses: Licenses available for the document (e.g., drive_a, weapon).


3. Introduction of new player data information

SV.getDocumentsData obtains information from the data you have implemented in the section of the Create a New Document enter new parameters if any have been added.

As a reminder what the current data looks like from the added weapon_license:

For this document we need firstName, lastName, ssn and height.

  1. Open config.server.lua: Find SV.getDocumentsData in your config.server.lua

  2. Find missing values: For this you need to check what data is missing that we need from the data, we are looking for firstName, if there is firstName, we do not need to enter anything, the same with lastName, ssn, if there is no height for example, you should enter it.

Adding missing value to the SV.getDocumentsData

After entering the new information in SV.getDocumentsData, we need to enter it in SV.getPlayerData as well, since that's what the function references.

Adding missing function to the SV.getPlayerData


4. Introduction of new player licenses information

SV.getDocumentsLicense obtains information from the licenses you have implemented in the section Create a New Document enter new parameters if any have been added.

As a reminder of what the current licenses look like from the added weapon_license:

For this document we need a weapon.

  1. Open config.server.lua: Find SV.getDocumentsLicense in your config.server.lua

  2. Find missing values: For this you need to check what licenses are missing, which we need from licenses, we are looking for weapon, if there is one, we do not need to enter anything, but if there is no weapon license, you need to enter it.

Adding missing license to the SV.getDocumentsLicense

5. Customizing the displayed data

What is metadata.js and how to understand it?

Metadata in vms_documentsV2 is divided into 4 types: data, data2, signature and document_name.

  • data: document content - information displayed.

  • data2: badge second content next to photo

  • signature: Handwrite font signature visible on the document.

  • document_name: Document name displayed at the top of the document.

  1. Open metadata.js

  2. Register a new document: You need to enter the data to be displayed on the document

Register a new document

6. Result

Last updated

Was this helpful?