Game Events

From Garry's Mod
Jump to: navigation, search

This page contains a collection of gameevents and their data values you can listen to using gameevent.Listen.

NOTE

Some events may not be called on client in singleplayer!

Validation required.
This page contains possibly incorrect or incomplete information. Further testing is required.

The first 3 notes are probably incorrect
Event Description Data Values

 player_connect

Called when a player connects to the server.
NOTE

This is only called clientside for the listen server host and in single-player.

number bot - 0 if the player isn't a bot, 1 if they are.

string networkid - The SteamID the player has. Will be "BOT" for bots and "STEAM_0:0:0" in single-player.
string name - The name the player has.
number userid - The UserID the player has.
number index - The entity index of the player, minus one.
string 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.

number bot - 0 if the player isn't a bot, 1 if they are.

string networkid - The SteamID the player has. Will be "BOT" for bots and "STEAM_0:0:0" in single-player.
string name - The name the player has.
number userid - The UserID the player has.
number index - The entity index of the player, minus one.

 player_disconnect

Called when a player disconnects from the server.
NOTE

This is not called clientside for the local player or in single-player.

number bot - 0 if the player isn't a bot, 1 if they are.

string networkid - The SteamID the player had. Will be "BOT" for bots and "STEAM_0:0:0" in single-player.
string name - The name the player had.
number userid - The UserID the player had.
string reason - Reason for disconnecting.

 player_spawn

Called when a player spawns. number userid - The UserID of the player.

 player_hurt

Called when the player takes damage. number health - The new health after being damaged.

number priority - [Server-only] Event priority number used by HLTV.
number userid - UserID of the victim.
number attacker - UserID of the attacker.

 player_say

Called when a player sends a chat message. number priority - [Server-only] Event priority number used by HLTV.

number userid - UserID of the player.
string text - The text that was said.

 player_activate

Called when the game is loaded in single-player. number userid - The UserID of the player.

 player_changename

Called when a player changes their Steam name. number userid - The UserID of the player.

string oldname - Name before change.
string newname - Name after change.

 player_info

Called when a player's info has changed over the network. number friendsid - The Player:AccountID of the player.

number index - An internal index used for storing player data in a string table (the entity index, minus one).
number bot - 1 or 0 if it is a bot or not.
string networkid - SteamID of the connected player.
string name - Name of the connected player.
number userid - UserID of the connected player.

 server_cvar

Called when a convar with FCVAR_NOTIFY is changed on the server. string cvarname - The convar name. e.g "sv_cheats"

string 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. string entindex - The entity index of broken prop

number userid - UserID of the connected player.

 break_breakable

Called when a func_break is broken by a player. string entindex - The entity index of broken prop

number material - Material index of broken entity
number userid - UserID of the connected player.

 flare_ignite_npc

Called when a flare sets an NPC on fire. string entindex - The entity index of ignited NPC

 entity_killed

Called when an entity dies. number entindex_inflictor - Entity Index of the inflictor.

number entindex_attacker - Entity Index of the attacker.
number damagebits - Some kinda flags. Perhaps related to damageinfotype?
number entindex_killed - Entity Index of the victim.

Personal tools
Navigation