Revision Difference
Game_Events#517002
This page contains a collection of gameevents and their data values you can listen to using <page>gameevent.Listen</page>.
<note>Some events may not be called on client in singleplayer!</note>
<validate>The first 3 notes are probably incorrect</validate>⤶
<validate>The first 3 notes are probably incorrect}}⤶
⤶
{</validate>⤶
|<page>number</page> **bot** - 0 if the player isn't a bot, 1 if they are.⤶
⤶
⤶
<page>string</page> **networkid** - The SteamID the player has. Will be "BOT" for bots and "STEAM_0:0:0" in single-player.⤶
⤶
⤶
<page>string</page> **name** - The [name](/gmod/Player/Nick) the player has.⤶
⤶
⤶
<page>number</page> **userid** - The [UserID](/gmod/Player/UserID) the player has.⤶
⤶
⤶
<page>number</page> **index** - The [entity index](/gmod/Entity/EntIndex) of the player, minus one.⤶
⤶
⤶
<page>string</page> **address** - IP of the connected player. Will be "none" for bots and "loopback" for listen server and single-player hosts.⤶
⤶
⤶
|-⤶
|player_connect_client⤶
|Called when a player connects to the server.⤶
<note>This is not called clientside for the local player or in single-player.</note>⤶
|<page>number</page> **bot** - 0 if the player isn't a bot, 1 if they are.⤶
⤶
⤶
<page>string</page> **networkid** - The SteamID the player has. Will be "BOT" for bots and "STEAM_0:0:0" in single-player.⤶
⤶
⤶
<page>string</page> **name** - The [name](/gmod/Player/Nick) the player has.⤶
⤶
⤶
<page>number</page> **userid** - The [UserID](/gmod/Player/UserID) the player has.⤶
⤶
⤶
<page>number</page> **index** - The [entity index](/gmod/Entity/EntIndex) of the player, minus one.⤶
⤶
⤶
|-⤶
|player_disconnect⤶
|Called when a player disconnects from the server.⤶
<note>This is also called when a player **cancels** connecting to the server.</note>⤶
<note>This is not called clientside for the local player or in single-player.</note>⤶
|<page>number</page> **bot** - 0 if the player isn't a bot, 1 if they are.⤶
⤶
⤶
<page>string</page> **networkid** - The SteamID the player had. Will be "BOT" for bots and "STEAM_0:0:0" in single-player.⤶
⤶
⤶
<page>string</page> **name** - The [name](/gmod/Player/Nick) the player had.⤶
⤶
⤶
<page>number</page> **userid** - The [UserID](/gmod/Player/UserID) the player had.⤶
⤶
⤶
<page>string</page> **reason** - Reason for disconnecting.⤶
⤶
⤶
|-⤶
|player_spawn⤶
|Called when a player spawns.⤶
|<page>number</page> **userid** - The [UserID](/gmod/Player/UserID) of the player.⤶
|-⤶
|player_hurt⤶
|Called when the player takes damage.⤶
|<page>number</page> **health** - The new health after being damaged.⤶
⤶
⤶
<page>number</page> **priority** - **[Server-only]** Event priority number used by HLTV.⤶
⤶
⤶
<page>number</page> **userid** - UserID of the victim.⤶
⤶
⤶
<page>number</page> **attacker** - UserID of the attacker.⤶
|-⤶
|player_say⤶
|Called when a player sends a chat message.⤶
|<page>number</page> **priority** - **[Server-only]** Event priority number used by HLTV.⤶
⤶
⤶
<page>number</page> **userid** - UserID of the player.⤶
⤶
⤶
<page>string</page> **text** - The text that was said.⤶
|-⤶
|player_activate⤶
|Called when the game is loaded in single-player.⤶
|<page>number</page> **userid** - The UserID of the player.⤶
|-⤶
|player_changename⤶
|Called when a player changes their Steam name.⤶
|<page>number</page> **userid** - The UserID of the player.⤶
⤶
⤶
<page>string</page> **oldname** - Name before change.⤶
⤶
⤶
<page>string</page> **newname** - Name after change.⤶
⤶
⤶
|-⤶
|player_info⤶
|Called when a player's info has changed over the network.⤶
|<page>number</page> **friendsid** - The <page>Player:AccountID of the player.</page>⤶
⤶
⤶
<page>number</page> **index** - An internal index used for storing player data in a string table (the [entity index](/gmod/Entity/EntIndex), minus one).⤶
⤶
⤶
<page>number</page> **bot** - 1 or 0 if it is a bot or not.⤶
⤶
⤶
<page>string</page> **networkid** - SteamID of the connected player.⤶
⤶
⤶
<page>string</page> **name** - Name of the connected player.⤶
⤶
⤶
<page>number</page> **userid** - UserID of the connected player.⤶
|-⤶
|server_cvar⤶
|Called when a convar with FCVAR_NOTIFY is changed on the server.⤶
|<page>string</page> **cvarname** - The convar name. e.g "sv_cheats"⤶
⤶
⤶
<page>string</page> **cvarvalue** - The new value. Always a string. e.g "1"⤶
|-⤶
|break_prop⤶
|Called when a prop_dynamic or prop_physics is broken by a player.⤶
|<page>string</page> **entindex** - The entity index of broken prop⤶
⤶
⤶
<page>number</page> **userid** - UserID of the connected player.⤶
|-⤶
|break_breakable⤶
|Called when a func_break is broken by a player.⤶
|<page>string</page> **entindex** - The entity index of broken prop⤶
⤶
⤶
<page>number</page> **material** - Material index of broken entity⤶
⤶
⤶
<page>number</page> **userid** - UserID of the connected player.⤶
|-⤶
|flare_ignite_npc⤶
|Called when a flare sets an NPC on fire.⤶
|<page>string</page> **entindex** - The entity index of ignited NPC⤶
|-⤶
|entity_killed⤶
|Called when an entity dies.⤶
<note>This is not called when a player dies using <page>Player:KillSilent</page>.</note>⤶
|<page>number</page> **entindex_inflictor** - Entity Index of the inflictor.⤶
⤶
⤶
<page>number</page> **entindex_attacker** - Entity Index of the attacker.⤶
⤶
Event | Description | Data Values |⤶
------|-------------|------------|⤶
| player_connect_client | Called when a player connects to the server.<br/><note>This is not called clientside for the local player or in single-player.</note> | <page>number</page> **bot** - 0 if the player isn't a bot, 1 if they are.<br/><br/><br/><page>string</page> **networkid** - The SteamID the player has. Will be "BOT" for bots and "STEAM_0:0:0" in single-player.<br/><br/><br/><page>string</page> **name** - The [name](/gmod/Player/Nick) the player has.<br/><br/><br/><page>number</page> **userid** - The [UserID](/gmod/Player/UserID) the player has.<br/><br/><br/><page>number</page> **index** - The [entity index](/gmod/Entity/EntIndex) of the player, minus one. |⤶
| player_disconnect | Called when a player disconnects from the server.<br/><note>This is also called when a player **cancels** connecting to the server.</note><br/><note>This is not called clientside for the local player or in single-player.</note> | <page>number</page> **bot** - 0 if the player isn't a bot, 1 if they are.<br/><br/><br/><page>string</page> **networkid** - The SteamID the player had. Will be "BOT" for bots and "STEAM_0:0:0" in single-player.<br/><br/><br/><page>string</page> **name** - The [name](/gmod/Player/Nick) the player had.<br/><br/><br/><page>number</page> **userid** - The [UserID](/gmod/Player/UserID) the player had.<br/><br/><br/><page>string</page> **reason** - Reason for disconnecting. |⤶
| player_spawn | Called when a player spawns. | <page>number</page> **userid** - The [UserID](/gmod/Player/UserID) of the player. |⤶
| player_hurt | Called when the player takes damage. | <page>number</page> **health** - The new health after being damaged.<br/><br/><br/><page>number</page> **priority** - **[Server-only]** Event priority number used by HLTV.<br/><br/><br/><page>number</page> **userid** - UserID of the victim.<br/><br/><br/><page>number</page> **attacker** - UserID of the attacker. |⤶
| player_say | Called when a player sends a chat message. | <page>number</page> **priority** - **[Server-only]** Event priority number used by HLTV.<br/><br/><br/><page>number</page> **userid** - UserID of the player.<br/><br/><br/><page>string</page> **text** - The text that was said. |⤶
| player_activate | Called when the game is loaded in single-player. | <page>number</page> **userid** - The UserID of the player. |⤶
| player_changename | Called when a player changes their Steam name. | <page>number</page> **userid** - The UserID of the player.<br/><br/><br/><page>string</page> **oldname** - Name before change.<br/><br/><br/><page>string</page> **newname** - Name after change. |⤶
| player_info | Called when a player's info has changed over the network. | <page>number</page> **friendsid** - The <page>Player:AccountID of the player.</page><br/><br/><br/><page>number</page> **index** - An internal index used for storing player data in a string table (the [entity index](/gmod/Entity/EntIndex), minus one).<br/><br/><br/><page>number</page> **bot** - 1 or 0 if it is a bot or not.<br/><br/><br/><page>string</page> **networkid** - SteamID of the connected player.<br/><br/><br/><page>string</page> **name** - Name of the connected player.<br/><br/><br/><page>number</page> **userid** - UserID of the connected player. |⤶
| server_cvar | Called when a convar with FCVAR_NOTIFY is changed on the server. | <page>string</page> **cvarname** - The convar name. e.g "sv_cheats"<br/><br/><br/><page>string</page> **cvarvalue** - The new value. Always a string. e.g "1" |⤶
| break_prop | Called when a prop_dynamic or prop_physics is broken by a player. | <page>string</page> **entindex** - The entity index of broken prop<br/><br/><br/><page>number</page> **userid** - UserID of the connected player. |⤶
| break_breakable | Called when a func_break is broken by a player. | <page>string</page> **entindex** - The entity index of broken prop<br/><br/><br/><page>number</page> **material** - Material index of broken entity<br/><br/><br/><page>number</page> **userid** - UserID of the connected player. |⤶
| flare_ignite_npc | Called when a flare sets an NPC on fire. | <page>string</page> **entindex** - The entity index of ignited NPC |⤶
| entity_killed | Called when an entity dies.<br/><note>This is not called when a player dies using <page>Player:KillSilent</page>.</note> | <page>number</page> **entindex_inflictor** - Entity Index of the inflictor.<br/><br/><br/><page>number</page> **entindex_attacker** - Entity Index of the attacker.<br/><br/><br/><page>number</page> **damagebits** - Some kinda flags. Perhaps related to damageinfotype?<br/><br/><br/><page>number</page> **entindex_killed** - Entity Index of the victim. |⤶
<page>number</page> **damagebits** - Some kinda flags. Perhaps related to damageinfotype?⤶
<page>number</page> **entindex_killed** - Entity Index of the victim.⤶
|}⤶