# Install on Server

## <mark style="color:red;">IMPORTANT:</mark>

<mark style="color:orange;">Make sure you have OneSync enabled otherwise you will have sync problems.</mark>

Please download the latest version from [keymaster.fivem.net](https://keymaster.fivem.net/login?return_url=/) and then extract the folder onto your server, as well as a folder of your choice. Afterward, open your server.cfg file and add the following line after "ESX-Core":

`ensure GMD_Entry`

Once you have completed these steps, you can restart your server. The script will automatically create any necessary database entries.

## **esx\_skin:**

go to esx\_skin/server/main.lua line 1 - 22

and enter there the event which starts the entry after the char was saved:

```lua
TriggerEvent("GMD_Entry:SkinTrigger", source)
```

## like  this:

<figure><img src="https://355685288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9l40cW5bMeovJJryQuA1%2Fuploads%2FtPfq4lzRCRzEgpC96QiA%2Fimage.png?alt=media&#x26;token=18116dbf-b174-43e3-8617-fd11561023d2" alt=""><figcaption></figcaption></figure>

or in your skin saver, i.e. where the skin is saved, for example in multichars, charcreator ...

## this step is optional:

go to es\_extended/server/paycheck.lua line: 1-45 and replace the following lines with each other.

<mark style="background-color:orange;">this change prevents a player who is in the state illegally from receiving paychecks from the state except from the job the player is receiving money from</mark>

```lua
function StartPayCheck()
  CreateThread(function()
    while true do
      Wait(Config.PaycheckInterval)
      local xPlayers = ESX.GetExtendedPlayers()
      for i = 1, #(xPlayers) do
        local xPlayer = xPlayers[i]
        local job = xPlayer.job.grade_name
        local salary = xPlayer.job.grade_salary

        if salary > 0 then
          if job == 'unemployed' then -- unemployed
            xPlayer.addAccountMoney('bank', salary, "Welfare Check")
            TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_help', salary),
              'CHAR_BANK_MAZE', 9)
          elseif Config.EnableSocietyPayouts then -- possibly a society
            TriggerEvent('esx_society:getSociety', xPlayer.job.name, function(society)
              if society ~= nil then -- verified society
                TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account)
                  if account.money >= salary then -- does the society money to pay its employees?
                    xPlayer.addAccountMoney('bank', salary, "Paycheck")
                    account.removeMoney(salary)

                    TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'),
                      _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
                  else
                    TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), '', _U('company_nomoney'), 'CHAR_BANK_MAZE', 1)
                  end
                end)
              else -- not a society
                xPlayer.addAccountMoney('bank', salary, "Paycheck")
                TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary),
                  'CHAR_BANK_MAZE', 9)
              end
            end)
          else -- generic job
            xPlayer.addAccountMoney('bank', salary, "Paycheck")
            TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary),
              'CHAR_BANK_MAZE', 9)
          end
        end
      end
    end
  end)
end
```

with:

```lua
function StartPayCheck()
    CreateThread(function()
        while true do
            Wait(Config.PaycheckInterval)
            local xPlayers = ESX.GetExtendedPlayers()
            for i = 1, #(xPlayers) do
                local xPlayer = xPlayers[i]
                local job = xPlayer.job.grade_name
                local salary = xPlayer.job.grade_salary

                if salary > 0 then
                    local response = MySQL.query.await('SELECT `entry_type` FROM `users` WHERE `identifier` = ?', {
                        xPlayer.identifier
                    })
                    if response and #response > 0 then
                        local entryType = response[1].entry_type

                        if entryType == false then
                            if job == 'unemployed' then -- unemployed
                                xPlayer.addAccountMoney('bank', salary, "Welfare Check")
                                TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_help', salary),
                                    'CHAR_BANK_MAZE', 9)
                            elseif Config.EnableSocietyPayouts then -- possibly a society
                                TriggerEvent('esx_society:getSociety', xPlayer.job.name, function(society)
                                    if society ~= nil then -- verified society
                                        TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account)
                                            if account.money >= salary then -- does the society have enough money to pay its employees?
                                                xPlayer.addAccountMoney('bank', salary, "Paycheck")
                                                account.removeMoney(salary)

                                                TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'),
                                                    _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
                                            else
                                                TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), '', _U('company_nomoney'), 'CHAR_BANK_MAZE', 1)
                                            end
                                        end)
                                    else -- not a society
                                        xPlayer.addAccountMoney('bank', salary, "Paycheck")
                                        TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary),
                                            'CHAR_BANK_MAZE', 9)
                                    end
                                end)
                            else -- generic job
                                xPlayer.addAccountMoney('bank', salary, "Paycheck")
                                TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary),
                                    'CHAR_BANK_MAZE', 9)
                            end
                        elseif entryType == true then
                            -- Only job payout, do not pay additional salary
                            if not (job == 'unemployed' or Config.EnableSocietyPayouts) then
                                xPlayer.addAccountMoney('bank', salary, "Paycheck")
                                TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary),
                                    'CHAR_BANK_MAZE', 9)
                            end
                        end
                    end
                end
            end
        end
    end)
end
```
