[Release] EssentialMode base


Name: EssentialMode

Version: 5.0.2

Download(FXServer): https://kanersps.pw/files/essential5.zip

Documentation: https://docs.essentialmode.com/

Tipping jar: https://donate.kanersps.pw/

Installation(FXServver): Extract the folder to your resources, append “essentialmode” to your AutoStartResources. Use the convars “es_couchdb_url”, “es_couchdb_port” and “es_couchdb_password” to modify essentialmode itself. No need to modify any core code anymore. And last but not least make sure CouchDB 2.0.0 is setup correctly.

Description: EssentiaMode is a base resource which has money and permissions built in. EssentialMode itself will not do anything of use. This can be used to easily create resources that have to communicate with eachother. This package also contains one addon called: “es_admin”, which adds admin commands to your server.

My discord: https://discord.gg/0lsnMcbAi2DyTKxf

Rent a server with EssentialMode

And get a 10% lifetime discount!

Discount code: kanersps-a-2529

Updated below for EssentialMode 4+

Usage: EssentialMode has many event handlers, here are the current ones available.
Note: These are server-sided

-- Gets called the first time a player spawns in the server.
AddEventHandler('es:firstSpawn', function(source) end)

-- Gets called when a player is fully loaded.
AddEventHandler('es:playerLoaded', function(source) end)

-- Gets called when the player is initialized.
AddEventHandler('es:initialized', function(player) end)

    Added: version 1.0.0

-- Gets called when a user command is successfully ran.
AddEventHandler('es:userCommandRan', function(source, command_args, user) end)

-- Gets called when any command is ran
AddEventHandler('es:commandRan', function(source, command_args, user) end)

-- Gets called when an admin command is ran
AddEventHandler('es:adminCommandRan', function(source, command_args, user) end)

-- Gets called when a non existent command is ran. (This can be cancelled to not display the message)
AddEventHandler('es:invalidCommandHandler', function(source, command_args, user) end)

-- This gets called when an admin command is ran, but the user does not have permission to run it.
AddEventHandler('es:adminCommandFailed', function(source, command_args, user) end)

-- This gets called when a chat message is send.
AddEventHandler('es:chatMessage', function(source, command_args, user) end)

    Added: EssentialMode 4+

-- Gets called when a player leaves the server,  handy for saving custom data.
AddEventHandler('es:playerDropped', function(user)end)

And these are the ones you can trigger, again from the server.

-- Add a command everyone is able to run. Args is a table with all the arguments, and the user is the user object, containing all the user data.
TriggerEvent('es:addCommand', 'command-here-without-slash', function(source, args, user) end, {help here})

-- Add a command that requires admin privelages, the third argument is the required permission level. The first function is when the user has this permission, the second one is when the player does not.
TriggerEvent('es:addAdminCommand', 'command-here-without-slash', 5, function(source, args, user) 
     -- Has permission
end, function(source, args, user) 
     -- Doesn't have permission
end, {help here})

