diff --git a/README.md b/README.md index 9576cbb..2ac7cc6 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ BeamingDrive Multiplayer (BeamMP) server compatible with BeamMP clients. - [x] Tabulation - [ ] _(Deferred)_ Normal text scroll - [ ] Documentation: - - [x] [Plugins and Events](docs/plugins.md) + - [x] [Plugins and Events](docs/plugins and events.md) ## Installation diff --git a/docs/plugins and events.md b/docs/plugins and events.md new file mode 100644 index 0000000..b0dc1d3 --- /dev/null +++ b/docs/plugins and events.md @@ -0,0 +1,33 @@ +# Plugins System + +## Install + +[//]: # (TODO: BEAM LIB) +Lib can't ready to use +* From pip:\ + `$ pip install ...` +* From source:\ + `git clone https://github.com/kuitoi/...` + +## Example + +```python +import BEAMP + +beam = BEAMP("TestPlugin") +logger = beam.log + +def load(): # Plugins load from here + print(beam.name) + +def on_started(): + logger.info("Server starting...") + +beam.register_event("on_started", on_started) +``` + +* Basic Events: ['on_started', 'on_auth, 'on_stop'] +* Create new event : `beam.register_event("my_event", my_event_function)` +* Call event: `beam.call_event("my_event")` +* Call event with some data: `beam.call_event("my_event", data, data2)` +* Calls _**can't support**_ like this: `beam.call_event("my_event", data=data)`