Skip to content

Commit 6d354f2

Browse files
committed
Update interactv2 docs and addPed example
Remove outdated Usage section from interactv2 page. Update pedmanager addPed example to show sleepless_interact v2 option format and point the interactOptions link to /interactv2/client/interactOptions.
1 parent aefc928 commit 6d354f2

2 files changed

Lines changed: 25 additions & 38 deletions

File tree

pages/interactv2.mdx

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,4 @@ config.defaultShowKeyBind = 'LMENU'
4747
-- "hold" | "toggle" sets the behavior of the show interactions key bind
4848
config.showKeyBindBehavior = 'toggle'
4949

50-
```
51-
52-
## Usage
53-
54-
To enable the library inside of your resource just add `@sleepless_interact/init.lua` as a client_script in your `fxmanifest.lua` file.
55-
56-
```lua
57-
client_scripts {
58-
'@sleepless_interact/init.lua',
59-
}
60-
```
61-
62-
When sleepless_interact has been imported into your script, it will make a new global:
63-
- `interact` for calling sleepless_interact functions into your script.
64-
65-
<Callout type="info">
66-
all of the functions can also be called via exports. example: `exports.sleepless_interact:addEntity(netId, options)`
67-
</Callout>
68-
69-
You can now use the interact functions inside of your resource.
50+
```

pages/pedmanager/client/addPed.mdx

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ add a new ped to be handled by the manager. allows for target options, animation
1818
- `pos?` (`vec3`): position of the prop relative to the bone its attached to
1919
- `rot?` (`vec3`): rotation of the prop relative to the bone its attached to
2020
- `targetOptions?` (`table`): an array of `ox_target` [options](https://overextended.dev/ox_target/Options)
21-
- `interactOptions?` (`table`): a `sleepless_interact` [local entity interaction](https://sleeplessdevelopment.dev/interact/client/addLocalEntity)
21+
- `interactOptions?` (`table`): a `sleepless_interact` [Option or array of Options](/interactv2/client/interactOptions)
2222
- `renderDistance?` (`number`): distance from the player at which the ped spawns
2323
- `onSpawn?` (`function(ped?: number)`): a function that gets called right *AFTER* the ped is spawned
2424
- `onDespawn?` (`function(ped?: number)`): a function that gets called right *BEFORE* the ped is despawned
@@ -53,28 +53,34 @@ local pedPoint = exports.sleepless_pedmanager:addPed({
5353
serverEvent = "some event"
5454
},
5555
},
56-
interactOptions = {
57-
id = "uniqueID",
58-
options = {
59-
{
60-
label = "Local Interact Option",
61-
icon = "hand", -- Example simple FA icon name
62-
-- groups = {['police'] = 1},
63-
-- items = {['money'] = 100},
64-
onSelect =function(data) print("Local entity action triggered") end,
65-
canInteract = function(entity, distance, coords, id)
66-
return distance < 2.0 -- Example condition based on distance
67-
end
68-
}
56+
interactOptions = { -- sleepless_interact v2 options
57+
{
58+
label = "Talk to Ped",
59+
name = "talk_to_ped",
60+
icon = "comments",
61+
distance = 2.0,
62+
onSelect = function(data)
63+
print("Talking to ped")
64+
end,
65+
canInteract = function(entity, distance, coords, name)
66+
return distance < 2.0
67+
end
6968
},
70-
renderDistance = 10.0,
71-
activeDistance = 2.0,
72-
cooldown = 1500
69+
{
70+
label = "Trade with Ped",
71+
name = "trade_with_ped",
72+
icon = "hand-holding-dollar",
73+
distance = 2.0,
74+
cooldown = 1500,
75+
onSelect = function(data)
76+
print("Trading with ped")
77+
end
78+
}
7379
},
7480
onSpawn = function(ped)
7581
GiveWeaponToPed(ped, `WEAPON_RPG`, 100, false, true)
7682
SetCurrentPedWeapon(ped, `WEAPON_RPG`, true)
7783
end,
7884
onDespawn = function(ped)
7985
end
80-
})
86+
})

0 commit comments

Comments
 (0)