-
Notifications
You must be signed in to change notification settings - Fork 1
/
citizenfx.go
115 lines (88 loc) · 2.48 KB
/
citizenfx.go
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package citizenfx
import "syscall/js"
type _client struct {
}
var (
Global = js.Global()
Server = new(_server)
Client = new(_client)
)
func init() {
if err := BindGlobals(Server); err != nil {
panic(err)
}
}
func AddRawEventListener(eventName string, callback js.Func) {
Global.Call("AddRawEventListener", eventName, callback)
}
func AddEventListener(eventName string, callback js.Func, netSafe bool) {
Global.Call("AddEventListener", eventName, callback, netSafe)
}
func On(eventName string, callback js.Func) {
Global.Call("On", eventName, callback)
}
func AddEventHandler(eventName string, callback js.Func) {
Global.Call("AddEventHandler", eventName, callback)
}
func AddNetEventListener(eventName string, callback js.Func) {
Global.Call("AddNetEventListener", eventName, callback)
}
func OnNet(eventName string, callback js.Func) {
Global.Call("OnNet", eventName, callback)
}
func Emit(args ...interface{}) {
Global.Call("Emit", args)
}
func TriggerEvent(args ...interface{}) {
Global.Call("TriggerEvent", args)
}
// func EmitNet(args ...interface{}) {
// }
func EmitNet(args ...interface{}) {
Global.Call("EmitNet", args...)
}
func TriggerServerEvent(args ...interface{}) {
Global.Call("TriggerServerEvent", args)
}
func TriggerLatentServerEvent(args ...interface{}) {
Global.Call("TriggerLatentServerEvent", args...)
}
func GetPlayerIdentifiers(player interface{}) js.Value {
return Global.Call("GetPlayerIdentifiers", player)
}
func GetPlayerTokens(player interface{}) js.Value {
return Global.Call("GetPlayerTokens", player)
}
func GetPlayers() js.Value {
return Global.Call("GetPlayers")
}
func SendNUIMessage(data interface{}) {
Global.Call("SendNUIMessage", data)
}
func TriggerClientEvent(args ...interface{}) {
Global.Call("TriggerClientEvent", args...)
}
func TriggerLatentClientEvent(args ...interface{}) {
Global.Call("TriggerLatentClientEvent", args...)
}
func RemoveEventListener(eventName string, callback js.Func) {
Global.Call("RemoveEventListener", eventName, callback)
}
func SetTick(callback js.Func) float64 {
return Global.Call("SetTick", callback).Float()
}
func ClearTick(callback float64) {
Global.Call("ClearTick", callback)
}
func NewStateBag(name string) js.Value {
return Global.Call("NewStateBag", name)
}
func Entity(entity float64) js.Value {
return Global.Call("Entity", entity)
}
func Player(entity interface{}) js.Value {
return Global.Call("Player", entity)
}
func Print(arg ...interface{}) {
Global.Get("console").Call("log", arg...)
}