-- Gives the loaded user corresponding to the given player id(second argument).
TriggerEvent('es:getPlayerFromId', source, function(user)
     -- The user object is either nil or the loaded user.

-- Sets player data and then calls the callback once this is done.
TriggerEvent('es:setPlayerData', source, key, value, function(message, success) end)

-- Does the same as above but you can use a identifier instead of a playerid.
TriggerEvent('es:setPlayerDataId', id, key, value, function(message, success) end)

    Added: version 0.2.2

-- Gives all the loaded players in the first function argument.
TriggerEvent('es:getPlayers', function(players) end)

-- [[
     Added version 1.1.0

-- You can set the default settings with this. The parameter is a table, the settings you want to change can be put in here.
TriggerEvent("es:setDefaultSettings", {})
-- Here is an example usage
TriggerEvent("es:setDefaultSettings", {
    pvpEnabled = true -- Default false

-- This is able to set a session setting, this setting is saved until server restart.
TriggerEvent("es:setSessionSetting", key, value)

-- With this you can get the variable that was saved using setSessionSetting, the callback has one parameter which contains the stored value (or nil).
TriggerEvent("es:getSessionSetting", key, callback)

    Added version 2.0.0

-- Adds a new group with the groupname of your choise, you can make it inherit from custom groups or from the main ones. Inhereting from superadmin means that group has access to everything.
TriggerEvent("es:addGroup", "groupname", "inherits")

-- Returns all of the groups inside of the: groups argument
TriggerEvent("es:getAllGroups", function(groups) end)

    Added: EssentialMode 4+

-- Add a command that requires a specific group. The last 2 arguments need to be functions which both have 3 arguments. (source, command_args, Users[source])
TriggerEvent("es:addGroupCommand", command, group, callback, callbackfailed, {help here})

Custom data plugins

Finally what people have been wanting, MySQL support. Well kind of, there is support for intercepting data and manipulating it yourself. Anyway, this comes with a resource that will make MySQL work again for the base data that comes with EssentialMode!

How to use MySQL.

  • Download esplugin_mysql
  • Make sure you have MySQL-Async installed and working
  • Import the SQL file that comes with esplugin_mysql
  • Set this convar in your server configuration: set es_enableCustomData 1
  • Make sure that your load order is correct, make sure essentialmode starts before esplugin_mysql and MySQL-Async starts before essentialmode
  • Start the server
  • Stop whining at @Kanersps about fucking MySQL kthx

On how to implement your own data saving take a look at esplugin_mysql


You can enable logging by setting the default settings enableLogging to true, when you do that a log file will be created every day with what happened, for example when admin commands are ran or when someone is kicked. It will also log some errors that may happen


Client wrappers for the user are available now, you can use these by either doing:

client_script '@essentialmode/server/player/wrappers.lua'


local user = exports.essentialmode:getUser() In any file you want to use it in, the previous statement will make the user table available in your entire resource.

All the current wrappers can be found here

User object (Available functions that you can use on the user)

-- Getters
user.getMoney() -- Returns number
user.getBank() -- Returns number
user.getCoords() -- Returns table(coords.x, coords.y, coords.z)
user.getSessionVar(key) -- Returns stored session variable
user.getPermissions() -- Returns int
user.getIdentifier() -- Returns user identifier, most likely hex steamid64
user.getGroup() -- Returns string of a users group
user.get('item') -- Can be used for all of the above

-- Setters
user.setMoney(amount) -- Sets the user money
user.setBankBalance(amount) -- Sets the user bank balance
user.removeMoney(amount) -- Removes from the current amount of user money
user.addMoney(amount) -- Adds to the current amount of user money
user.removeBank(amount) -- Removes from the current amount of user bank balance
user.addBank(amount) -- Adds to the current amount of user bank balance

-- Functions
user.displayMoney(amount) -- Used to display amount of money in UI
user.displayBank(amount) -- Same as above for bank, only use if using NativeUI option
user.kick(reason) -- Kicks user with specified reason

-- Sets a global function on a user, call only once like on es:playerLoaded 
user.setGlobal('global', 'default') -- See example below

user.setGlobal('job', 'citizen')
-- Will create 2 new functions on the user
user.setJob(value) -- Sets the global 'job' to value
user.getJob() -- Gets the global 'job'

Default settings These are the settings you can change, these are the default values aswell.

settings.defaultSettings = {
	['pvpEnabled'] = false, -- Do you want server-wide pvp
	['permissionDenied'] = false, -- Can be set to a string, this will be displayed if a user tries to run a command it does not have permission to.
	['debugInformation'] = false -- Do you want to log debug information
        ['startingCash'] = 0 -- Set the amount of money you want people to start with
        ['startingBank'] = 0  -- Set the amount of bank balance people start with
        ['enableRankDecorators'] = false -- Sets a decorator with the players permission_level on their entity.
        ['moneyIcon'] = "$" -- Change what currency is used
        ['nativeMoneySystem'] = false -- Enable if the native money system is used
        ['commandDelimeter'] - "/" -- Change the delimiter required for commands

Default user groups (If using “es_admin” you can set a player group in rcon with: “setgroup userid groupname”

-- First parameter is group name, second is inheritance

-- User group, lowest possible.
user = Group("user", "")

-- Admin, is allowed to run administrative functions
admin = Group("admin", "user")

-- Superadmin, can run any command, bypasses command levels
superadmin = Group("superadmin", "admin")

That’s it, EssentialMode has great plugin support and also great support if you want to add additional data saving. For an example of this look at plugin_data in your favourite sql browser.

Final note: Again, support is limited. If you cannot setup CouchDB then do not ask help from me or on this topic, you probaly shouldn’t use this anyhow if you can’t set that up. And if you want to make plugins make sure to load them after EssentialMode


Update 18-1-2017
- Performance improvement regarding having **tons** of commands(1000s), this will work fine now. 
- New event: `TriggerEvent('es:getAllPlayers', function(players) end)` gives all the players even the offline ones.
- Misc stability improvements

Update 8-2-2017
- MySQL return values are their correct type
- Tons of new events
- Code improvement
- New DB structure..

Update 22-02-2017
- New events
- Default & Session settings.
- Build in PvP support

Update 18-03-2017
- New events
- Player session settings
- Player classes
- Group classes
- Misc stuff

Update 25-04-2017
- Added moneyIcon
- Fixed newPlayerLoaded event

Update 03-05-2017
- New database
- Misc stuff I forgot

Update 07-05-2017
- Added exposed DB functions for custom plugin data
- Added user:setBankBalance(amount)

Update 11-05-2017
- CouchDB settings added
- Misc stuff
- Fixes

Update 14-05-2017
- Base64 encode automatic
- Config moved to own file

Update 27-06-2017
- FXServer support released
- Bunch of of stuff that was stated in a teaser post

Update 20-07-2017
- Tons of fixes that would take ages to list here, just read the update replies

Update 26-07-2017
- Added a new parameter to adding commands, for the new chat so that suggestions pop up
- Fixed misc issues
- Added addACECommand to server exports

Update 12-08-2017
- es_admin overhaul with shiny new GUI
- Fixed misc issues that mostly happened on Linux
- Cleaned up some code

Update 14-08-2017
- es_admin fixes and banning
- Code cleanup
- Permission inheritance fixed

Update 17-08-2017
- Devtools added
- Group inheritance fixes
- Misc fixes

Essentialmode for mysql
[Release][ESX] [Jobs]
[Release] Jobs System v2.1 and Paycheck v2.1
[Release] [ESX] [Garage]
[Release] [ESX] [Clothing Shops]
[Release] [ESX] [Police Job]
[Release][ESX] Properties
[Release] [ES] Simple Banking port to 3.1.0
[Release] [ESX] [Drugs]
[Release] Loadout System
[Release][ESX] [EMS/Ambulance Job]
[Release] Freeroam 2 by Kanersps
[Release] In-Game Server/Resource Management ~ Ranks, Kick/Ban PlayerName/ID, Resource Start/Stop +More Soon
[Release] Cops FiveM V1.4.2 (01/08/2018)
[Release]Model-Menu V3 [9th Oct]
[How to] Install ESX
[Release] [ES] es_garages | Vehicle Ownership & Garages
Admin on my server?
[Release] [ESX] [Mechanic Job]
[ESX] Check Job ID external
[Release][ES] Loadouts (v2.2)
Setting up EssentialMode Base
Es_admin2 With Noclip of VRP
[HELP] Skin bug
[Release] [ESX] [Real Estate Agent Job]
[vRP Framework]-[Dunko Edited V6.2 - FX Server] UPDATED 10/11/2017 - Supports 12 languages
[Release] Harvest/Treatment/Selling Jobs System v1.1
[RELEASE][FR]/[EN] - Coffre LSPD / Vault
Fx server to esx server?
[How-To] FX Server Setup For Dummies
[Release][ESX] [Jobs]
[Release] Freeroam 2 by Kanersps
[Release] Simple enters/exits system [UPDATED v.0.2]
Essential no longer comes with SQL File?
[Release] Colored Hud ( Weapons / Radio / blips )
[vRP Framework]-[Dunko Edited V6.2 - FX Server] UPDATED 10/11/2017 - Supports 12 languages
[How-to] Setup FXServer with MySQL and Essentialmode4
[Release] Apartment [MySQL & Async](08/17/2017)
Deprecating CitizenMP.Server
I would need help
I do not appear on my MySQL database (steam id)
[Release][ES][outdated] Slot Machine
[Release] [Essentialmode] es_camera
Unexpected symbol near ':' erroe
No icons on map
[HELP] Connection to database + print on screen
Essential Issue
[Release] WebDatabase Viewer
[Release][EM][ST][SQL] BETA FX-Customs SQL only
EssentialBase topic dead
New server how to add mods
Confusion with mode folder directory




Edited by Kanersps


Update 18-1-2017

  • Performance improvement regarding having tons of commands(1000s), this will work fine now.
  • New event: TriggerEvent('es:getAllPlayers', function(players) end) gives all the players even the offline ones.
  • Misc stability improvements


how do you setup the mySQL bullshit to get this running cause when i start server it is throwing a whole bunch of errors at me with something about login.lua



Final note: Again, support is limited. If you cannot setup the mysql with this do not ask help from me or on this topic, you probaly shouldn’t use this anyhow if you can’t set that up. And if you want to make plugins make sure to load them after EssentialMode


i basically want essentialmode for the admin commands so i can ban or kick trolls and rude kids from my roleplay server. PS, no need to be a dick about helping me or not


The dll was probably blocked, a simple Google could tell you that.


So I don’t need to run a mysql server


You do? How else can you have a mysql dB lol


alright the start errors went away but this happens when i join and i get stuck at the GTa 5 logo / copyright screen after loadscreen


Literally not going to explain.my disclaimer states if you can’t even setup a dB you shouldn’t use this


For all the people that have trouble getting the server to load the gamemode even though mySQL is properly setup, please note that Windows servers will probably block the .dll file. Just right click on it and select “Remove blockage” and done. It will now load perfectly.

IF you’ve installed it correctly that is… ofcourse :slight_smile:



Fixed the download, added the sql file and the admin stuff.


hey kanersps should the admin resource work excluding the gamemode, i can type in setadmin in console and it returned usage setadmin userid level etc but when i put in my Id which is 1 nd permission level 4 it dont do anything


did you figure out how to fix this im getting the same error messages plus a message saying
game\gameserver.cs(687): warn: gameserver::handlereliablecommand: a client tried to send an event of type es:updatepoitions, but it was not greenlit for client invocatioin. you may need to call registerserverevent from your script. ? any idea please


You really need to setup a database for this to work man.
How will it know who is and who isn’t an admin without storing that information?
The setadmin command, if its similar from freemode2, stores the permission level in the database, so that won’t work if there isn’t one setup.

I might make a video or something on setting one up just because so many people don’t know how but I’d suggest looking it up because it’s really easy to do once you download it.


ive set up a mysql up and its working but its saying no such host is known