Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

ardelan869/fivem-statebag-eventsystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Warning

It has been tested, but it still could be unreliable or buggy. Use it at your own risk.

Note

This is just a fun little project I whipped up in about 10-20 minutes.
It might be safer than the normal event system, but I do not promise anything.
Executors like Eulen or RedEngine should still be able to trigger the "StateBag-Events" if the user knows the structure.

fivem-statebag-eventsystem

Uses FiveM's built-in StateBags to route events.

This script/file overwrites RegisterNetEvent, AddEventHandler, TriggerEvent, TriggerServerEvent, TriggerClientEvent.
You can use everything like you did before, the only difference is that it "uses a different routing".

Usage

Add the file @resourceName/import.lua into the shared_scripts section of your desired fxmanifest.lua.
@resourceName refers to the name of the resource, name the resource as you desire.

Example

  • fxmanifest.lua
fx_version 'cerulean'
game 'gta5'
lua54 'yes'

shared_script '@fivem-statebag-eventsystem/import.lua'
client_script 'client.lua'
  • client.lua
RegisterNetEvent('test', function(value1, value2)
  print('value1', value1)
  print('value2', value2)
end)

RegisterCommand('test', function()
  TriggerEvent('test', '🐈', '🗣️')
end)

About

Uses FiveM's built-in StateBags to route events.

Topics

Resources

License

Stars

Watchers

Forks

Languages