Name: EssentialMode
Version: 6.4.2
Download: Release EssentialMode 6.4.2 · kanersps/essentialmode · GitHub
Github(essentialmode): GitHub - kanersps/essentialmode: A FiveM project
Github(es_admin2): GitHub - kanersps/es_admin
es_extended (roleplay framework for EssentialMode)
I advise using GitHub - zaphosting/esx: This Pack is insecure and outdated and is kept here for archiving reasons, do not use. instead of the usual ESX by Hawaii_Beach. Due to ongoing harassment, insults and threats from him towards the FiveM community, he also decided to forcefully stop base FiveM resources and has shown great distaste into helping the FiveM community.
Documentation:
Contact: https://kanersps.pw/
Installation(FXServer): Installation | Kane's Documentation
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 each other. This package also contains one addon called: “es_admin”, which adds admin commands to your server.
Rent a server with EssentialMode
And get a 10% lifetime discount!
(FiveM game server hosting)
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 sent.
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 privileges, 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.
end)
-- 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 an 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 choice, you can make it inherit from custom groups or from the main ones. Inheriting 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 beforeesplugin_mysql
andMySQL-Async
starts beforeessentialmode
- 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
Logging
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
Wrappers
Client wrappers for the user are available now, you can use these by either doing:
client_script '@essentialmode/server/player/wrappers.lua'
or
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 as well.
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 for multiple data handlers and different databases.
Final note: Again, support is limited. If you cannot setup CouchDB then do not ask help from me or on this topic, you probably 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.