Skip to content

Commit

Permalink
Merge pull request #5 from Jump-On-Studios/Update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
KadDarem authored Jun 28, 2024
2 parents 9d478a0 + 40ec067 commit d5f894e
Show file tree
Hide file tree
Showing 22 changed files with 883 additions and 72 deletions.
4 changes: 3 additions & 1 deletion docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ function GenerateMenu(fileTree,key,parent) {
else
menu.items.push({text: firtToUpperCase(file), link: '/'+file})
}
if (fileTree.files.length == 1)
menu.link = '/'+fileTree.files[0]
}
if (fileTree.children) {
for (const child in fileTree.children) {
Expand Down Expand Up @@ -220,7 +222,7 @@ export default defineConfig({
},
{
text: 'Developer Resources',
collapsed: true,
collapsed: false,
items: [
{ text: 'Jo Libs',
link: '/',
Expand Down
43 changes: 35 additions & 8 deletions docs/jo_libs/modules/callback/client.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
# Trigger Server Callback
---
outline: 2
---
# Callback

The trigger server callback is usefull to get server data from the client side
A module to use callback module client side.

## jo.triggerServerCallback()
## jo.callback.register()
A function to register a client callback
### Syntax
```lua
jo.callback.register(name,cb)
```
#### Parameters
`name` : *string*
> The name of the callback event
`cb` : *function*
> The function executed when the callback is triggered

### Example
```lua
jo.callback.register('testClientCallback', function(value1,value2)
print(value1, value2)
return value1 + value2
end)
```

## jo.callback.triggerServer()
A function to trigger a server callback

### Syntax
```lua
jo.triggerServerCallback(name, cb, ...)
jo.callback.triggerServer(name, cb, ...)
```
#### Parameters
`name` : *string*
Expand All @@ -21,8 +47,9 @@ jo.triggerServerCallback(name, cb, ...)

### Example
```lua
local job = "sheriff"
jo.triggerServerCallback('yourResource:server:getExperience', function(experience)
print(experience)
end, job)
local value1 = 10
local value2 = 5
jo.callback.triggerServer('testServerCallback', function(newValue)
print(newValue)
end, value1,value2)
```
24 changes: 24 additions & 0 deletions docs/jo_libs/modules/callback/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Callback

Callback module is a module to create easy links between your client and server sides in your script.

## Include Callback in your script

1. To use the callback library, just add the initiator as a shared script inside of your `fxmanifest.lua` file.
```lua
shared_scripts {
'@jo_libs/init.lua'
}
```
2. Add the callback module inside the `fxmanifest.lua` (in lowercase)
```lua
jo_libs {
'callback',
}
```
You can now use the library inside of your resource with the `jo.callback` global variable.

## Functions

Documentation for the [Client](./client.md) side.
Documentation for the [Server](./server.md) side
48 changes: 42 additions & 6 deletions docs/jo_libs/modules/callback/server.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Register Server Callback
---
outline: 2
---
# Callback

## jo.registerServerCallback()
A module to use callback module server side

## jo.callback.register()

### Syntax
```lua
jo.registerServerCallback(name, cb)
jo.callback.register(name, cb)
```
#### Parameters
`name` : *string*
Expand All @@ -16,8 +21,39 @@ jo.registerServerCallback(name, cb)
### Example
```lua
jo.registerServerCallback('yourResource:server:getExperience', function(source,job)
local experience = GetExperience(source,job)
return experience
jo.callback.register('testServerCallback', function(source,value1,value2)
print(source,value1,value2)
return value1 + value2
end)
```

## jo.callback.triggerClient()
A function to trigger a client callback

### Syntax
```lua
jo.callback.triggerClient(name, source, cb, ...)
```
#### Parameters
`name` : *string*
> The name of the callback event
`source` : *integer*
> The source of the client to trigger
`cb` : *function*
> A function to receive the result of the event
`...` : *mixed* <BadgeOptional />
> The list of the parameter to send to the callback event

### Example
```lua
local value1 = 5
local value2 = 10
local source = 1
jo.callback.triggerClient('testClientCallback', source, function(returnValue)
print(returnValue)
end, value1, value2)
```
23 changes: 23 additions & 0 deletions docs/jo_libs/modules/database/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Database

Database module is a module to interact with your database.

## Include Database in your script

1. To use the Database library, just add the initiator as a shared script inside of your `fxmanifest.lua` file.
```lua
shared_scripts {
'@jo_libs/init.lua'
}
```
2. Add the Database module inside the `fxmanifest.lua` (in lowercase)
```lua
jo_libs {
'database',
}
```
You can now use the library inside of your resource with the `jo.database` global variable.

## Functions

Documentation for the [Server](./server.md) side
2 changes: 1 addition & 1 deletion docs/jo_libs/modules/database/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jo.database.addTrigger(triggerName,definition)

#### Return value
Type: *boolean*
> Return `true` if the trigger is successfully created
> Return `true` if the trigger is successfully created

### Example
Expand Down
23 changes: 23 additions & 0 deletions docs/jo_libs/modules/dataview/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Dataview

Dataview module is a module to use dataview in your scripts.

## Include Dataview in your script

1. To use the Dataview library, just add the initiator as a shared script inside of your `fxmanifest.lua` file.
```lua
shared_scripts {
'@jo_libs/init.lua'
}
```
2. Add the Dataview module inside the `fxmanifest.lua` (in lowercase)
```lua
jo_libs {
'dataview',
}
```
You can now use the library inside of your resource with the `Dataview` global variable.

## Functions

Documentation for the [Client](./client.md) side
31 changes: 31 additions & 0 deletions docs/jo_libs/modules/entity/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@ outline: 2

A library with usefull function to manage entity

## jo.entity.create()
a function to create a new entity
### Syntax
```lua
jo.entity.create(model,coords,heading,networked)
```
#### Parameters
`model` : *string*
> The model of the entity
`coords` : *vector3*
> The coordinate of the entity
`heading` : *float*
> The heading of the entity
`networked` : *boolean*
> If the entity needs to be networked

#### Return value
Type: *integer*
> Return ID of the entity

### Example
```lua
local entity = jo.entity.create('re_kidnappedvictim_females_01',vec3(1294.0,-512.3, 30.0),90.0,true)
print(entity)
```

## jo.entity.delete()
A function to delete an entity only if exist
### Syntax
Expand Down
24 changes: 24 additions & 0 deletions docs/jo_libs/modules/entity/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Entity

Entity module is a module to manage easier the entities.

## Include Entity in your script

1. To use the Entity library, just add the initiator as a shared script inside of your `fxmanifest.lua` file.
```lua
shared_scripts {
'@jo_libs/init.lua'
}
```
2. Add the Entity module inside the `fxmanifest.lua` (in lowercase)
```lua
jo_libs {
'entity',
}
```
You can now use the library inside of your resource with the `jo.entity` global variable.

## Functions

Documentation for the [Client](./client.md) side.
Documentation for the [Server](./server.md) side
23 changes: 23 additions & 0 deletions docs/jo_libs/modules/framework-bridge/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Framework

Framework module is a very powerfull module to build a multi-framework script.

## Include Framework in your script

1. To use the Framework library, just add the initiator as a shared script inside of your `fxmanifest.lua` file.
```lua
shared_scripts {
'@jo_libs/init.lua'
}
```
2. Add the Framework module inside the `fxmanifest.lua` (in lowercase)
```lua
jo_libs {
'framework',
}
```
You can now use the library inside of your resource with the `jo.framework` global variable.

## Functions

Documentation for the [Server](./server-class/framework.md) side
Loading

0 comments on commit d5f894e

Please sign in to comment.