- Documentation
- Server events
Server events
Events triggered on the server. Handle them with addEventHandler in a server script.
Accounts 3
Chat and console 6
onA message is going to chat (from a player or a script). You can hold it back.Chat Message onSomeone typed text in a console: a player in the game console (F8) or an admin in the server console.Console onA debug message appeared (an error, a warning orDebug Message outputDebugString). Useful for collecting script errors in one place.onA player wrote a chat message (a normal one orPlayer Chat /me). You can block it, e.g. to send your own formatted one.onA player typed a command (beforePlayer Command addCommandHandlerruns it). You can block it.onA player sent a private message to another player.Player Private Message
Collision shapes 4
Elements 7
onAn element's data changed (Element Data Change setElementDataorremoveElementData), also from a client.onAn element is about to be destroyed (it still exists).Element Destroy onAn element moved to another dimension.Element Dimension Change onAn element moved to another interior.Element Interior Change onAn element's model changed (e.g. a player's skin or a car model).Element Model Change onA player started computing a vehicle's or object's physics (became its syncer).Element Start Sync onA player stopped computing an element's physics.Element Stop Sync
Fire 3
Input and controls 2
Markers 4
Objects 4
onA game map object was damaged (e.g. a broken-off hydrant).Map Object Break onA player moved a game map object (e.g. a hydrant or a barrel), not a script-created object.Map Object Move onA script-created object was destroyed in the game (e.g. a smashed fence). An explosive barrel also explodes for everyone.Object Break onAn object returned to its place and is repaired (Object Respawn respawnObject).
Peds 2
Pickups 5
onA player walked into a pickup. You can block the pickup.Pickup Hit onA pickup appeared again after its respawn time.Pickup Spawn onA player picked up a pickup (got health, armour or a weapon).Pickup Use onA player walked into a pickup (the version from the player side).Player Pickup Hit onA player picked up a pickup (the version from the player side).Player Pickup Use
Players 27
onArrives right afterPlayer ACInfo onPlayerJoinwith information about the player's game modifications. The detected list is empty because the client does not detect them yet.onA player changed their nick (e.g.Player Change Nick setPlayerName).onA client script tried to change a protected element data key: a key set by the server withPlayer Changes Protected Data setElementData(..., "deny"), or any key whenserver-config.jsonhas"element_data_client_changes": "deny". The change is rejected and the player gets the server value back.onA player is connecting to the server, before their element is created. You can reject the connection, e.g. because of the nick or a ban.Player Connect onThe element under the player's feet changed (a vehicle or an object they stand on).Player Contact onA player took damage: from a weapon, a fall, a vehicle or an explosion. For a grenade or rocket explosionPlayer Damage attackeris the player who caused it.onA player joined the server. A good place for a greeting, login and the first spawn.Player Join onArrives afterPlayer Mod Info onPlayerACInfo, only when the client found files that are not part of the game in its folder:.pak/.utoc/.ucaspackages inContent/Paksother thanpakchunk0andpakchunk1, or.asiplugins. You can kick the player based on it.onA player was muted (Player Mute setPlayerMuted). A muted player cannot chat.onThe player's connection stalled (statusPlayer Network Status 0, no data for over 12 seconds) or came back (1).onA player left the server. The player element still exists, so you can save their data. Reasons are in Polish, e.g.Player Quit "rozlaczony"(disconnected) or"przekroczony czas oczekiwania"(timed out).onThe player has loaded the game and appeared in the world for the first time. A good place for a welcome, because the player can already see the screen.Player Ready onA resource started on a player's client (after theirPlayer Resource Start onClientResourceStart), once per resource start. From now on you can send themtriggerClientEventfrom this resource.onThe result ofPlayer Screen Shot takePlayerScreenShotarrives: a JPEG of the player's game frame (without the script overlay) or information that it failed.onA player appeared in the world (the first time or after death), e.g. afterPlayer Spawn spawnPlayer.onA player kills someone silently with a knife from behind. You can block the kill; otherwise the victim getsPlayer Stealth Kill onPlayerWastedwithstealth=true.onA player moved in a way that is impossible in the game (a teleport or too high a speed). Script teleports, spawns and interior entries do not count. It only works when the server config hasPlayer Suspicious Move "anticheat": true. The server itself undoes nothing and kicks nobody; the script decides the punishment (automatic kicking after a threshold is enabled with"anticheat_kick": true).onA player aims at something else: a player, a ped, an object, a vehicle or nothing. Checked every 250 ms.Player Target onA player changed team (Player Team Change setPlayerTeam).onA player sends too many events and actions (over 100 per second). It may be a client script bug or a flooding attempt.Player Trigger Event Threshold onA player triggered an event the server does not know or that does not allow client calls (Player Trigger Invalid Event addEvent(name, true)).onA player was unmuted.Player Unmute onA player started talking through voice chat (start of an utterance). You can block it: then nobody hears this utterance until the player stops talking.Player Voice Start onA player stopped talking through voice chat. It also happens when the player's voice stopped arriving (e.g. a lost connection). It does not happen for an utterance blocked inPlayer Voice Stop onPlayerVoiceStart.onA player died: from a weapon, in an accident, an explosion or by a script.Player Wasted onA player's GPS waypoint disappeared: removed on the map, by a script or the player reached it.Player Waypoint Remove onA player has a new game GPS waypoint (confirmed by their game): placed with a right click on the ESC map or by a script.Player Waypoint Set
Projectiles 1
Resources 6
onWhile the server runs, a new resource folder appeared (Resource Load State Change unloaded->loaded) or disappeared (loaded->unloaded).onA resource is about to start. You can hold the start.Resource Pre Start onA resource started. Attached toResource Start resourceRootit only arrives for your own resource, torootfor every resource.onA resource changed state:Resource State Change loaded->starting->running->stopping->loaded.onA resource is stopping. A good place to save data.Resource Stop onA resource setting changed (Setting Change setor the admin panel).
Vehicles 13
onAnother name forPlayer Enter Vehicle onPlayerVehicleEnter: a player got into a vehicle.onAnother name forPlayer Exit Vehicle onPlayerVehicleExit: a player got out of a vehicle.onA player got into a vehicle.Player Vehicle Enter onA player got out of a vehicle (by themselves, jacked or by a script).Player Vehicle Exit onA trailer was attached to a vehicle.Trailer Attach onA trailer was detached.Trailer Detach onA vehicle lost health (reported by its driver's or owner's game).Vehicle Damage onSomeone got into a vehicle (the version seen from the vehicle side).Vehicle Enter onSomeone got out of a vehicle (the version seen from the vehicle side).Vehicle Exit onA vehicle exploded.Vehicle Explode onA vehicle respawned (Vehicle Respawn respawnVehicleor automatically).onA player starts getting into a vehicle (walks to the door). You can stop them, e.g. at a locked faction car.Vehicle Start Enter onA player starts getting out (about 2 seconds beforeVehicle Start Exit onVehicleExit); when jacked,jackeris the one pulling them out. You can keep them in the car.
Weapons 2
onA player fired a firearm. It arrives once per bullet, with the point the shot came from and the point it hit (a wall, the ground, a ped or the end of the range). The game reports shots only while some resource listens to this event, so it costs nothing without a listener.Player Weapon Fire onA script weapon (Weapon Fire createWeapon) fired withfireWeapon.