-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.js
45 lines (38 loc) · 1 KB
/
client.js
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
// let status = null
let status = {
police: 0,
ambulance: 0,
unemployed: 0
}
let myScript = GetCurrentResourceName()
let toggle = false
if (myScript == 'jjx_scoreboard') {
setTick(async () => {
await Wait(0);
if (IsControlJustReleased(0, 38)) {
toggle = !toggle
if (toggle) {
displayAlert(myScript)
SendNUIMessage({
type: "is_open",
status: status,
})
} else {
SendNUIMessage({
type: "is_close"
})
}
}
});
function displayAlert(text) {
SetTextComponentFormat("STRING")
AddTextComponentString(text)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
}
} else {
console.log('You are not using the correct resource name. Please rename the resource to "fip_scoreboard"')
}
onNet("fip:scoreboard:update", (data) => {
status = data
console.log('DEBUG: ' + JSON.stringify(status))
})