This repository was archived by the owner on Aug 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Player com
tbeck edited this page Sep 18, 2023
·
1 revision
Learn how to communicate with one or more players
Send an event to a single client, either using
event.EmitClient(player, "event_name", "arg1", "arg2", "arg3")or
player.Emit("event_name", "arg1", "arg2", "arg3")Sending events to multiple players
event.EmitClients([]entity.Player{player1, player2}, "event_name", "arg1", "arg2", "arg3")Emitting events to all players connected
event.EmitAllClients("event_name", "arg1", "arg2", "arg3")Listening to a specific event
event.On.ClientEvent("event_name", func (p entity.Player, arg1, arg2, arg3 string) {
fmt.Printf("player %s called event", p.Name())
})Listening to all events to catch cheaters for example
event.On.AllClientEvents(func (p entity.Player, eventName, arg1, arg2, arg3 string) {
if eventName != "trusted" {
p.Kick("suspicious event call")
}
})You encountered a problem 💥? Check out the Troubleshooting Guide!
If you can't find a solution there file a new issue in this repository or contact me on Discord.