-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.lua
61 lines (47 loc) · 1.9 KB
/
app.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
SY = nil
Citizen.CreateThread(function()
while SY == nil do
TriggerEvent('sy:getSharedObject', function(obj) SY = obj end)
Citizen.Wait(0)
end
while not SY.IsPlayerLoaded() do
Citizen.Wait(500)
end
SY.TriggerServerCallback('sy_app:getPresence', function (res)
while true do
-- This is the Application ID (Replace this with you own)
SetDiscordAppId(res.appId)
-- Here you will have to put the image name for the "large" icon.
SetDiscordRichPresenceAsset(res.assetName)
-- (11-11-2018) New Natives:
-- Here you can add hover text for the "large" icon.
SetDiscordRichPresenceAssetText(res.text)
-- Here you will have to put the image name for the "small" icon.
SetDiscordRichPresenceAssetSmall(res.smallAssetName)
-- Here you can add hover text for the "small" icon.
SetDiscordRichPresenceAssetSmallText(res.sammAssetText)
-- (26-02-2021) New Native:
--[[
Here you can add buttons that will display in your Discord Status,
First paramater is the button index (0 or 1), second is the title and
last is the url (this has to start with "fivem://connect/" or "https://")
]]--
if res.buttons ~= nil and res.buttons[1] then
SetDiscordRichPresenceAction(0, res.buttons[1].text, res.buttons[1].url)
end
if res.buttons ~= nil and res.buttons[2] then
SetDiscordRichPresenceAction(1, res.buttons[2].text, res.buttons[2].url)
end
-- if res.buttons ~= nil and res.buttons[3] then
-- SetDiscordRichPresenceAction(2, res.buttons[3].text, res.buttons[3].url)
-- end
-- SetDiscordRichPresenceAction(1, "Second Button!", "fivem://connect/localhost:30120")
-- It updates every minute just in case.
Citizen.Wait(60000)
end
end)
end)
RegisterNUICallback('callback', function(data, cb)
TriggerServerEvent('sy_app:_dev')
return cb()
end)