Garry's Mod Wiki

Revision Difference

Game_Events#526498

<cat>Dev.Lua</cat> 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> Event | Description | Data Values | ------|-------------|------------| | player_connect | Called when a player connects to the server.<br/><note>This is only called clientside for the listen server host and 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 <page text="name">Player:Nick</page> the player has.<br/><br/><br/><page>number</page> **userid** - The <page text="UserID">Player:UserID</page> the player has.<br/><br/><br/><page>number</page> **index** - The <page text="entity index">Entity:EntIndex</page> of the player, minus one.<br/><br/><br/> <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.<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 <page text="name">Player:Nick</page> the player has.<br/><br/><br/><page>number</page> **userid** - The <page text="UserID">Player:UserID</page> the player has.<br/><br/><br/><page>number</page> **index** - The <page text="entity index">Entity:EntIndex</page> 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 <page text="name">Player:Nick</page> the player had.<br/><br/><br/><page>number</page> **userid** - The <page text="UserID">Player:UserID</page> 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 <page text="UserID">Player:UserID</page> 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 <page text="entity index">Entity:EntIndex</page>, 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. |