πŸ”“Safe Events

This script protects your server from cheaters who use LUA executers to abuse events that you have unprotected, it has been tested on servers with +300 players and I can guarantee that it works well, it uses fivem's native DropPlayer so if your log system is prepared for it you will receive the logs automatically.

Client-Side

You need to change the TriggerServerEvent of the events you want to secure, like the example below.

Before:

TriggerServerEvent("testevent:server", "arg1", "arg2")

After:

This must be called on the top of client file like the core object

local token = exports.mad_safeevents:getToken()

This is called to replace the TriggerServerEvent

exports.mad_safeevents:ExecuteServerEvent("testevent:server", token, "arg1", "arg2")

Server-Side

You need to edit your server event to get ready to handle the event safer

You need to place this on top of your server event, this export return true or false and drop the player if needed

if not exports.mad_safeevents:verifyToken(src, token, "testevent:server") then 
        return print("player: "..src.." just got dropped") 
end

Example:

You need to receive the token and args (args are optional)

Config (server-side)

Dependacies

  • ox_lib

  • ESX or QBCORE or QBOX

Last updated