Garry's Mod Wiki

Revision Difference

Game_Events#548578

<cat>Dev</cat> This page contains a collection of gameevents and their data values you can listen to using <page>gameevent.Listen</page>. The list is as follows: <pagelist category="gameevent"></pagelist> <pagelist category="gameevent"></pagelist> <warning>Content below is in the process of being moved to separate pages, which are linked above.</warning> <note>Some events may not be called on client in singleplayer! `player_hurt` event may give remaining health value as unsigned 8 bit value when triggered on client realm.</note> Event | Description | Data Values | ------|-------------|------------| | player_connect | Called when a player connects to the server.<br/>**This is only called serverside and clientside for the listen server host** | <page>number</page> **bot** - 0 if the player isn't a bot, 1 if they are.<br/><page>string</page> **networkid** - The SteamID the player has. Will be "BOT" for bots and "STEAM_0:0:0" in single-player.<br/><page>string</page> **name** - The <page text="name">Player:Nick</page> the player has.<br/><page>number</page> **userid** - The <page text="UserID">Player:UserID</page> the player has.<br/><page>number</page> **index** - The <page text="entity index">Entity:EntIndex</page> of the player, minus one.<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/>**This is not called clientside for the local player or in single-player.** | <page>number</page> **bot** - 0 if the player isn't a bot, 1 if they are.<br/><page>string</page> **networkid** - The SteamID the player has. Will be "BOT" for bots and "STEAM_0:0:0" in single-player.<br/><page>string</page> **name** - The <page text="name">Player:Nick</page> the player has.<br/><page>number</page> **userid** - The <page text="UserID">Player:UserID</page> the player has.<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/>**This is also called when a player **cancels** connecting to the server.**<br/>**This is not called clientside for the local player or in single-player.** | <page>number</page> **bot** - 0 if the player isn't a bot, 1 if they are.<br/><page>string</page> **networkid** - The SteamID the player had. Will be "BOT" for bots and "STEAM_0:0:0" in single-player.<br/><page>string</page> **name** - The <page text="name">Player:Nick</page> the player had.<br/><page>number</page> **userid** - The <page text="UserID">Player:UserID</page> the player had.<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/><page>number</page> **priority** - **[Server-only]** Event priority number used by HLTV.<br/><page>number</page> **userid** - UserID of the victim.<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/><page>number</page> **userid** - UserID of the player.<br/><page>string</page> **text** - The text that was said. | | player_activate | Called when a player has entered the game (connected and loaded). From this point you can use <page>Global.Player</page>(userid) (serverside or in singleplayer) | <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/><page>string</page> **oldname** - Name before change.<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 text="AccountID">Player:AccountID</page> of the player.<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/><page>number</page> **bot** - 1 or 0 if it is a bot or not.<br/><page>string</page> **networkid** - SteamID of the connected player.<br/><page>string</page> **name** - Name of the connected player.<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/><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/><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/><page>number</page> **material** - Material index of broken entity<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 | | ragdoll_dissolved | Called when a Ragdoll is going to be Dissolved. | <page>string</page> **entindex** - The entity index of disolved Ragdoll | | entity_killed | Called when an entity dies.<br/>**This is not called when a player dies using <page>Player:KillSilent</page>.** | <page>number</page> **entindex_inflictor** - Entity Index of the inflictor.<br/><page>number</page> **entindex_attacker** - Entity Index of the attacker.<br/><page>number</page> **damagebits** - Damage type(s), a combination of <page>Enums/DMG</page><br/><page>number</page> **entindex_killed** - Entity Index of the victim. | | OnRequestFullUpdate | Called Serverside when a player requests a full update from server.<br/>Called Clientside when the Update is received<br/>When this event is called <page>net</page> messages will be reliably received by the client. | <page>string</page> **networkid** - The SteamID the player has. Will be "BOT" for bots and "STEAM_0:0:0" in single-player.<br/><page>string</page> **name** - The <page text="name">Player:Nick</page> the player has.<br/><page>number</page> **userid** - The <page text="UserID">Player:UserID</page> the player has.<br/><page>number</page> **index** - The <page text="entity index">Entity:EntIndex</page> of the player, minus one. | | achievement_earned | Called when a player earns an achievement. | <page>number</page> achievement - The achievement ID. <br/> <page>number</page> The UserID of the player. | | achievement_event | Called when a player makes progress on an achievement. <br/> **Only called clientside for the player.** | <page>string</page> achievement_name - the name of the achievement. <br/> <page>number</page> The UserID of the player.<br/> <page>number</page> cur_val - amount of steps toward achievement <br/> <page>number</page> max_val - total amount of steps in achievement | client_disconnect | Called when the client is disconnecting from the server. <br/> **Only called clientside for the player.** | <page>string</page> message - The disconnecting reason. Can be an empty String | | server_addban | Called when a Player is banned using <page>Player:Ban</page>, **banip** or the **banid** command. | <page>string</page> name - player name. <br/> <page>number</page> userid - The UserID of the player. <br/> <page>string</page> networkid - SteamID of the banned player. <br/> <page>string</page> ip - The IP of the banned player <br/> <page>string</page> duration - The Duration of the Ban (in minutes). <br/> <page>string</page> by - The Person who Banned the Player or Console. <br/> <page>boolean</page> kicked - whether the player was also kicked | server_removeban | Called when a Player is unbanned using the removeid or removeip command. <br/> **If the player was banned with <page>Player:Ban</page> or banid the ip will be an empty string.** <br/> **If the player was banned with banip the networkid will be an empty string.** | <page>string</page> networkid - The SteamID of the Banned player. <br/> <page>string</page> ip - The IP of the banned Player. <br/> <page>string</page> by - The Person who unbanned the Player.