rage-fw-server

rilaxik 2024-06-14 19:23:41 +00:00
parent f56eed7c07
commit 68ee76e12d

@ -49,30 +49,75 @@ fw = {
Further documentation will describe the functions included in ``fw`` Further documentation will describe the functions included in ``fw``
### Server ### Server
Handles event manipulations that do not require player to be present in context
#### register #### register
Registers server event
```ts
fw.event.register('serverEventName', ([arg1, arg2]) => {
// your logic here
})
```
#### registerMany #### registerMany
Registers more than one server event at a time
```ts
fw.event.registerMany({
serverEventName1: ([arg1, arg2]) => { /* your logic here */}
serverEventName2: ([arg1, arg2]) => { /* your logic here */}
})
```
#### unregister #### unregister
Unregisters server event
```ts
fw.event.unregister('serverEventName')
```
#### trigger #### trigger
Triggers registered server event. Formerly known as ``call`` or ``emit``
```ts
fw.event.trigger('serverEventName', ['arg1', 2])
```
### Player ### Player
Handles event manipulations that require player to be present in context
#### triggerClient #### triggerClient
Triggers registered client event with passed arguments. Formerly known as ``callClient`` or ``emitClient``
```ts
fw.player.triggerClient('clientEventName', ['arg1', 2])
```
#### triggerBrowser #### triggerBrowser
Triggers registered CEF event with passed arguments. Formerly known as ``callBrowser`` or ``emitBrowser``
```ts
fw.player.triggerBrowser('cefEventName', ['arg1', 2])
```
### System ### System
Handles functions used to interact with system environment
#### Logger #### Logger
Used to log in a server console
##### info ##### info
Informational logs. Colored in white
```ts
fw.system.log.info('some information to be logged')
```
##### warn ##### warn
Warning logs. Colored in yellow
```ts
fw.system.log.info('warning message')
```
##### error ##### error
Error logs. Colored in red
```ts
fw.system.log.info('error message')
```
## Client ## Client
Package used on a client-side of your Rage:MP Server Package used on a client-side of your Rage:MP Server