2016-09-13 13:24:32 +00:00
=========
Callbacks
=========
2016-09-17 16:57:29 +00:00
**Callbacks** trigger on specific server events.
2016-09-13 13:24:32 +00:00
qagame execution
================
et_InitGame( levelTime, randomSeed, restart )
---------------------------------------------
Called when qagame initializes.
2016-09-17 16:57:29 +00:00
* **levelTime** is the current level time in milliseconds.
* **randomSeed** is a number that can be used to seed random number generators.
* **restart** indicates if et_InitGame() is being called due to a `map_restart` (1) or not (0).
2016-09-13 13:24:32 +00:00
et_ShutdownGame( restart )
--------------------------
Called when qagame shuts down.
2016-09-17 16:57:29 +00:00
* **restart** indicates if the shutdown is being called due to a `map_restart` (1) or not (0).
2016-09-13 13:24:32 +00:00
et_RunFrame( levelTime )
------------------------
Called when qagame runs a server frame.
2016-09-17 16:57:29 +00:00
* **levelTime** is the current level time in milliseconds.
2016-09-13 13:24:32 +00:00
et_Quit()
---------
Called when Legacy unloads the mod.
The mod should close all open filedescriptors and perform all cleanup.
Client management
=================
rejectreason = et_ClientConnect( clientNum, firstTime, isBot )
--------------------------------------------------------------
Called when a client attempts to connect to the server.
2016-09-17 16:57:29 +00:00
* **clientNum** is the client slot id.
* **firstTime** indicates if this is a new connection (1) or a reconnection (0).
* **isBot** indicates if the client is a bot (1) or not (0).
2016-09-13 13:24:32 +00:00
2016-09-17 16:57:29 +00:00
If the mod accepts the connection, it returns **nil** . Otherwise, the mod should return a string describing the reason the client connection was rejected.
2016-09-13 13:24:32 +00:00
et_ClientDisconnect( clientNum )
--------------------------------
Called when a client disconnects.
2016-09-17 16:57:29 +00:00
* **clientNum** is the client slot id.
2016-09-13 13:24:32 +00:00
et_ClientBegin( clientNum )
---------------------------
Called when a client begins (becomes active, and enters the gameworld).
2016-09-17 16:57:29 +00:00
* **clientNum** is the client slot id.
2016-09-13 13:24:32 +00:00
et_ClientUserinfoChanged( clientNum )
-------------------------------------
Called when a client's Userinfo string has changed.
2016-09-17 16:57:29 +00:00
* **clientNum** is the client slot id.
2016-09-13 13:24:32 +00:00
2016-09-17 16:57:29 +00:00
.. note :: This only gets called when the players `CS_PLAYERS` config string changes, rather than every time the userinfo changes. This only happens for a subset of userinfo fields.
2016-09-13 13:24:32 +00:00
et_ClientSpawn( clientNum, revived, teamChange, restoreHealth )
---------------------------------------------------------------
Called when a client is spawned.
2016-09-17 16:57:29 +00:00
* **clientNum** is the client slot id.
* **revived** indicates if the client was spawned by being revived (1) or not (0).
* **teamChange** indicates if the client changed team (1) or not (0).
* **restoreHealth** indicates if the player health bar is fully restored (1) or not (0).
2016-09-13 13:24:32 +00:00
Commands
========
intercepted = et_ClientCommand( clientNum, command )
----------------------------------------------------
Called when a command is received from a client.
2016-09-17 16:57:29 +00:00
* **clientNum** is the client slot id.
* **command** is the command.
2016-09-13 13:24:32 +00:00
2016-09-14 00:33:09 +00:00
Returns 1 if the command was intercepted by the mod, and 0 if the command was ignored and passed through to the server (and other mods in the chain).
2016-09-13 13:24:32 +00:00
.. tip :: The actual command can be accessed through the argument handling functions, as seen in the `Sample Code <sample.html> `__ .
intercepted = et_ConsoleCommand()
---------------------------------
Called when a command is entered on the server console.
2016-09-14 00:33:09 +00:00
Returns 1 if the command was intercepted, and 0 if the command was ignored and passed through to the server (and other mods in the chain).
2016-09-13 13:24:32 +00:00
.. tip :: The actual command can be accessed through the argument handling functions, as seen in the `Sample Code <sample.html> `__ .
XP
==
et_UpgradeSkill( clientNum, skill )
2016-09-14 00:33:09 +00:00
-----------------------------------
2016-09-13 13:24:32 +00:00
Called when a client gets a skill upgrade.
2016-09-17 16:57:29 +00:00
* **clientNum** is the client slot.
* **skill** is the skill number.
2016-09-13 13:24:32 +00:00
2016-09-14 00:33:09 +00:00
Returns -1 to override (abort) the qagame function, anything else to "passthrough". Callback may modify skills (or do anything else it wants) during passthrough.
2016-09-13 13:24:32 +00:00
et_SetPlayerSkill( clientNum, skill )
2016-09-14 00:33:09 +00:00
-------------------------------------
2016-09-13 13:24:32 +00:00
Called when a client skill is set.
2016-09-17 16:57:29 +00:00
* **clientNum** is the client slot.
* **skill** is the skill number.
2016-09-13 13:24:32 +00:00
2016-09-14 00:33:09 +00:00
Returns -1 to override (abort) the qagame function, anything else to "passthrough". Callback may modify skills (or do anything else it wants) during passthrough.
2016-09-13 13:24:32 +00:00
Miscellaneous
=============
et_Print( text )
----------------
Called whenever the server or qagame prints a string to the console.
2016-09-14 00:33:09 +00:00
.. warning :: **DO NOT TRUST STRINGS OBTAINED IN THIS WAY!**
2016-09-13 13:24:32 +00:00
2016-09-14 00:33:09 +00:00
Text may contain a player name and their chat message, which makes it very easy to spoof.
2016-09-13 13:24:32 +00:00
et_Obituary( target, attacker, meansOfDeath )
2016-09-14 00:33:09 +00:00
---------------------------------------------
2016-09-13 13:24:32 +00:00
Called whenever a player is killed.
2016-09-17 16:57:29 +00:00
* **target** is the victim.
* **attacker** is the killer.
* **meansOfDeath** is the means of death.
2016-09-13 13:24:32 +00:00
2016-09-14 00:33:09 +00:00
et_Damage( target, attacker, damage, damageFlags, meansOfDeath)
---------------------------------------------------------------
2016-09-13 13:24:32 +00:00
Called whenever a player gets damage.
2016-09-17 16:57:29 +00:00
* **target** is the victim.
* **attacker** is the killer.
* **damage** is the amount of damage.
* **damageFlags** controls how damage is inflicted. See `Damage bitflags <misc.html#damage-bitflags> `__ for possible values.
* **meansOfDeath** is the means of death. See `et.MOD_* constants <constants.html#mod-constants> `__ for possible values.
2016-09-13 13:24:32 +00:00
2019-04-14 10:32:18 +00:00
et_WeaponFire( clientNum, weapon )
----------------------------------
Called whenever a weapon is shot.
* **clientNum** is the client slot.
* **weapon** is the weapon shot.
2019-05-18 16:58:44 +00:00
Returns 1 to override (abort) the qagame function, 0 to "passthrough". Callback may do anything it wants during passthrough.
2019-04-14 10:32:18 +00:00
2019-05-18 15:05:28 +00:00
et_FixedMGFire( clientNum )
2019-05-18 14:49:32 +00:00
---------------------------------
Called whenever a fixed machine gun is shot.
* **clientNum** is the client slot.
2019-05-18 16:58:44 +00:00
Returns 1 to override (abort) the qagame function, 0 to "passthrough". Callback may do anything it wants during passthrough.
2019-05-18 14:49:32 +00:00
2019-05-18 15:05:28 +00:00
et_MountedMGFire( clientNum )
2019-05-18 14:49:32 +00:00
-----------------------------------
Called whenever a mounted machine gun is shot.
* **clientNum** is the client slot.
2019-05-18 16:58:44 +00:00
Returns 1 to override (abort) the qagame function, 0 to "passthrough". Callback may do anything it wants during passthrough.
2019-05-18 14:49:32 +00:00
2019-05-18 15:05:28 +00:00
et_AAGunFire( clientNum )
2019-05-18 14:49:32 +00:00
-------------------------------
Called whenever an anti-aircraft gun is shot.
* **clientNum** is the client slot.
2019-05-18 16:58:44 +00:00
Returns 1 to override (abort) the qagame function, 0 to "passthrough". Callback may do anything it wants during passthrough.
2019-05-18 14:49:32 +00:00
2016-09-13 13:24:32 +00:00
et_SpawnEntitiesFromString()
----------------------------
Called when an entity definition is parsed to spawn gentities.