@tlua/gmod 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/__metadata.json +4 -0
- package/_globals.d.tlua +178 -0
- package/_gmod-std.d.tlua +35 -0
- package/achievementicon.d.tlua +12 -0
- package/achievements.d.tlua +162 -0
- package/ai.d.tlua +65 -0
- package/ai_schedule.d.tlua +17 -0
- package/ai_task.d.tlua +17 -0
- package/angle.d.tlua +197 -0
- package/avatarimage.d.tlua +10 -0
- package/awesomium.d.tlua +14 -0
- package/baseclass.d.tlua +42 -0
- package/bf_read.d.tlua +110 -0
- package/bit.d.tlua +121 -0
- package/button.d.tlua +13 -0
- package/cam.d.tlua +220 -0
- package/ceffectdata.d.tlua +337 -0
- package/chat.d.tlua +62 -0
- package/checkbutton.d.tlua +14 -0
- package/cleanup.d.tlua +88 -0
- package/cluaemitter.d.tlua +119 -0
- package/clualocomotion.d.tlua +383 -0
- package/cluaparticle.d.tlua +426 -0
- package/cmovedata.d.tlua +476 -0
- package/cnavarea.d.tlua +845 -0
- package/cnavladder.d.tlua +209 -0
- package/cnewparticleeffect.d.tlua +259 -0
- package/color.d.tlua +339 -0
- package/concommand.d.tlua +69 -0
- package/constraint.d.tlua +311 -0
- package/construct.d.tlua +26 -0
- package/contentheader.d.tlua +32 -0
- package/contenticon.d.tlua +86 -0
- package/contentsidebar.d.tlua +45 -0
- package/contentsidebartoolbox.d.tlua +13 -0
- package/contextbase.d.tlua +37 -0
- package/controlpanel.d.tlua +140 -0
- package/controlpresets.d.tlua +118 -0
- package/convar.d.tlua +162 -0
- package/cookie.d.tlua +60 -0
- package/coroutine.d.tlua +90 -0
- package/crecipientfilter.d.tlua +152 -0
- package/csent.d.tlua +10 -0
- package/csoundpatch.d.tlua +150 -0
- package/ctakedamageinfo.d.tlua +366 -0
- package/ctrllistbox.d.tlua +12 -0
- package/ctrlnumpad.d.tlua +73 -0
- package/cusercmd.d.tlua +320 -0
- package/custom_classes.d.tlua +65 -0
- package/custom_entity_fields.d.tlua +96 -0
- package/cvars.d.tlua +80 -0
- package/dadjustablemodelpanel.d.tlua +81 -0
- package/dalphabar.d.tlua +27 -0
- package/dbinder.d.tlua +37 -0
- package/dbubblecontainer.d.tlua +18 -0
- package/dbutton.d.tlua +88 -0
- package/dcategoryheader.d.tlua +13 -0
- package/dcategorylist.d.tlua +11 -0
- package/dcheckbox.d.tlua +46 -0
- package/dcheckboxlabel.d.tlua +90 -0
- package/dcollapsiblecategory.d.tlua +240 -0
- package/dcolorbutton.d.tlua +73 -0
- package/dcolorcombo.d.tlua +54 -0
- package/dcolorcube.d.tlua +137 -0
- package/dcolormixer.d.tlua +303 -0
- package/dcolorpalette.d.tlua +294 -0
- package/dcolumnsheet.d.tlua +49 -0
- package/dcombobox.d.tlua +161 -0
- package/ddragbase.d.tlua +151 -0
- package/ddrawer.d.tlua +72 -0
- package/debug.d.tlua +236 -0
- package/debugoverlay.d.tlua +193 -0
- package/dentityproperties.d.tlua +63 -0
- package/derma.d.tlua +119 -0
- package/dexpandbutton.d.tlua +30 -0
- package/dfilebrowser.d.tlua +228 -0
- package/dform.d.tlua +176 -0
- package/dframe.d.tlua +261 -0
- package/dgrid.d.tlua +113 -0
- package/dhorizontaldivider.d.tlua +196 -0
- package/dhorizontalscroller.d.tlua +104 -0
- package/dhscrollbar.d.tlua +109 -0
- package/dhtml.d.tlua +91 -0
- package/dhtmlcontrols.d.tlua +62 -0
- package/diconbrowser.d.tlua +113 -0
- package/diconlayout.d.tlua +190 -0
- package/dimage.d.tlua +221 -0
- package/dimagebutton.d.tlua +103 -0
- package/dkillicon.d.tlua +9 -0
- package/dlabel.d.tlua +385 -0
- package/dlabeleditable.d.tlua +51 -0
- package/dlabelurl.d.tlua +100 -0
- package/dlistbox.d.tlua +82 -0
- package/dlistboxitem.d.tlua +42 -0
- package/dlistlayout.d.tlua +14 -0
- package/dlistview.d.tlua +360 -0
- package/dlistview_column.d.tlua +135 -0
- package/dlistview_columnplain.d.tlua +11 -0
- package/dlistview_draggerbar.d.tlua +11 -0
- package/dlistview_line.d.tlua +140 -0
- package/dlistviewheaderlabel.d.tlua +11 -0
- package/dlistviewlabel.d.tlua +11 -0
- package/dlistviewline.d.tlua +11 -0
- package/dmenu.d.tlua +266 -0
- package/dmenubar.d.tlua +42 -0
- package/dmenuoption.d.tlua +135 -0
- package/dmenuoptioncvar.d.tlua +64 -0
- package/dmodelpanel.d.tlua +207 -0
- package/dmodelselect.d.tlua +20 -0
- package/dmodelselectmulti.d.tlua +19 -0
- package/dnotify.d.tlua +93 -0
- package/dnumberscratch.d.tlua +284 -0
- package/dnumberwang.d.tlua +147 -0
- package/dnumpad.d.tlua +11 -0
- package/dnumslider.d.tlua +182 -0
- package/dpanel.d.tlua +152 -0
- package/dpanellist.d.tlua +109 -0
- package/dpaneloverlay.d.tlua +65 -0
- package/dpanelselect.d.tlua +13 -0
- package/dpanpanel.d.tlua +64 -0
- package/dprogress.d.tlua +27 -0
- package/dproperties.d.tlua +52 -0
- package/dproperty_boolean.d.tlua +12 -0
- package/dproperty_combo.d.tlua +31 -0
- package/dproperty_entity.d.tlua +12 -0
- package/dproperty_float.d.tlua +12 -0
- package/dproperty_generic.d.tlua +50 -0
- package/dproperty_int.d.tlua +12 -0
- package/dproperty_vectorcolor.d.tlua +14 -0
- package/dpropertysheet.d.tlua +167 -0
- package/dragndrop.d.tlua +123 -0
- package/draw.d.tlua +162 -0
- package/drgbpicker.d.tlua +49 -0
- package/drive.d.tlua +159 -0
- package/dscrollbargrip.d.tlua +13 -0
- package/dscrollpanel.d.tlua +110 -0
- package/dshape.d.tlua +72 -0
- package/dsizetocontents.d.tlua +46 -0
- package/dslider.d.tlua +302 -0
- package/dsprite.d.tlua +84 -0
- package/dtab.d.tlua +81 -0
- package/dtextentry.d.tlua +442 -0
- package/dtilelayout.d.tlua +218 -0
- package/dtooltip.d.tlua +76 -0
- package/dtree.d.tlua +185 -0
- package/dtree_node.d.tlua +793 -0
- package/dtree_node_button.d.tlua +13 -0
- package/duplicator.d.tlua +338 -0
- package/dverticaldivider.d.tlua +223 -0
- package/dvscrollbar.d.tlua +109 -0
- package/editablepanel.d.tlua +10 -0
- package/effect.d.tlua +121 -0
- package/effects.d.tlua +77 -0
- package/engine.d.tlua +248 -0
- package/entity.d.tlua +8295 -0
- package/ents.d.tlua +267 -0
- package/enums.d.tlua +7082 -0
- package/file.d.tlua +419 -0
- package/file_class.d.tlua +7 -0
- package/fingerposer.d.tlua +12 -0
- package/fingervar.d.tlua +13 -0
- package/frame.d.tlua +11 -0
- package/frame_blend.d.tlua +105 -0
- package/game.d.tlua +482 -0
- package/gameevent.d.tlua +968 -0
- package/gamemode.d.tlua +48 -0
- package/global.d.tlua +3156 -0
- package/gm.d.tlua +3218 -0
- package/gmod.d.tlua +20 -0
- package/gmsave.d.tlua +53 -0
- package/gui.d.tlua +232 -0
- package/gwen.d.tlua +55 -0
- package/halo.d.tlua +42 -0
- package/hammer.d.tlua +17 -0
- package/hook.d.tlua +64 -0
- package/html.d.tlua +22 -0
- package/http.d.tlua +72 -0
- package/iconeditor.d.tlua +130 -0
- package/igmodaudiochannel.d.tlua +419 -0
- package/imagecheckbox.d.tlua +48 -0
- package/imaterial.d.tlua +288 -0
- package/imesh.d.tlua +70 -0
- package/index.d.tlua +277 -0
- package/input.d.tlua +252 -0
- package/invalidateinternalentitycache.d.tlua +13 -0
- package/irestore.d.tlua +94 -0
- package/isave.d.tlua +94 -0
- package/itexture.d.tlua +108 -0
- package/ivideowriter.d.tlua +53 -0
- package/jit.d.tlua +243 -0
- package/killicon.d.tlua +84 -0
- package/label.d.tlua +20 -0
- package/language.d.tlua +26 -0
- package/list.d.tlua +112 -0
- package/makeballoon.d.tlua +15 -0
- package/markup.d.tlua +38 -0
- package/markupobject.d.tlua +53 -0
- package/material.d.tlua +9 -0
- package/math.d.tlua +899 -0
- package/matproxy.d.tlua +60 -0
- package/matselect.d.tlua +106 -0
- package/menu.d.tlua +20 -0
- package/menubar.d.tlua +39 -0
- package/mesh.d.tlua +183 -0
- package/modelimage.d.tlua +12 -0
- package/motionsensor.d.tlua +115 -0
- package/navmesh.d.tlua +274 -0
- package/net.d.tlua +639 -0
- package/nextbot.d.tlua +380 -0
- package/notification.d.tlua +35 -0
- package/npc.d.tlua +1787 -0
- package/numpad.d.tlua +89 -0
- package/os.d.tlua +56 -0
- package/package.d.tlua +15 -0
- package/package.json +18 -0
- package/panel.d.tlua +3650 -0
- package/panellist.d.tlua +13 -0
- package/pathfollower.d.tlua +301 -0
- package/permissions.d.tlua +77 -0
- package/physcollide.d.tlua +40 -0
- package/physenv.d.tlua +136 -0
- package/physobj.d.tlua +799 -0
- package/pixelvis_handle_t.d.tlua +9 -0
- package/player.d.tlua +3320 -0
- package/player_manager.d.tlua +147 -0
- package/preseteditor.d.tlua +13 -0
- package/presets.d.tlua +79 -0
- package/projectedtexture.d.tlua +553 -0
- package/properties.d.tlua +65 -0
- package/propselect.d.tlua +50 -0
- package/radiobutton.d.tlua +13 -0
- package/render.d.tlua +1700 -0
- package/resource.d.tlua +73 -0
- package/richtext.d.tlua +17 -0
- package/sandbox.d.tlua +576 -0
- package/saverestore.d.tlua +148 -0
- package/schedule.d.tlua +69 -0
- package/scripted_ents.d.tlua +124 -0
- package/search.d.tlua +26 -0
- package/serverlist.d.tlua +85 -0
- package/slidebar.d.tlua +12 -0
- package/slider.d.tlua +11 -0
- package/sound.d.tlua +140 -0
- package/spawnicon.d.tlua +95 -0
- package/spawnmenu.d.tlua +286 -0
- package/spawnmenucontentpanel.d.tlua +52 -0
- package/sql.d.tlua +154 -0
- package/stack.d.tlua +57 -0
- package/steamworks.d.tlua +208 -0
- package/string.d.tlua +535 -0
- package/structures.d.tlua +4442 -0
- package/surface.d.tlua +463 -0
- package/surfaceinfo.d.tlua +70 -0
- package/system.d.tlua +134 -0
- package/table.d.tlua +533 -0
- package/task.d.tlua +92 -0
- package/team.d.tlua +195 -0
- package/textentry.d.tlua +12 -0
- package/tgaimage.d.tlua +11 -0
- package/timer.d.tlua +198 -0
- package/tool.d.tlua +466 -0
- package/ugcpublishwindow.d.tlua +83 -0
- package/umsg.d.tlua +147 -0
- package/undo.d.tlua +122 -0
- package/urllabel.d.tlua +13 -0
- package/usermessage.d.tlua +48 -0
- package/utf8.d.tlua +89 -0
- package/util.d.tlua +1087 -0
- package/vector.d.tlua +413 -0
- package/vehicle.d.tlua +472 -0
- package/vgui.d.tlua +201 -0
- package/video.d.tlua +17 -0
- package/vmatrix.d.tlua +392 -0
- package/weapon.d.tlua +913 -0
- package/weapons.d.tlua +90 -0
- package/widgets.d.tlua +29 -0
- package/workshopfilebase.d.tlua +68 -0
package/gm.d.tlua
ADDED
|
@@ -0,0 +1,3218 @@
|
|
|
1
|
+
// AUTO-GENERATED tlua declarations. Do not edit by hand.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hooks that are available for all gamemodes based on base gamemode.
|
|
5
|
+
*
|
|
6
|
+
* See also: [Structures/GM](https://wiki.facepunch.com/gmod/Structures/GM).
|
|
7
|
+
*
|
|
8
|
+
* @source https://wiki.facepunch.com/gmod/GM_Hooks
|
|
9
|
+
*/
|
|
10
|
+
interface GM {}
|
|
11
|
+
|
|
12
|
+
interface GM {
|
|
13
|
+
/**
|
|
14
|
+
* Called when a map I/O event occurs.
|
|
15
|
+
*
|
|
16
|
+
* See also [Entity:Fire](https://wiki.facepunch.com/gmod/Entity:Fire) and [Entity:Input](https://wiki.facepunch.com/gmod/Entity:Input) for functions to fire Inputs on entities.
|
|
17
|
+
*
|
|
18
|
+
* @realm server
|
|
19
|
+
* @source https://wiki.facepunch.com/gmod/GM:AcceptInput
|
|
20
|
+
*/
|
|
21
|
+
AcceptInput(self: GM, ent: Entity, input: string, activator: Entity, caller: Entity, value: any): boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface GM {
|
|
25
|
+
/**
|
|
26
|
+
* Adds a death notice entry.
|
|
27
|
+
*
|
|
28
|
+
* @realm client
|
|
29
|
+
* @source https://wiki.facepunch.com/gmod/GM:AddDeathNotice
|
|
30
|
+
*/
|
|
31
|
+
AddDeathNotice(self: GM, attacker: string, attackerTeam: number, inflictor: string, victim: string, victimTeam: number): any;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface GM {
|
|
35
|
+
/**
|
|
36
|
+
* Allows you to adjust the mouse sensitivity.
|
|
37
|
+
* @realm client
|
|
38
|
+
* @source https://wiki.facepunch.com/gmod/GM:AdjustMouseSensitivity
|
|
39
|
+
*/
|
|
40
|
+
AdjustMouseSensitivity(self: GM, defaultSensitivity: number, localFOV: number, defaultFOV: number): number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface GM {
|
|
44
|
+
/**
|
|
45
|
+
* Called when a player tries to pick up something using the "use" key, return to override.
|
|
46
|
+
*
|
|
47
|
+
* This hook will not be called if `sv_playerpickupallowed` is set to 0.
|
|
48
|
+
*
|
|
49
|
+
* See [GM:GravGunPickupAllowed](https://wiki.facepunch.com/gmod/GM:GravGunPickupAllowed) for the Gravity Gun pickup variant.
|
|
50
|
+
* See [GM:PhysgunPickup](https://wiki.facepunch.com/gmod/GM:PhysgunPickup) for the Physics Gun pickup variant.
|
|
51
|
+
*
|
|
52
|
+
* @realm server
|
|
53
|
+
* @source https://wiki.facepunch.com/gmod/GM:AllowPlayerPickup
|
|
54
|
+
*/
|
|
55
|
+
AllowPlayerPickup(self: GM, ply: Player, ent: Entity): boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface GM {
|
|
59
|
+
/**
|
|
60
|
+
* This hook is used to calculate animations for a player.
|
|
61
|
+
*
|
|
62
|
+
* **WARNING**: This hook must return the same values at the same time on both, client **and** server. On client for players to see the animations, on server for hit detection to work properly.
|
|
63
|
+
*
|
|
64
|
+
*
|
|
65
|
+
* @realm shared
|
|
66
|
+
* @source https://wiki.facepunch.com/gmod/GM:CalcMainActivity
|
|
67
|
+
*/
|
|
68
|
+
CalcMainActivity(self: GM, ply: Player, vel: Vector): (number, number);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface GM {
|
|
72
|
+
/**
|
|
73
|
+
* Called from [GM:CalcView](https://wiki.facepunch.com/gmod/GM:CalcView) when player is in driving a vehicle.
|
|
74
|
+
*
|
|
75
|
+
* This hook may not be called in gamemodes that override [GM:CalcView](https://wiki.facepunch.com/gmod/GM:CalcView).
|
|
76
|
+
*
|
|
77
|
+
* @realm client
|
|
78
|
+
* @source https://wiki.facepunch.com/gmod/GM:CalcVehicleView
|
|
79
|
+
*/
|
|
80
|
+
CalcVehicleView(self: GM, veh: Vehicle, ply: Player, view: CamData): table;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface GM {
|
|
84
|
+
/**
|
|
85
|
+
* Allows override of the default view.
|
|
86
|
+
* @realm client
|
|
87
|
+
* @source https://wiki.facepunch.com/gmod/GM:CalcView
|
|
88
|
+
*/
|
|
89
|
+
CalcView(self: GM, ply: Player, origin: Vector, angles: Angle, fov: number, znear: number, zfar: number): CamData;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface GM {
|
|
93
|
+
/**
|
|
94
|
+
* Allows overriding the position and angle of the viewmodel.
|
|
95
|
+
* @realm client
|
|
96
|
+
* @source https://wiki.facepunch.com/gmod/GM:CalcViewModelView
|
|
97
|
+
*/
|
|
98
|
+
CalcViewModelView(self: GM, wep: Weapon, vm: Entity, oldPos: Vector, oldAng: Angle, pos: Vector, ang: Angle): (Vector, Angle);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
interface GM {
|
|
102
|
+
/**
|
|
103
|
+
* Called whenever a players tries to create an undo.
|
|
104
|
+
* @realm server
|
|
105
|
+
* @source https://wiki.facepunch.com/gmod/GM:CanCreateUndo
|
|
106
|
+
*/
|
|
107
|
+
CanCreateUndo(self: GM, ply: Player, undo: Undo): boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface GM {
|
|
111
|
+
/**
|
|
112
|
+
* Called when a variable is about to be edited on an Entity (called by `Edit Properties...` menu), to determine if the edit should be permitted.
|
|
113
|
+
*
|
|
114
|
+
* See [Editable entities](https://wiki.facepunch.com/gmod/Editable_Entities) for more details about the system.
|
|
115
|
+
*
|
|
116
|
+
* By default, Sandbox will also call [ENTITY:CanEditVariables](https://wiki.facepunch.com/gmod/ENTITY:CanEditVariables) if no hook returns a value.
|
|
117
|
+
*
|
|
118
|
+
* @realm server
|
|
119
|
+
* @source https://wiki.facepunch.com/gmod/GM:CanEditVariable
|
|
120
|
+
*/
|
|
121
|
+
CanEditVariable(self: GM, ent: Entity, ply: Player, key: string, value: string, editor: table): boolean;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface GM {
|
|
125
|
+
/**
|
|
126
|
+
* Determines if the player can exit the vehicle on their own. [Player:ExitVehicle](https://wiki.facepunch.com/gmod/Player:ExitVehicle) will bypass this hook.
|
|
127
|
+
*
|
|
128
|
+
* See [GM:CanPlayerEnterVehicle](https://wiki.facepunch.com/gmod/GM:CanPlayerEnterVehicle) for the opposite hook.
|
|
129
|
+
* See also [GM:PlayerLeaveVehicle](https://wiki.facepunch.com/gmod/GM:PlayerLeaveVehicle) for a hook that will be called whenever a player exits any vehicle for any reason.
|
|
130
|
+
*
|
|
131
|
+
* @realm server
|
|
132
|
+
* @source https://wiki.facepunch.com/gmod/GM:CanExitVehicle
|
|
133
|
+
*/
|
|
134
|
+
CanExitVehicle(self: GM, veh: Vehicle, ply: Player): boolean;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
interface GM {
|
|
138
|
+
/**
|
|
139
|
+
* Determines whether or not a given player player can enter the given vehicle. [Player:EnterVehicle](https://wiki.facepunch.com/gmod/Player:EnterVehicle) will still call this hook.
|
|
140
|
+
*
|
|
141
|
+
* Called just before [GM:PlayerEnteredVehicle](https://wiki.facepunch.com/gmod/GM:PlayerEnteredVehicle). See also [GM:CanExitVehicle](https://wiki.facepunch.com/gmod/GM:CanExitVehicle).
|
|
142
|
+
*
|
|
143
|
+
* @realm server
|
|
144
|
+
* @source https://wiki.facepunch.com/gmod/GM:CanPlayerEnterVehicle
|
|
145
|
+
*/
|
|
146
|
+
CanPlayerEnterVehicle(self: GM, player: Player, vehicle: Vehicle, role: number): boolean;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface GM {
|
|
150
|
+
/**
|
|
151
|
+
* Determines if the player can kill themselves using the `kill` or `explode` console commands.
|
|
152
|
+
* @realm server
|
|
153
|
+
* @source https://wiki.facepunch.com/gmod/GM:CanPlayerSuicide
|
|
154
|
+
*/
|
|
155
|
+
CanPlayerSuicide(self: GM, player: Player): boolean;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface GM {
|
|
159
|
+
/**
|
|
160
|
+
* Determines if the player can unfreeze the entity.
|
|
161
|
+
* @realm server
|
|
162
|
+
* @source https://wiki.facepunch.com/gmod/GM:CanPlayerUnfreeze
|
|
163
|
+
*/
|
|
164
|
+
CanPlayerUnfreeze(self: GM, player: Player, entity: Entity, phys: PhysObj): boolean;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface GM {
|
|
168
|
+
/**
|
|
169
|
+
* Controls if a [property](https://wiki.facepunch.com/gmod/properties) can be used or not.
|
|
170
|
+
* @realm shared
|
|
171
|
+
* @source https://wiki.facepunch.com/gmod/GM:CanProperty
|
|
172
|
+
*/
|
|
173
|
+
CanProperty(self: GM, ply: Player, property: string, ent: Entity): boolean;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface GM {
|
|
177
|
+
/**
|
|
178
|
+
* Called whenever a players tries to undo.
|
|
179
|
+
* @realm server
|
|
180
|
+
* @source https://wiki.facepunch.com/gmod/GM:CanUndo
|
|
181
|
+
*/
|
|
182
|
+
CanUndo(self: GM, ply: Player, undo: Undo): boolean;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface GM {
|
|
186
|
+
/**
|
|
187
|
+
* Called each frame to record demos to video using [IVideoWriter](https://wiki.facepunch.com/gmod/IVideoWriter).
|
|
188
|
+
*
|
|
189
|
+
* **NOTE**: This hook is called every frame regardless of whether or not a demo is being recorded
|
|
190
|
+
*
|
|
191
|
+
*
|
|
192
|
+
* @realm menu
|
|
193
|
+
* @source https://wiki.facepunch.com/gmod/GM:CaptureVideo
|
|
194
|
+
*/
|
|
195
|
+
CaptureVideo(self: GM): void;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
interface GM {
|
|
199
|
+
/**
|
|
200
|
+
* Called when a message is printed to the chat box. Note, that this isn't working with player messages even though there are arguments for it.
|
|
201
|
+
*
|
|
202
|
+
* For player messages see [GM:PlayerSay](https://wiki.facepunch.com/gmod/GM:PlayerSay) and [GM:OnPlayerChat](https://wiki.facepunch.com/gmod/GM:OnPlayerChat)
|
|
203
|
+
*
|
|
204
|
+
* @realm client
|
|
205
|
+
* @source https://wiki.facepunch.com/gmod/GM:ChatText
|
|
206
|
+
*/
|
|
207
|
+
ChatText(self: GM, index: number, name: string, text: string, type: string): boolean;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface GM {
|
|
211
|
+
/**
|
|
212
|
+
* Called whenever the content of the user's chat input box is changed.
|
|
213
|
+
* @realm client
|
|
214
|
+
* @source https://wiki.facepunch.com/gmod/GM:ChatTextChanged
|
|
215
|
+
*/
|
|
216
|
+
ChatTextChanged(self: GM, text: string): void;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
interface GM {
|
|
220
|
+
/**
|
|
221
|
+
* Called when a **non local player** connects to allow the Lua system to check the password.
|
|
222
|
+
*
|
|
223
|
+
* The default behaviour in the base gamemodes emulates what would normally happen. If `sv_password` is set and its value matches the password passed in by the client (via `password` concommand) - then they are allowed to join. If `sv_password` isn't set it lets them in too.
|
|
224
|
+
*
|
|
225
|
+
* @realm server
|
|
226
|
+
* @source https://wiki.facepunch.com/gmod/GM:CheckPassword
|
|
227
|
+
*/
|
|
228
|
+
CheckPassword(self: GM, steamID64: string, ipAddress: string, svPassword: string, clPassword: string, name: string): (boolean, string);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
interface GM {
|
|
232
|
+
/**
|
|
233
|
+
* Called when a player's sign on state changes.
|
|
234
|
+
* You cannot get a valid player object from the userID at any point during this hook.
|
|
235
|
+
*
|
|
236
|
+
* @realm shared
|
|
237
|
+
* @source https://wiki.facepunch.com/gmod/GM:ClientSignOnStateChanged
|
|
238
|
+
*/
|
|
239
|
+
ClientSignOnStateChanged(self: GM, userID: number, oldState: number, newState: number): void;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
interface GM {
|
|
243
|
+
/**
|
|
244
|
+
* Called when derma menus are closed with [Global.CloseDermaMenus](https://wiki.facepunch.com/gmod/Global.CloseDermaMenus).
|
|
245
|
+
* @realm client and menu
|
|
246
|
+
* @source https://wiki.facepunch.com/gmod/GM:CloseDermaMenus
|
|
247
|
+
*/
|
|
248
|
+
CloseDermaMenus(self: GM): void;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
interface GM {
|
|
252
|
+
/**
|
|
253
|
+
* Called whenever an entity becomes a clientside ragdoll.
|
|
254
|
+
*
|
|
255
|
+
* See [GM:CreateEntityRagdoll](https://wiki.facepunch.com/gmod/GM:CreateEntityRagdoll) for serverside ragdolls.
|
|
256
|
+
*
|
|
257
|
+
* @realm client
|
|
258
|
+
* @source https://wiki.facepunch.com/gmod/GM:CreateClientsideRagdoll
|
|
259
|
+
*/
|
|
260
|
+
CreateClientsideRagdoll(self: GM, entity: Entity, ragdoll: Entity): void;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
interface GM {
|
|
264
|
+
/**
|
|
265
|
+
* Called when a serverside ragdoll of an entity has been created.
|
|
266
|
+
*
|
|
267
|
+
* See [GM:CreateClientsideRagdoll](https://wiki.facepunch.com/gmod/GM:CreateClientsideRagdoll) for clientside ragdolls.
|
|
268
|
+
*
|
|
269
|
+
* @realm server
|
|
270
|
+
* @source https://wiki.facepunch.com/gmod/GM:CreateEntityRagdoll
|
|
271
|
+
*/
|
|
272
|
+
CreateEntityRagdoll(self: GM, owner: Entity, ragdoll: Entity): void;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
interface GM {
|
|
276
|
+
/**
|
|
277
|
+
* Allows you to change the players movements before they're sent to the server.
|
|
278
|
+
*
|
|
279
|
+
* See [Game Movement](https://wiki.facepunch.com/gmod/Game_Movement) for an explanation on the move system.
|
|
280
|
+
*
|
|
281
|
+
* **NOTE**: Due to this hook being clientside only, it could be overridden by the user allowing them to completely skip your logic, it is recommended to use [GM:StartCommand](https://wiki.facepunch.com/gmod/GM:StartCommand) in a shared file instead.
|
|
282
|
+
*
|
|
283
|
+
*
|
|
284
|
+
* @realm client
|
|
285
|
+
* @source https://wiki.facepunch.com/gmod/GM:CreateMove
|
|
286
|
+
*/
|
|
287
|
+
CreateMove(self: GM, cmd: CUserCmd): boolean;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
interface GM {
|
|
291
|
+
/**
|
|
292
|
+
* Teams are created within this hook using [team.SetUp](https://wiki.facepunch.com/gmod/team.SetUp).
|
|
293
|
+
*
|
|
294
|
+
* This hook is called before [GM:PreGamemodeLoaded](https://wiki.facepunch.com/gmod/GM:PreGamemodeLoaded).
|
|
295
|
+
*
|
|
296
|
+
* @realm shared
|
|
297
|
+
* @source https://wiki.facepunch.com/gmod/GM:CreateTeams
|
|
298
|
+
*/
|
|
299
|
+
CreateTeams(self: GM): void;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
interface GM {
|
|
303
|
+
/**
|
|
304
|
+
* Called upon an animation event, this is the ideal place to call player animation functions such as [Player:AddVCDSequenceToGestureSlot](https://wiki.facepunch.com/gmod/Player:AddVCDSequenceToGestureSlot), [Player:AnimRestartGesture](https://wiki.facepunch.com/gmod/Player:AnimRestartGesture) and so on.
|
|
305
|
+
* @realm shared
|
|
306
|
+
* @source https://wiki.facepunch.com/gmod/GM:DoAnimationEvent
|
|
307
|
+
*/
|
|
308
|
+
DoAnimationEvent(self: GM, ply: Player, event: number, data?: number): number;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
interface GM {
|
|
312
|
+
/**
|
|
313
|
+
* Handles the player's death.
|
|
314
|
+
*
|
|
315
|
+
* This hook is **not** called if the player is killed by [Player:KillSilent](https://wiki.facepunch.com/gmod/Player:KillSilent). See [GM:PlayerSilentDeath](https://wiki.facepunch.com/gmod/GM:PlayerSilentDeath) for that.
|
|
316
|
+
*
|
|
317
|
+
* * [GM:PlayerDeath](https://wiki.facepunch.com/gmod/GM:PlayerDeath) is called after this hook
|
|
318
|
+
* * [GM:PostPlayerDeath](https://wiki.facepunch.com/gmod/GM:PostPlayerDeath) is called after that
|
|
319
|
+
*
|
|
320
|
+
* **NOTE**: [Player:Alive](https://wiki.facepunch.com/gmod/Player:Alive) will return false in this hook.
|
|
321
|
+
*
|
|
322
|
+
*
|
|
323
|
+
*
|
|
324
|
+
* @realm server
|
|
325
|
+
* @source https://wiki.facepunch.com/gmod/GM:DoPlayerDeath
|
|
326
|
+
*/
|
|
327
|
+
DoPlayerDeath(self: GM, ply: Player, attacker: Entity, dmg: CTakeDamageInfo): void;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
interface GM {
|
|
331
|
+
/**
|
|
332
|
+
* This hook is called every frame to draw all of the current death notices.
|
|
333
|
+
* @realm client
|
|
334
|
+
* @source https://wiki.facepunch.com/gmod/GM:DrawDeathNotice
|
|
335
|
+
*/
|
|
336
|
+
DrawDeathNotice(self: GM, x: number, y: number): void;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
interface GM {
|
|
340
|
+
/**
|
|
341
|
+
* Called every frame before drawing the in-game monitors ( Breencast, in-game TVs, etc ), but doesn't seem to be doing anything, trying to render 2D or 3D elements fail.
|
|
342
|
+
* @realm client
|
|
343
|
+
* @source https://wiki.facepunch.com/gmod/GM:DrawMonitors
|
|
344
|
+
*/
|
|
345
|
+
DrawMonitors(self: GM): void;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
interface GM {
|
|
349
|
+
/**
|
|
350
|
+
* Called after all other 2D draw hooks are called. Draws over all VGUI Panels and HUDs.
|
|
351
|
+
*
|
|
352
|
+
* Unlike [GM:HUDPaint](https://wiki.facepunch.com/gmod/GM:HUDPaint), this hook is called with the game paused and while the Camera SWEP is equipped.
|
|
353
|
+
*
|
|
354
|
+
* Does not get called when `r_drawvgui` is disabled.
|
|
355
|
+
*
|
|
356
|
+
*
|
|
357
|
+
*
|
|
358
|
+
* @realm client and menu
|
|
359
|
+
* @source https://wiki.facepunch.com/gmod/GM:DrawOverlay
|
|
360
|
+
*/
|
|
361
|
+
DrawOverlay(self: GM): void;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
interface GM {
|
|
365
|
+
/**
|
|
366
|
+
* Allows you to override physgun effects rendering.
|
|
367
|
+
*
|
|
368
|
+
* **NOTE**: This is still called when `physgun_drawbeams` is set to `0`, because this hook is also capable of overriding physgun sprite effects, while the convar does not.
|
|
369
|
+
*
|
|
370
|
+
*
|
|
371
|
+
* @realm client
|
|
372
|
+
* @source https://wiki.facepunch.com/gmod/GM:DrawPhysgunBeam
|
|
373
|
+
*/
|
|
374
|
+
DrawPhysgunBeam(self: GM, ply: Player, physgun: Weapon, enabled: boolean, target: Entity, physBone: number, hitPos: Vector): boolean;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
interface GM {
|
|
378
|
+
/**
|
|
379
|
+
* Called right before an entity stops driving. Overriding this hook will cause it to not call [drive.End](https://wiki.facepunch.com/gmod/drive.End) and the player will not stop driving.
|
|
380
|
+
* @realm shared
|
|
381
|
+
* @source https://wiki.facepunch.com/gmod/GM:EndEntityDriving
|
|
382
|
+
*/
|
|
383
|
+
EndEntityDriving(self: GM, ent: Entity, ply: Player): void;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
interface GM {
|
|
387
|
+
/**
|
|
388
|
+
* Called whenever a sound has been played. This will not be called clientside if the server played the sound without the client also calling [Entity:EmitSound](https://wiki.facepunch.com/gmod/Entity:EmitSound).
|
|
389
|
+
*
|
|
390
|
+
* @realm shared
|
|
391
|
+
* @source https://wiki.facepunch.com/gmod/GM:EntityEmitSound
|
|
392
|
+
*/
|
|
393
|
+
EntityEmitSound(self: GM, data: EmitSoundInfo): boolean;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
interface GM {
|
|
397
|
+
/**
|
|
398
|
+
* Called every time a bullet is about to be fired from an entity, which allows to completely modify the bullet structure before the bullet is actually fired.
|
|
399
|
+
*
|
|
400
|
+
* See [GM:PostEntityFireBullets](https://wiki.facepunch.com/gmod/GM:PostEntityFireBullets) if you wish to hook the final bullet values, such as the aim direction post spread calculations.
|
|
401
|
+
*
|
|
402
|
+
* **WARNING**: This hook is called directly from [Entity:FireBullets](https://wiki.facepunch.com/gmod/Entity:FireBullets). Due to this, you cannot call [Entity:FireBullets](https://wiki.facepunch.com/gmod/Entity:FireBullets) inside this hook or an infinite loop will occur crashing the game.
|
|
403
|
+
*
|
|
404
|
+
*
|
|
405
|
+
* @realm shared
|
|
406
|
+
* @source https://wiki.facepunch.com/gmod/GM:EntityFireBullets
|
|
407
|
+
*/
|
|
408
|
+
EntityFireBullets(self: GM, entity: Entity, data: Bullet): boolean;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
interface GM {
|
|
412
|
+
/**
|
|
413
|
+
* Called when a key-value pair is set on an entity on map spawn. Is **not** called by [Entity:SetKeyValue](https://wiki.facepunch.com/gmod/Entity:SetKeyValue).
|
|
414
|
+
*
|
|
415
|
+
* See [ENTITY:KeyValue](https://wiki.facepunch.com/gmod/ENTITY:KeyValue) for a [scripted entities](https://wiki.facepunch.com/gmod/scripted_entities) hook, and its scripted weapon alternative: [WEAPON:KeyValue](https://wiki.facepunch.com/gmod/WEAPON:KeyValue).
|
|
416
|
+
*
|
|
417
|
+
* @realm shared
|
|
418
|
+
* @source https://wiki.facepunch.com/gmod/GM:EntityKeyValue
|
|
419
|
+
*/
|
|
420
|
+
EntityKeyValue(self: GM, ent: Entity, key: string, value: string): string;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
interface GM {
|
|
424
|
+
/**
|
|
425
|
+
* Called when an NW2Var is changed.
|
|
426
|
+
* If a NW2Var is set on an entity that is based on a Lua Entity could result in the NW2Var being mixed up with other ones and being updated multiple times.
|
|
427
|
+
* **NOTE**: This hook is fired before the client value is actually changed. Calling the GetNW2 function for the specified variable name within this hook will return the old value, not the current/updated one.
|
|
428
|
+
*
|
|
429
|
+
* This hook gets called for all NW2Vars on all Entities in a full update. The old value will be nil in this case.
|
|
430
|
+
* If this hook seems to be called for no apparent reason, check if it's caused by a full update.
|
|
431
|
+
*
|
|
432
|
+
*
|
|
433
|
+
* @realm shared
|
|
434
|
+
* @source https://wiki.facepunch.com/gmod/GM:EntityNetworkedVarChanged
|
|
435
|
+
*/
|
|
436
|
+
EntityNetworkedVarChanged(self: GM, ent: Entity, name: string, oldval: any, newval: any): void;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
interface GM {
|
|
440
|
+
/**
|
|
441
|
+
* Called right before removal of an entity.
|
|
442
|
+
* **WARNING**: This hook is called clientside during full updates due to how networking works in the Source Engine.
|
|
443
|
+
*
|
|
444
|
+
* This can happen when the client briefly loses connection to the server, and can be simulated via `cl_fullupdate` for testing purposes.
|
|
445
|
+
*
|
|
446
|
+
*
|
|
447
|
+
* @realm shared
|
|
448
|
+
* @source https://wiki.facepunch.com/gmod/GM:EntityRemoved
|
|
449
|
+
*/
|
|
450
|
+
EntityRemoved(self: GM, ent: Entity, fullUpdate: boolean): void;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
interface GM {
|
|
454
|
+
/**
|
|
455
|
+
* Called when an entity is about to take damage. You can modify all parts of the damage info in this hook or completely block the damage event.
|
|
456
|
+
*
|
|
457
|
+
* See [GM:PostEntityTakeDamage](https://wiki.facepunch.com/gmod/GM:PostEntityTakeDamage) if you wish to hook the final damage event.
|
|
458
|
+
*
|
|
459
|
+
* **WARNING**: Applying damage from this hook to the entity taking damage will lead to infinite loop/crash.
|
|
460
|
+
*
|
|
461
|
+
*
|
|
462
|
+
* @realm server
|
|
463
|
+
* @source https://wiki.facepunch.com/gmod/GM:EntityTakeDamage
|
|
464
|
+
*/
|
|
465
|
+
EntityTakeDamage(self: GM, target: Entity, dmg: CTakeDamageInfo): boolean;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
interface GM {
|
|
469
|
+
/**
|
|
470
|
+
* This hook polls the entity the player use action should be applied to.
|
|
471
|
+
*
|
|
472
|
+
* **NOTE**: The default behavior of this hook is in [CBasePlayer::FindUseEntity](https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/shared/baseplayer_shared.cpp#L1068-L1270). Despite CBasePlayer::FindUseEntity being defined shared, it is only called serverside in practice, so this hook will be only called serverside, as well. It is possible for modules to call it clientside, so the Lua code should still be treated as shared.
|
|
473
|
+
*
|
|
474
|
+
*
|
|
475
|
+
* @realm shared
|
|
476
|
+
* @source https://wiki.facepunch.com/gmod/GM:FindUseEntity
|
|
477
|
+
*/
|
|
478
|
+
FindUseEntity(self: GM, ply: Player, defaultEnt: Entity): Entity;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
interface GM {
|
|
482
|
+
/**
|
|
483
|
+
* Runs when user cancels/finishes typing.
|
|
484
|
+
* @realm client
|
|
485
|
+
* @source https://wiki.facepunch.com/gmod/GM:FinishChat
|
|
486
|
+
*/
|
|
487
|
+
FinishChat(self: GM): void;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
interface GM {
|
|
491
|
+
/**
|
|
492
|
+
* Called after [GM:Move](https://wiki.facepunch.com/gmod/GM:Move), applies all the changes from the [CMoveData](https://wiki.facepunch.com/gmod/CMoveData) to the player.
|
|
493
|
+
*
|
|
494
|
+
* See [Game Movement](https://wiki.facepunch.com/gmod/Game_Movement) for an explanation on the move system.
|
|
495
|
+
*
|
|
496
|
+
* @realm shared
|
|
497
|
+
* @source https://wiki.facepunch.com/gmod/GM:FinishMove
|
|
498
|
+
*/
|
|
499
|
+
FinishMove(self: GM, ply: Player, mv: CMoveData): boolean;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
interface GM {
|
|
503
|
+
/**
|
|
504
|
+
* Called to allow override of the default Derma skin for all panels.
|
|
505
|
+
*
|
|
506
|
+
* **NOTE**: This hook is only called on Lua start up, changing its value (or adding new hooks) after it has been already called will not have any effect.
|
|
507
|
+
*
|
|
508
|
+
* **NOTE**: You can [Panel:SetSkin](https://wiki.facepunch.com/gmod/Panel:SetSkin) "Default" (or other skins) on the frame/base panel and they will still take priority
|
|
509
|
+
*
|
|
510
|
+
*
|
|
511
|
+
* @realm client
|
|
512
|
+
* @source https://wiki.facepunch.com/gmod/GM:ForceDermaSkin
|
|
513
|
+
*/
|
|
514
|
+
ForceDermaSkin(self: GM): string;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
interface GM {
|
|
518
|
+
/**
|
|
519
|
+
* Called when the mouse has been double clicked on any panel derived from CGModBase, such as the panel used by [gui.EnableScreenClicker](https://wiki.facepunch.com/gmod/gui.EnableScreenClicker) and the panel used by [Panel:ParentToHUD](https://wiki.facepunch.com/gmod/Panel:ParentToHUD).
|
|
520
|
+
*
|
|
521
|
+
* By default this hook calls [GM:GUIMousePressed](https://wiki.facepunch.com/gmod/GM:GUIMousePressed).
|
|
522
|
+
*
|
|
523
|
+
* @realm client
|
|
524
|
+
* @source https://wiki.facepunch.com/gmod/GM:GUIMouseDoublePressed
|
|
525
|
+
*/
|
|
526
|
+
GUIMouseDoublePressed(self: GM, mouseCode: number, aimVector: Vector): void;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
interface GM {
|
|
530
|
+
/**
|
|
531
|
+
* Called whenever a players presses a mouse key on the context menu in Sandbox or on any panel derived from CGModBase, such as the panel used by [gui.EnableScreenClicker](https://wiki.facepunch.com/gmod/gui.EnableScreenClicker) and the panel used by [Panel:ParentToHUD](https://wiki.facepunch.com/gmod/Panel:ParentToHUD).
|
|
532
|
+
*
|
|
533
|
+
* See [GM:VGUIMousePressed](https://wiki.facepunch.com/gmod/GM:VGUIMousePressed) for a hook that is called on all VGUI elements.
|
|
534
|
+
*
|
|
535
|
+
* @realm client
|
|
536
|
+
* @source https://wiki.facepunch.com/gmod/GM:GUIMousePressed
|
|
537
|
+
*/
|
|
538
|
+
GUIMousePressed(self: GM, mouseCode: number, aimVector: Vector): void;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
interface GM {
|
|
542
|
+
/**
|
|
543
|
+
* Called whenever a players releases a mouse key on the context menu in Sandbox or on any panel derived from CGModBase, such as the panel used by [gui.EnableScreenClicker](https://wiki.facepunch.com/gmod/gui.EnableScreenClicker) and the panel used by [Panel:ParentToHUD](https://wiki.facepunch.com/gmod/Panel:ParentToHUD).
|
|
544
|
+
* @realm client
|
|
545
|
+
* @source https://wiki.facepunch.com/gmod/GM:GUIMouseReleased
|
|
546
|
+
*/
|
|
547
|
+
GUIMouseReleased(self: GM, mouseCode: number, aimVector: Vector): void;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
interface GM {
|
|
551
|
+
/**
|
|
552
|
+
* Called when game content has been changed, for example an addon or a mountable game was (un)mounted.
|
|
553
|
+
* @realm shared and menu
|
|
554
|
+
* @source https://wiki.facepunch.com/gmod/GM:GameContentChanged
|
|
555
|
+
*/
|
|
556
|
+
GameContentChanged(self: GM): void;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
interface GM {
|
|
560
|
+
/**
|
|
561
|
+
* An internal function used to get an untranslated string to show in the kill feed as the entity's name. See [GM:SendDeathNotice](https://wiki.facepunch.com/gmod/GM:SendDeathNotice)
|
|
562
|
+
*
|
|
563
|
+
* @realm server
|
|
564
|
+
* @source https://wiki.facepunch.com/gmod/GM:GetDeathNoticeEntityName
|
|
565
|
+
*/
|
|
566
|
+
GetDeathNoticeEntityName(self: GM, name: string | Entity): string;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
interface GM {
|
|
570
|
+
/**
|
|
571
|
+
* Called when a player takes damage from falling, allows to override the damage.
|
|
572
|
+
* @realm server
|
|
573
|
+
* @source https://wiki.facepunch.com/gmod/GM:GetFallDamage
|
|
574
|
+
*/
|
|
575
|
+
GetFallDamage(self: GM, ply: Player, speed: number): number;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
interface GM {
|
|
579
|
+
/**
|
|
580
|
+
* Called when the game(server) needs to update the text shown in the server browser as the gamemode. Runs at a ~2s interval, runs even when the server is hibernating.
|
|
581
|
+
*
|
|
582
|
+
* **NOTE**: This hook (and the `sv_gamename_override` command) may not work on some popular gamemodes like DarkRP or Trouble Terrorist Town. This is not a bug, it's just how it works. See [here](https://github.com/Facepunch/garrysmod-issues/issues/4637#issuecomment-677884989) for more information.
|
|
583
|
+
*
|
|
584
|
+
* Also, it **only** works on dedicated servers and is called at regular intervals (about one second) **even** if the server has no players and the hibernation function is enabled.
|
|
585
|
+
*
|
|
586
|
+
*
|
|
587
|
+
* @realm shared
|
|
588
|
+
* @source https://wiki.facepunch.com/gmod/GM:GetGameDescription
|
|
589
|
+
*/
|
|
590
|
+
GetGameDescription(self: GM): string;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
interface GM {
|
|
594
|
+
/**
|
|
595
|
+
* Allows you to modify the Source Engine's motion blur shaders.
|
|
596
|
+
* @realm client
|
|
597
|
+
* @source https://wiki.facepunch.com/gmod/GM:GetMotionBlurValues
|
|
598
|
+
*/
|
|
599
|
+
GetMotionBlurValues(self: GM, horizontal: number, vertical: number, forward: number, rotational: number): (number, number, number, number);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
interface GM {
|
|
603
|
+
/**
|
|
604
|
+
* Called to determine preferred carry angles for the entity. It works for both, +use pickup and gravity gun pickup.
|
|
605
|
+
*
|
|
606
|
+
* **WARNING**: Due to nature of the gravity gun coding in multiplayer, this hook **MAY** seem to not work ( but rest assured it does ), due to clientside prediction not knowing the carry angles. The +use pickup doesn't present this issue as it doesn't predict the player carrying the object clientside ( as you may notice by the prop lagging behind in multiplayer )
|
|
607
|
+
*
|
|
608
|
+
*
|
|
609
|
+
* **NOTE**: This hook can **not** override preferred carry angles of props such as the sawblade and the harpoon.
|
|
610
|
+
*
|
|
611
|
+
*
|
|
612
|
+
* @realm server
|
|
613
|
+
* @source https://wiki.facepunch.com/gmod/GM:GetPreferredCarryAngles
|
|
614
|
+
*/
|
|
615
|
+
GetPreferredCarryAngles(self: GM, ent: Entity, ply: Player): Angle;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
interface GM {
|
|
619
|
+
/**
|
|
620
|
+
* Returns the color for the given entity's team. This is used in chat and deathnotice text.
|
|
621
|
+
* @realm client
|
|
622
|
+
* @source https://wiki.facepunch.com/gmod/GM:GetTeamColor
|
|
623
|
+
*/
|
|
624
|
+
GetTeamColor(self: GM, ent: Entity): Color;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
interface GM {
|
|
628
|
+
/**
|
|
629
|
+
* Returns the team color for the given team index.
|
|
630
|
+
* @realm client
|
|
631
|
+
* @source https://wiki.facepunch.com/gmod/GM:GetTeamNumColor
|
|
632
|
+
*/
|
|
633
|
+
GetTeamNumColor(self: GM, team: number): Color;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
interface GM {
|
|
637
|
+
/**
|
|
638
|
+
* Override this hook to disable/change ear-grabbing in your gamemode. By default, it is not called anywhere on the server.
|
|
639
|
+
* @realm shared
|
|
640
|
+
* @source https://wiki.facepunch.com/gmod/GM:GrabEarAnimation
|
|
641
|
+
*/
|
|
642
|
+
GrabEarAnimation(self: GM, ply: Player): void;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
interface GM {
|
|
646
|
+
/**
|
|
647
|
+
* Called when an entity is released by a gravity gun.
|
|
648
|
+
*
|
|
649
|
+
* See [GM:PhysgunDrop](https://wiki.facepunch.com/gmod/GM:PhysgunDrop) for the Physics Gun drop variant.
|
|
650
|
+
*
|
|
651
|
+
* @realm server
|
|
652
|
+
* @source https://wiki.facepunch.com/gmod/GM:GravGunOnDropped
|
|
653
|
+
*/
|
|
654
|
+
GravGunOnDropped(self: GM, ply: Player, ent: Entity): void;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
interface GM {
|
|
658
|
+
/**
|
|
659
|
+
* Called when an entity is picked up by a gravity gun.
|
|
660
|
+
*
|
|
661
|
+
* See [GM:OnPlayerPhysicsPickup](https://wiki.facepunch.com/gmod/GM:OnPlayerPhysicsPickup) for the player `+use` pickup variant.
|
|
662
|
+
* See [GM:OnPhysgunPickup](https://wiki.facepunch.com/gmod/GM:OnPhysgunPickup) for the Physics Gun pickup variant.
|
|
663
|
+
*
|
|
664
|
+
* @realm server
|
|
665
|
+
* @source https://wiki.facepunch.com/gmod/GM:GravGunOnPickedUp
|
|
666
|
+
*/
|
|
667
|
+
GravGunOnPickedUp(self: GM, ply: Player, ent: Entity): void;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
interface GM {
|
|
671
|
+
/**
|
|
672
|
+
* Called every tick to poll whether a player is allowed to pick up an entity with the gravity gun or not.
|
|
673
|
+
*
|
|
674
|
+
* See [GM:AllowPlayerPickup](https://wiki.facepunch.com/gmod/GM:AllowPlayerPickup) for the +USE pickup variant.
|
|
675
|
+
* See [GM:PhysgunPickup](https://wiki.facepunch.com/gmod/GM:PhysgunPickup) for the Physics Gun pickup variant.
|
|
676
|
+
*
|
|
677
|
+
* Calls [ENTITY:GravGunPickupAllowed](https://wiki.facepunch.com/gmod/ENTITY:GravGunPickupAllowed) on the entity being hovered every frame in Sandbox-derived gamemodes.
|
|
678
|
+
*
|
|
679
|
+
* @realm server
|
|
680
|
+
* @source https://wiki.facepunch.com/gmod/GM:GravGunPickupAllowed
|
|
681
|
+
*/
|
|
682
|
+
GravGunPickupAllowed(self: GM, ply: Player, ent: Entity): boolean;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
interface GM {
|
|
686
|
+
/**
|
|
687
|
+
* Called when an entity is about to be punted with the gravity gun (primary fire).
|
|
688
|
+
*
|
|
689
|
+
* By default this function makes [ENTITY:GravGunPunt](https://wiki.facepunch.com/gmod/ENTITY:GravGunPunt) work in Sandbox derived gamemodes.
|
|
690
|
+
*
|
|
691
|
+
* @realm shared
|
|
692
|
+
* @source https://wiki.facepunch.com/gmod/GM:GravGunPunt
|
|
693
|
+
*/
|
|
694
|
+
GravGunPunt(self: GM, ply: Player, ent: Entity): boolean;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
interface GM {
|
|
698
|
+
/**
|
|
699
|
+
* Called when the client has picked up ammo. Override to disable default HUD notification.
|
|
700
|
+
* @realm client
|
|
701
|
+
* @source https://wiki.facepunch.com/gmod/GM:HUDAmmoPickedUp
|
|
702
|
+
*/
|
|
703
|
+
HUDAmmoPickedUp(self: GM, itemName: string, amount: number): void;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
interface GM {
|
|
707
|
+
/**
|
|
708
|
+
* Renders the HUD pick-up history. Override to hide default or draw your own HUD.
|
|
709
|
+
* @realm client
|
|
710
|
+
* @source https://wiki.facepunch.com/gmod/GM:HUDDrawPickupHistory
|
|
711
|
+
*/
|
|
712
|
+
HUDDrawPickupHistory(self: GM): void;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
interface GM {
|
|
716
|
+
/**
|
|
717
|
+
* Called every frame to render the scoreboard.
|
|
718
|
+
*
|
|
719
|
+
*
|
|
720
|
+
* It is recommended to use Derma and VGUI for this job instead of this hook. Called right after [GM:HUDPaint](https://wiki.facepunch.com/gmod/GM:HUDPaint).
|
|
721
|
+
*
|
|
722
|
+
*
|
|
723
|
+
*
|
|
724
|
+
* @realm client
|
|
725
|
+
* @source https://wiki.facepunch.com/gmod/GM:HUDDrawScoreBoard
|
|
726
|
+
*/
|
|
727
|
+
HUDDrawScoreBoard(self: GM): void;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
interface GM {
|
|
731
|
+
/**
|
|
732
|
+
* Called from [GM:HUDPaint](https://wiki.facepunch.com/gmod/GM:HUDPaint) to draw player info when you hover over a player with your crosshair or mouse.
|
|
733
|
+
* @realm client
|
|
734
|
+
* @source https://wiki.facepunch.com/gmod/GM:HUDDrawTargetID
|
|
735
|
+
*/
|
|
736
|
+
HUDDrawTargetID(self: GM): boolean;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
interface GM {
|
|
740
|
+
/**
|
|
741
|
+
* Called when an item has been picked up. Override to disable the default HUD notification.
|
|
742
|
+
* @realm client
|
|
743
|
+
* @source https://wiki.facepunch.com/gmod/GM:HUDItemPickedUp
|
|
744
|
+
*/
|
|
745
|
+
HUDItemPickedUp(self: GM, itemName: string): void;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
interface GM {
|
|
749
|
+
/**
|
|
750
|
+
* Called whenever the HUD should be drawn.
|
|
751
|
+
*
|
|
752
|
+
* This is the ideal place to draw custom HUD elements.
|
|
753
|
+
*
|
|
754
|
+
* To prevent the default game HUD from drawing, use [GM:HUDShouldDraw](https://wiki.facepunch.com/gmod/GM:HUDShouldDraw).
|
|
755
|
+
*
|
|
756
|
+
* This hook does **not** get called when the Camera SWEP is held, or when the esc menu is open.
|
|
757
|
+
* If you need to draw in those situations, use [GM:DrawOverlay](https://wiki.facepunch.com/gmod/GM:DrawOverlay) instead.
|
|
758
|
+
*
|
|
759
|
+
*
|
|
760
|
+
*
|
|
761
|
+
* @realm client
|
|
762
|
+
* @source https://wiki.facepunch.com/gmod/GM:HUDPaint
|
|
763
|
+
*/
|
|
764
|
+
HUDPaint(self: GM): void;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
interface GM {
|
|
768
|
+
/**
|
|
769
|
+
* Called before [GM:HUDPaint](https://wiki.facepunch.com/gmod/GM:HUDPaint) when the HUD background is being drawn.
|
|
770
|
+
*
|
|
771
|
+
* Just like [GM:HUDPaint](https://wiki.facepunch.com/gmod/GM:HUDPaint), this hook will not be called when the main menu is visible. [GM:PostDrawHUD](https://wiki.facepunch.com/gmod/GM:PostDrawHUD) does not have this behavior.
|
|
772
|
+
*
|
|
773
|
+
* Things rendered in this hook will **always** appear behind things rendered in [GM:HUDPaint](https://wiki.facepunch.com/gmod/GM:HUDPaint).
|
|
774
|
+
*
|
|
775
|
+
*
|
|
776
|
+
*
|
|
777
|
+
* @realm client
|
|
778
|
+
* @source https://wiki.facepunch.com/gmod/GM:HUDPaintBackground
|
|
779
|
+
*/
|
|
780
|
+
HUDPaintBackground(self: GM): void;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
interface GM {
|
|
784
|
+
/**
|
|
785
|
+
* Called when the Gamemode is about to draw a given element on the client's HUD (heads-up display).
|
|
786
|
+
*
|
|
787
|
+
* **WARNING**: This hook is called HUNDREDS of times per second (more than 5 times per frame on average). You shouldn't be performing any computationally intensive operations. For Weapons you SHOULD use [WEAPON:HUDShouldDraw](https://wiki.facepunch.com/gmod/WEAPON:HUDShouldDraw) instead.
|
|
788
|
+
*
|
|
789
|
+
*
|
|
790
|
+
* @realm client
|
|
791
|
+
* @source https://wiki.facepunch.com/gmod/GM:HUDShouldDraw
|
|
792
|
+
*/
|
|
793
|
+
HUDShouldDraw(self: GM, name: string): boolean;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
interface GM {
|
|
797
|
+
/**
|
|
798
|
+
* Called when a weapon has been picked up. Override to disable the default HUD notification.
|
|
799
|
+
* @realm client
|
|
800
|
+
* @source https://wiki.facepunch.com/gmod/GM:HUDWeaponPickedUp
|
|
801
|
+
*/
|
|
802
|
+
HUDWeaponPickedUp(self: GM, weapon: Weapon): void;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
interface GM {
|
|
806
|
+
/**
|
|
807
|
+
* Called to handle player armor reduction, when player receives damage.
|
|
808
|
+
*
|
|
809
|
+
* Clarify hook order with other damage hooks.
|
|
810
|
+
*
|
|
811
|
+
* @realm server
|
|
812
|
+
* @source https://wiki.facepunch.com/gmod/GM:HandlePlayerArmorReduction
|
|
813
|
+
*/
|
|
814
|
+
HandlePlayerArmorReduction(self: GM, ply: Player, dmginfo: CTakeDamageInfo): void;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
interface GM {
|
|
818
|
+
/**
|
|
819
|
+
* Allows to override player driving animations.
|
|
820
|
+
* @realm shared
|
|
821
|
+
* @source https://wiki.facepunch.com/gmod/GM:HandlePlayerDriving
|
|
822
|
+
*/
|
|
823
|
+
HandlePlayerDriving(self: GM, ply: Player): boolean;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
interface GM {
|
|
827
|
+
/**
|
|
828
|
+
* Allows to override player crouch animations.
|
|
829
|
+
* @realm shared
|
|
830
|
+
* @source https://wiki.facepunch.com/gmod/GM:HandlePlayerDucking
|
|
831
|
+
*/
|
|
832
|
+
HandlePlayerDucking(self: GM, ply: Player, velocity: Vector): boolean;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
interface GM {
|
|
836
|
+
/**
|
|
837
|
+
* Called every frame by the player model animation system. Allows to override player jumping animations.
|
|
838
|
+
* @realm shared
|
|
839
|
+
* @source https://wiki.facepunch.com/gmod/GM:HandlePlayerJumping
|
|
840
|
+
*/
|
|
841
|
+
HandlePlayerJumping(self: GM, ply: Player, velocity: Vector): boolean;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
interface GM {
|
|
845
|
+
/**
|
|
846
|
+
* Called every frame by the player model animation system. Allows to override player landing animations.
|
|
847
|
+
* @realm shared
|
|
848
|
+
* @source https://wiki.facepunch.com/gmod/GM:HandlePlayerLanding
|
|
849
|
+
*/
|
|
850
|
+
HandlePlayerLanding(self: GM, ply: Player, velocity: Vector, onGround: boolean): boolean;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
interface GM {
|
|
854
|
+
/**
|
|
855
|
+
* Allows to override player noclip animations.
|
|
856
|
+
* @realm shared
|
|
857
|
+
* @source https://wiki.facepunch.com/gmod/GM:HandlePlayerNoClipping
|
|
858
|
+
*/
|
|
859
|
+
HandlePlayerNoClipping(self: GM, ply: Player, velocity: Vector): boolean;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
interface GM {
|
|
863
|
+
/**
|
|
864
|
+
* Allows to override player swimming animations.
|
|
865
|
+
* @realm shared
|
|
866
|
+
* @source https://wiki.facepunch.com/gmod/GM:HandlePlayerSwimming
|
|
867
|
+
*/
|
|
868
|
+
HandlePlayerSwimming(self: GM, ply: Player, velocity: Vector): boolean;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
interface GM {
|
|
872
|
+
/**
|
|
873
|
+
* Allows to override player flying ( in mid-air, not noclipping ) animations.
|
|
874
|
+
* @realm shared
|
|
875
|
+
* @source https://wiki.facepunch.com/gmod/GM:HandlePlayerVaulting
|
|
876
|
+
*/
|
|
877
|
+
HandlePlayerVaulting(self: GM, ply: Player, velocity: Vector): boolean;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
interface GM {
|
|
881
|
+
/**
|
|
882
|
+
* Hides the team selection panel.
|
|
883
|
+
* @realm client
|
|
884
|
+
* @source https://wiki.facepunch.com/gmod/GM:HideTeam
|
|
885
|
+
*/
|
|
886
|
+
HideTeam(self: GM): void;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
interface GM {
|
|
890
|
+
/**
|
|
891
|
+
* Called after all the entities are initialized. Starting from this hook [Global.LocalPlayer](https://wiki.facepunch.com/gmod/Global.LocalPlayer) will return valid object.
|
|
892
|
+
*
|
|
893
|
+
* **NOTE**: At this point the client only knows about the entities that are within the spawnpoints' [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS "PVS - Valve Developer Community"). For instance, if the server sends an entity that is not within this PVS, the client will receive it as NULL entity.
|
|
894
|
+
*
|
|
895
|
+
*
|
|
896
|
+
* @realm shared
|
|
897
|
+
* @source https://wiki.facepunch.com/gmod/GM:InitPostEntity
|
|
898
|
+
*/
|
|
899
|
+
InitPostEntity(self: GM): void;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
interface GM {
|
|
903
|
+
/**
|
|
904
|
+
* Called after the gamemode loads and starts.
|
|
905
|
+
*
|
|
906
|
+
* No entities would be present at the time this hook is called, please see [GM:InitPostEntity](https://wiki.facepunch.com/gmod/GM:InitPostEntity) for a one time fire hook after all map entities have been initialized.
|
|
907
|
+
* @realm shared
|
|
908
|
+
* @source https://wiki.facepunch.com/gmod/GM:Initialize
|
|
909
|
+
*/
|
|
910
|
+
Initialize(self: GM): void;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
interface GM {
|
|
914
|
+
/**
|
|
915
|
+
* Allows you to modify the supplied User Command with mouse input. This could be used to make moving the mouse do funky things to view angles.
|
|
916
|
+
* @realm client
|
|
917
|
+
* @source https://wiki.facepunch.com/gmod/GM:InputMouseApply
|
|
918
|
+
*/
|
|
919
|
+
InputMouseApply(self: GM, cmd: CUserCmd, x: number, y: number, ang: Angle): boolean;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
interface GM {
|
|
923
|
+
/**
|
|
924
|
+
* Check if a player can spawn at a certain spawnpoint.
|
|
925
|
+
* @realm server
|
|
926
|
+
* @source https://wiki.facepunch.com/gmod/GM:IsSpawnpointSuitable
|
|
927
|
+
*/
|
|
928
|
+
IsSpawnpointSuitable(self: GM, ply: Player, spawnpoint: Entity, makeSuitable: boolean): boolean;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
interface GM {
|
|
932
|
+
/**
|
|
933
|
+
* Called whenever a player pressed a key included within the IN keys.
|
|
934
|
+
*
|
|
935
|
+
* For a more general purpose function that handles all kinds of input, see [GM:PlayerButtonDown](https://wiki.facepunch.com/gmod/GM:PlayerButtonDown).
|
|
936
|
+
* See [GM:KeyRelease](https://wiki.facepunch.com/gmod/GM:KeyRelease) for the key release event.
|
|
937
|
+
*
|
|
938
|
+
* Despite being a predicted hook, it will still be called in singleplayer for your convenience.
|
|
939
|
+
*
|
|
940
|
+
* **WARNING**: Due to this being a predicted hook, [Global.ParticleEffect](https://wiki.facepunch.com/gmod/Global.ParticleEffect)s created only serverside from this hook will not be networked to the client, so make sure to do that on both realms.
|
|
941
|
+
*
|
|
942
|
+
*
|
|
943
|
+
* @realm shared
|
|
944
|
+
* @source https://wiki.facepunch.com/gmod/GM:KeyPress
|
|
945
|
+
*/
|
|
946
|
+
KeyPress(self: GM, ply: Player, key: number): void;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
interface GM {
|
|
950
|
+
/**
|
|
951
|
+
* Runs when a IN key was released by a player.
|
|
952
|
+
*
|
|
953
|
+
* For a more general purpose function that handles all kinds of input, see [GM:PlayerButtonUp](https://wiki.facepunch.com/gmod/GM:PlayerButtonUp).
|
|
954
|
+
* See [GM:KeyPress](https://wiki.facepunch.com/gmod/GM:KeyPress) for the key press event.
|
|
955
|
+
*
|
|
956
|
+
* Despite being a predicted hook, it will still be called in singleplayer for your convenience.
|
|
957
|
+
*
|
|
958
|
+
* @realm shared
|
|
959
|
+
* @source https://wiki.facepunch.com/gmod/GM:KeyRelease
|
|
960
|
+
*/
|
|
961
|
+
KeyRelease(self: GM, ply: Player, key: number): void;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
interface GM {
|
|
965
|
+
/**
|
|
966
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
967
|
+
* Called from `gm_load` when the game should load a map.
|
|
968
|
+
* @realm server
|
|
969
|
+
* @source https://wiki.facepunch.com/gmod/GM:LoadGModSave
|
|
970
|
+
*/
|
|
971
|
+
LoadGModSave(self: GM, data: string, map: string, timestamp: number): void;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
interface GM {
|
|
975
|
+
/**
|
|
976
|
+
* Called while an addon from the Steam workshop is downloading. Used by default to update details on the fancy workshop download panel.
|
|
977
|
+
* @realm menu
|
|
978
|
+
* @source https://wiki.facepunch.com/gmod/GM:LoadGModSaveFailed
|
|
979
|
+
*/
|
|
980
|
+
LoadGModSaveFailed(self: GM, reason: string, workshopid: string): void;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
interface GM {
|
|
984
|
+
/**
|
|
985
|
+
* Called when `menu.lua` has finished loading.
|
|
986
|
+
* @realm menu
|
|
987
|
+
* @source https://wiki.facepunch.com/gmod/GM:MenuStart
|
|
988
|
+
*/
|
|
989
|
+
MenuStart(self: GM): void;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
interface GM {
|
|
993
|
+
/**
|
|
994
|
+
* Override this gamemode function to disable mouth movement when talking on voice chat. By default, it is not called anywhere on the server.
|
|
995
|
+
* @realm shared
|
|
996
|
+
* @source https://wiki.facepunch.com/gmod/GM:MouthMoveAnimation
|
|
997
|
+
*/
|
|
998
|
+
MouthMoveAnimation(self: GM, ply: Player): void;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
interface GM {
|
|
1002
|
+
/**
|
|
1003
|
+
* The Move hook is called for you to manipulate the player's MoveData.
|
|
1004
|
+
*
|
|
1005
|
+
* You shouldn't adjust the player's position in any way in the move hook. This is because due to prediction errors, the netcode might run the move hook multiple times as packets arrive late. Therefore you should only adjust the movedata construct in this hook.
|
|
1006
|
+
*
|
|
1007
|
+
* Generally you shouldn't have to use this hook - if you want to make a custom move type you should look at the drive system.
|
|
1008
|
+
*
|
|
1009
|
+
* This hook is called after [GM:PlayerTick](https://wiki.facepunch.com/gmod/GM:PlayerTick).
|
|
1010
|
+
*
|
|
1011
|
+
* See [Game Movement](https://wiki.facepunch.com/gmod/Game_Movement) for an explanation on the move system.
|
|
1012
|
+
*
|
|
1013
|
+
* @realm shared
|
|
1014
|
+
* @source https://wiki.facepunch.com/gmod/GM:Move
|
|
1015
|
+
*/
|
|
1016
|
+
Move(self: GM, ply: Player, mv: CMoveData): boolean;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
interface GM {
|
|
1020
|
+
/**
|
|
1021
|
+
* Returning true in this hook will cause it to render depth buffers defined with [render.GetResolvedFullFrameDepth](https://wiki.facepunch.com/gmod/render.GetResolvedFullFrameDepth).
|
|
1022
|
+
* @realm client
|
|
1023
|
+
* @source https://wiki.facepunch.com/gmod/GM:NeedsDepthPass
|
|
1024
|
+
*/
|
|
1025
|
+
NeedsDepthPass(self: GM): boolean;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
interface GM {
|
|
1029
|
+
/**
|
|
1030
|
+
* Called when an entity has been created over the network.
|
|
1031
|
+
* @realm client
|
|
1032
|
+
* @source https://wiki.facepunch.com/gmod/GM:NetworkEntityCreated
|
|
1033
|
+
*/
|
|
1034
|
+
NetworkEntityCreated(self: GM, ent: Entity): void;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
interface GM {
|
|
1038
|
+
/**
|
|
1039
|
+
* Called when a player's SteamID has been validated by Steam.
|
|
1040
|
+
*
|
|
1041
|
+
* See also [GM:PlayerAuthed](https://wiki.facepunch.com/gmod/GM:PlayerAuthed) and [Player:IsFullyAuthenticated](https://wiki.facepunch.com/gmod/Player:IsFullyAuthenticated).
|
|
1042
|
+
*
|
|
1043
|
+
* **NOTE**: This hook doesn't work intentionally in singleplayer [because the SteamID is not validated](https://github.com/Facepunch/garrysmod-issues/issues/4906#issuecomment-819337130) in that case. This also applies to `sv_lan 1` servers for every duplicate `-multirun` client.
|
|
1044
|
+
*
|
|
1045
|
+
*
|
|
1046
|
+
* @realm server
|
|
1047
|
+
* @source https://wiki.facepunch.com/gmod/GM:NetworkIDValidated
|
|
1048
|
+
*/
|
|
1049
|
+
NetworkIDValidated(self: GM, name: string, steamID: string, ownerID: string): void;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
interface GM {
|
|
1053
|
+
/**
|
|
1054
|
+
* Called whenever this entity changes its transmission state for this [Global.LocalPlayer](https://wiki.facepunch.com/gmod/Global.LocalPlayer), such as exiting or re entering the [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS "PVS - Valve Developer Community").
|
|
1055
|
+
*
|
|
1056
|
+
* **NOTE**: This is the best place to handle the reset of [Entity:SetPredictable](https://wiki.facepunch.com/gmod/Entity:SetPredictable), as this would be usually called when the player lags and requests a full packet update.
|
|
1057
|
+
*
|
|
1058
|
+
* When the entity stops transmitting, [Entity:IsDormant](https://wiki.facepunch.com/gmod/Entity:IsDormant) will only return true **after** this hook.
|
|
1059
|
+
*
|
|
1060
|
+
*
|
|
1061
|
+
* @realm client
|
|
1062
|
+
* @source https://wiki.facepunch.com/gmod/GM:NotifyShouldTransmit
|
|
1063
|
+
*/
|
|
1064
|
+
NotifyShouldTransmit(self: GM, entity: Entity, shouldtransmit: boolean): void;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
interface GM {
|
|
1068
|
+
/**
|
|
1069
|
+
* Called when a player has achieved an achievement. You can get the name and other information from an achievement ID with the [achievements](https://wiki.facepunch.com/gmod/achievements) library.
|
|
1070
|
+
* @realm client
|
|
1071
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnAchievementAchieved
|
|
1072
|
+
*/
|
|
1073
|
+
OnAchievementAchieved(self: GM, ply: Player, achievement: number): void;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
interface GM {
|
|
1077
|
+
/**
|
|
1078
|
+
* Called when the local player presses TAB while having their chatbox opened.
|
|
1079
|
+
*
|
|
1080
|
+
* **WARNING**: This function now uses [player.Iterator](https://wiki.facepunch.com/gmod/player.Iterator). This means it can't run all the time, as an error in the [GM:OnEntityCreated](https://wiki.facepunch.com/gmod/GM:OnEntityCreated) or [GM:EntityRemoved](https://wiki.facepunch.com/gmod/GM:EntityRemoved) hooks is likely to interrupt it. Make sure that no addon causes an error in these hooks.
|
|
1081
|
+
*
|
|
1082
|
+
*
|
|
1083
|
+
* @realm client
|
|
1084
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnChatTab
|
|
1085
|
+
*/
|
|
1086
|
+
OnChatTab(self: GM, text: string): string;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
interface GM {
|
|
1090
|
+
/**
|
|
1091
|
+
* Called when the player cleans up something.
|
|
1092
|
+
* @realm client
|
|
1093
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnCleanup
|
|
1094
|
+
*/
|
|
1095
|
+
OnCleanup(self: GM, name: string): boolean;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
interface GM {
|
|
1099
|
+
/**
|
|
1100
|
+
* Called on the server when a Lua error occurs on a client and is sent to the server.
|
|
1101
|
+
*
|
|
1102
|
+
* This hook allows server-side code to detect and log client-side errors.
|
|
1103
|
+
*
|
|
1104
|
+
* See [GM:OnLuaError](https://wiki.facepunch.com/gmod/GM:OnLuaError) for a hook that captures Lua errors directly within its [realm](https://wiki.facepunch.com/gmod/States).
|
|
1105
|
+
*
|
|
1106
|
+
* **WARNING**: Note that the stack argument can contain a table with 0 values.
|
|
1107
|
+
*
|
|
1108
|
+
* **NOTE**: Warning: the hook "protects" against lua error spam. If it has 5 errors in less than 1 second, the hook will not receive any of these 4 errors.
|
|
1109
|
+
*
|
|
1110
|
+
*
|
|
1111
|
+
*
|
|
1112
|
+
* @realm server
|
|
1113
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnClientLuaError
|
|
1114
|
+
*/
|
|
1115
|
+
OnClientLuaError(self: GM, error: string, ply: Player, stack: table, name: string): void;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
interface GM {
|
|
1119
|
+
/**
|
|
1120
|
+
* Called when a caption/subtitle has been emitted to the closed caption box.
|
|
1121
|
+
* @realm client
|
|
1122
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnCloseCaptionEmit
|
|
1123
|
+
*/
|
|
1124
|
+
OnCloseCaptionEmit(self: GM, soundScript: string, duration: number, fromPlayer: boolean, fullText: string): boolean;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
interface GM {
|
|
1128
|
+
/**
|
|
1129
|
+
* Called when the context menu keybind (+menu_context) is released, which by default is C.
|
|
1130
|
+
*
|
|
1131
|
+
* This hook will not run if [input.IsKeyTrapping](https://wiki.facepunch.com/gmod/input.IsKeyTrapping) returns true.
|
|
1132
|
+
*
|
|
1133
|
+
* See also [GM:OnContextMenuOpen](https://wiki.facepunch.com/gmod/GM:OnContextMenuOpen).
|
|
1134
|
+
*
|
|
1135
|
+
* @realm client
|
|
1136
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnContextMenuClose
|
|
1137
|
+
*/
|
|
1138
|
+
OnContextMenuClose(self: GM): void;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
interface GM {
|
|
1142
|
+
/**
|
|
1143
|
+
* Called when the context menu keybind (`+menu_context`) is pressed, which by default is C.
|
|
1144
|
+
*
|
|
1145
|
+
* See also [GM:OnContextMenuClose](https://wiki.facepunch.com/gmod/GM:OnContextMenuClose).
|
|
1146
|
+
*
|
|
1147
|
+
* @realm client
|
|
1148
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnContextMenuOpen
|
|
1149
|
+
*/
|
|
1150
|
+
OnContextMenuOpen(self: GM): void;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
interface GM {
|
|
1154
|
+
/**
|
|
1155
|
+
* Called when the crazy physics detection detects an entity with crazy physics, i.e. position being far outside of the map, velocities being near or at infinity, etc. The primary reason for this system is to prevent program crashes in physics engine.
|
|
1156
|
+
* @realm shared
|
|
1157
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnCrazyPhysics
|
|
1158
|
+
*/
|
|
1159
|
+
OnCrazyPhysics(self: GM, ent: Entity, physobj: PhysObj): void;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
interface GM {
|
|
1163
|
+
/**
|
|
1164
|
+
* Called when a player has been hurt by an explosion. Override to disable default sound effect.
|
|
1165
|
+
* @realm server
|
|
1166
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnDamagedByExplosion
|
|
1167
|
+
*/
|
|
1168
|
+
OnDamagedByExplosion(self: GM, ply: Player, dmginfo: CTakeDamageInfo): void;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
interface GM {
|
|
1172
|
+
/**
|
|
1173
|
+
* Called as soon as the entity is created. Very little of the entity's properties will be initialized at this stage. (keyvalues, classname, flags, anything), especially on the serverside.
|
|
1174
|
+
*
|
|
1175
|
+
* **WARNING**: Removing the created entity during this event can lead to unexpected problems. Use [Global.SafeRemoveEntityDelayed](https://wiki.facepunch.com/gmod/Global.SafeRemoveEntityDelayed)( entity, 0 ) to safely remove the entity.
|
|
1176
|
+
*
|
|
1177
|
+
*
|
|
1178
|
+
* @realm shared
|
|
1179
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnEntityCreated
|
|
1180
|
+
*/
|
|
1181
|
+
OnEntityCreated(self: GM, entity: Entity): void;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
interface GM {
|
|
1185
|
+
/**
|
|
1186
|
+
* Called when the [Entity:WaterLevel](https://wiki.facepunch.com/gmod/Entity:WaterLevel) of an entity is changed.
|
|
1187
|
+
*
|
|
1188
|
+
* 0 - The entity isn't in water.
|
|
1189
|
+
*
|
|
1190
|
+
* 1 - Slightly submerged (at least to the feet).
|
|
1191
|
+
*
|
|
1192
|
+
* 2 - The majority of the entity is submerged (at least to the waist).
|
|
1193
|
+
*
|
|
1194
|
+
* 3 - Completely submerged.
|
|
1195
|
+
*
|
|
1196
|
+
* **WARNING**: This hook can be considered a physics callback, so changing collision rules ([Entity:SetSolidFlags](https://wiki.facepunch.com/gmod/Entity:SetSolidFlags)) in it may lead to a crash!
|
|
1197
|
+
*
|
|
1198
|
+
*
|
|
1199
|
+
* @realm server
|
|
1200
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnEntityWaterLevelChanged
|
|
1201
|
+
*/
|
|
1202
|
+
OnEntityWaterLevelChanged(self: GM, entity: Entity, old: number, _new: number): void;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
interface GM {
|
|
1206
|
+
/**
|
|
1207
|
+
* Called when the gamemode is loaded. [gmod.GetGamemode](https://wiki.facepunch.com/gmod/gmod.GetGamemode) will be functional at this point.
|
|
1208
|
+
*
|
|
1209
|
+
* [Global.LocalPlayer](https://wiki.facepunch.com/gmod/Global.LocalPlayer)() returns NULL at the time this is run.
|
|
1210
|
+
*
|
|
1211
|
+
* @realm shared
|
|
1212
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnGamemodeLoaded
|
|
1213
|
+
*/
|
|
1214
|
+
OnGamemodeLoaded(self: GM): void;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
interface GM {
|
|
1218
|
+
/**
|
|
1219
|
+
* Called when a Lua error occurs.
|
|
1220
|
+
* If you want to retrieve client errors on the server side, you can use this hook: [GM:OnClientLuaError](https://wiki.facepunch.com/gmod/GM:OnClientLuaError)
|
|
1221
|
+
* **NOTE**: On the [server realm](https://wiki.facepunch.com/gmod/States), this hook will only account for server-side errors, not client-side ones.
|
|
1222
|
+
*
|
|
1223
|
+
*
|
|
1224
|
+
* @realm shared and menu
|
|
1225
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnLuaError
|
|
1226
|
+
*/
|
|
1227
|
+
OnLuaError(self: GM, error: string, realm: string, stack: table, name: string, id: string): void;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
interface GM {
|
|
1231
|
+
/**
|
|
1232
|
+
* Called whenever an NPC drops an item upon its death, such as health kits, armor batteries, etc.
|
|
1233
|
+
*
|
|
1234
|
+
* It will NOT be called for dropped weapons, with exception of Half-Life: Source NPCs, since they don't use actual weapon entities and create a weapon entity on death.
|
|
1235
|
+
* [GM:PlayerDroppedWeapon](https://wiki.facepunch.com/gmod/GM:PlayerDroppedWeapon) works for NPC weapon drops already. (Yes, it's not a typo)
|
|
1236
|
+
*
|
|
1237
|
+
* It will also not be called for live grenades spawned by Zombine.
|
|
1238
|
+
*
|
|
1239
|
+
* @realm server
|
|
1240
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnNPCDropItem
|
|
1241
|
+
*/
|
|
1242
|
+
OnNPCDropItem(self: GM, npc: NPC, item: Entity): void;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
interface GM {
|
|
1246
|
+
/**
|
|
1247
|
+
* Called whenever an NPC is killed.
|
|
1248
|
+
* @realm server
|
|
1249
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnNPCKilled
|
|
1250
|
+
*/
|
|
1251
|
+
OnNPCKilled(self: GM, npc: NPC, attacker: Entity, inflictor: Entity): void;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
interface GM {
|
|
1255
|
+
/**
|
|
1256
|
+
* Called when a Addon Conflict occurs, only works in the Menu realm.
|
|
1257
|
+
*
|
|
1258
|
+
* @realm menu
|
|
1259
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnNotifyAddonConflict
|
|
1260
|
+
*/
|
|
1261
|
+
OnNotifyAddonConflict(self: GM, addon1: string, addon2: string, fileName: string): void;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
interface GM {
|
|
1265
|
+
/**
|
|
1266
|
+
* Called when the main menu has been blocked by [GM:OnPauseMenuShow](https://wiki.facepunch.com/gmod/GM:OnPauseMenuShow) four times in a small interval. This is used internally to explain to the user that they can hold SHIFT to force open the main menu.
|
|
1267
|
+
*
|
|
1268
|
+
* @realm menu
|
|
1269
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnPauseMenuBlockedTooManyTimes
|
|
1270
|
+
*/
|
|
1271
|
+
OnPauseMenuBlockedTooManyTimes(self: GM): void;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
interface GM {
|
|
1275
|
+
/**
|
|
1276
|
+
* Called when the pause menu is attempting to be opened. Allows you to prevent the main menu from being opened that time.
|
|
1277
|
+
*
|
|
1278
|
+
* The user can hold SHIFT to not call this hook. If the main menu is blocked multiple times in short succession, a warning will be displayed to the end user on how to bypass the hook.
|
|
1279
|
+
*
|
|
1280
|
+
* @realm client
|
|
1281
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnPauseMenuShow
|
|
1282
|
+
*/
|
|
1283
|
+
OnPauseMenuShow(self: GM): boolean;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
interface GM {
|
|
1287
|
+
/**
|
|
1288
|
+
* Called when a permission gets Granted or Revoked.
|
|
1289
|
+
*
|
|
1290
|
+
* @realm menu
|
|
1291
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnPermissionsChanged
|
|
1292
|
+
*/
|
|
1293
|
+
OnPermissionsChanged(self: GM): void;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
interface GM {
|
|
1297
|
+
/**
|
|
1298
|
+
* Called when a player freezes an entity with the physgun.
|
|
1299
|
+
*
|
|
1300
|
+
* @realm server
|
|
1301
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnPhysgunFreeze
|
|
1302
|
+
*/
|
|
1303
|
+
OnPhysgunFreeze(self: GM, weapon: Entity, physobj: PhysObj, ent: Entity, ply: Player): boolean;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
interface GM {
|
|
1307
|
+
/**
|
|
1308
|
+
* Called to when a player has successfully picked up an entity with their Physics Gun.
|
|
1309
|
+
*
|
|
1310
|
+
* Not to be confused with [GM:PhysgunPickup](https://wiki.facepunch.com/gmod/GM:PhysgunPickup) which is called to ask if the player should be able to pick up an entity.
|
|
1311
|
+
*
|
|
1312
|
+
*
|
|
1313
|
+
* See [GM:GravGunOnPickedUp](https://wiki.facepunch.com/gmod/GM:GravGunOnPickedUp) for the Gravity Gun pickup variant.
|
|
1314
|
+
* See [GM:OnPlayerPhysicsPickup](https://wiki.facepunch.com/gmod/GM:OnPlayerPhysicsPickup) for the player `+use` pickup variant.
|
|
1315
|
+
*
|
|
1316
|
+
*
|
|
1317
|
+
* @realm server
|
|
1318
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnPhysgunPickup
|
|
1319
|
+
*/
|
|
1320
|
+
OnPhysgunPickup(self: GM, ply: Player, ent: Entity): void;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
interface GM {
|
|
1324
|
+
/**
|
|
1325
|
+
* Called when a player reloads with the physgun. Override this to disable default unfreezing behavior.
|
|
1326
|
+
* @realm server
|
|
1327
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnPhysgunReload
|
|
1328
|
+
*/
|
|
1329
|
+
OnPhysgunReload(self: GM, physgun: Weapon, ply: Player): boolean;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
interface GM {
|
|
1333
|
+
/**
|
|
1334
|
+
* Called when a player has changed team using [GM:PlayerJoinTeam](https://wiki.facepunch.com/gmod/GM:PlayerJoinTeam).
|
|
1335
|
+
*
|
|
1336
|
+
* **WARNING**: This hook will not work with [hook.Add](https://wiki.facepunch.com/gmod/hook.Add) and it is only called manually from [GM:PlayerJoinTeam](https://wiki.facepunch.com/gmod/GM:PlayerJoinTeam) by the base gamemode
|
|
1337
|
+
*
|
|
1338
|
+
*
|
|
1339
|
+
* @realm server
|
|
1340
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnPlayerChangedTeam
|
|
1341
|
+
* @deprecated Use GM:PlayerChangedTeam instead, which works for every Player:SetTeam call.
|
|
1342
|
+
*/
|
|
1343
|
+
OnPlayerChangedTeam(self: GM, ply: Player, oldTeam: number, newTeam: number): void;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
interface GM {
|
|
1347
|
+
/**
|
|
1348
|
+
* Called whenever a player sends a chat message. For the serverside equivalent, see [GM:PlayerSay](https://wiki.facepunch.com/gmod/GM:PlayerSay).
|
|
1349
|
+
* **NOTE**: The input (or suppression) of this hook is based on the output from [GM:PlayerSay](https://wiki.facepunch.com/gmod/GM:PlayerSay). Chat events suppressed serverside do not call this hook.
|
|
1350
|
+
*
|
|
1351
|
+
*
|
|
1352
|
+
* @realm client
|
|
1353
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnPlayerChat
|
|
1354
|
+
*/
|
|
1355
|
+
OnPlayerChat(self: GM, ply: Player, text: string, teamChat: boolean, isDead: boolean): boolean;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
interface GM {
|
|
1359
|
+
/**
|
|
1360
|
+
* Called when a player makes contact with the ground after a jump or a fall.
|
|
1361
|
+
* @realm shared
|
|
1362
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnPlayerHitGround
|
|
1363
|
+
*/
|
|
1364
|
+
OnPlayerHitGround(self: GM, player: Entity, inWater: boolean, onFloater: boolean, speed: number): boolean;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
interface GM {
|
|
1368
|
+
/**
|
|
1369
|
+
* Called when a player jumps.
|
|
1370
|
+
* @realm shared
|
|
1371
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnPlayerJump
|
|
1372
|
+
*/
|
|
1373
|
+
OnPlayerJump(self: GM, player: Entity, speed: number): void;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
interface GM {
|
|
1377
|
+
/**
|
|
1378
|
+
* Called when a player +use drops an entity.
|
|
1379
|
+
* @realm server
|
|
1380
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnPlayerPhysicsDrop
|
|
1381
|
+
*/
|
|
1382
|
+
OnPlayerPhysicsDrop(self: GM, ply: Player, ent: Entity, thrown: boolean): void;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
interface GM {
|
|
1386
|
+
/**
|
|
1387
|
+
* Called when a player +use pickups up an entity. This will be called after the entity passes though [GM:AllowPlayerPickup](https://wiki.facepunch.com/gmod/GM:AllowPlayerPickup).
|
|
1388
|
+
*
|
|
1389
|
+
* See [GM:GravGunOnPickedUp](https://wiki.facepunch.com/gmod/GM:GravGunOnPickedUp) for the Gravity Gun pickup variant.
|
|
1390
|
+
* See [GM:OnPhysgunPickup](https://wiki.facepunch.com/gmod/GM:OnPhysgunPickup) for the Physics Gun pickup variant.
|
|
1391
|
+
*
|
|
1392
|
+
* @realm server
|
|
1393
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnPlayerPhysicsPickup
|
|
1394
|
+
*/
|
|
1395
|
+
OnPlayerPhysicsPickup(self: GM, ply: Player, ent: Entity): void;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
interface GM {
|
|
1399
|
+
/**
|
|
1400
|
+
* Called when gamemode has been reloaded by auto refresh.
|
|
1401
|
+
*
|
|
1402
|
+
* **NOTE**: It seems that this event can be triggered more than once for a single refresh event.
|
|
1403
|
+
*
|
|
1404
|
+
*
|
|
1405
|
+
* @realm shared
|
|
1406
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnReloaded
|
|
1407
|
+
*/
|
|
1408
|
+
OnReloaded(self: GM): void;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
interface GM {
|
|
1412
|
+
/**
|
|
1413
|
+
* Called when the player's screen resolution of the game changes. This also called when changing MSAA settings.
|
|
1414
|
+
*
|
|
1415
|
+
* [Global.ScrW](https://wiki.facepunch.com/gmod/Global.ScrW) and [Global.ScrH](https://wiki.facepunch.com/gmod/Global.ScrH) will return the new values when this hook is called.
|
|
1416
|
+
*
|
|
1417
|
+
* @realm client
|
|
1418
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnScreenSizeChanged
|
|
1419
|
+
*/
|
|
1420
|
+
OnScreenSizeChanged(self: GM, oldWidth: number, oldHeight: number, newWidth: number, newHeight: number): void;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
interface GM {
|
|
1424
|
+
/**
|
|
1425
|
+
* Called when a player releases the `+menu` bind on their keyboard, which is bound to Q by default.
|
|
1426
|
+
* @realm client
|
|
1427
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnSpawnMenuClose
|
|
1428
|
+
*/
|
|
1429
|
+
OnSpawnMenuClose(self: GM): void;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
interface GM {
|
|
1433
|
+
/**
|
|
1434
|
+
* Called when a player presses the `+menu` bind on their keyboard, which is bound to Q by default.
|
|
1435
|
+
* @realm client
|
|
1436
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnSpawnMenuOpen
|
|
1437
|
+
*/
|
|
1438
|
+
OnSpawnMenuOpen(self: GM): void;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
interface GM {
|
|
1442
|
+
/**
|
|
1443
|
+
* Called when a [DTextEntry](https://wiki.facepunch.com/gmod/DTextEntry) gets focus.
|
|
1444
|
+
*
|
|
1445
|
+
* This hook is run from [DTextEntry:OnGetFocus](https://wiki.facepunch.com/gmod/DTextEntry:OnGetFocus) and [PANEL:OnMousePressed](https://wiki.facepunch.com/gmod/PANEL:OnMousePressed) of [DTextEntry](https://wiki.facepunch.com/gmod/DTextEntry).
|
|
1446
|
+
*
|
|
1447
|
+
* @realm client
|
|
1448
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnTextEntryGetFocus
|
|
1449
|
+
*/
|
|
1450
|
+
OnTextEntryGetFocus(self: GM, panel: Panel): void;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
interface GM {
|
|
1454
|
+
/**
|
|
1455
|
+
* Called when a [DTextEntry](https://wiki.facepunch.com/gmod/DTextEntry) loses focus.
|
|
1456
|
+
* @realm client
|
|
1457
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnTextEntryLoseFocus
|
|
1458
|
+
*/
|
|
1459
|
+
OnTextEntryLoseFocus(self: GM, panel: Panel): void;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
interface GM {
|
|
1463
|
+
/**
|
|
1464
|
+
* Called when the player undoes something.
|
|
1465
|
+
* @realm client
|
|
1466
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnUndo
|
|
1467
|
+
*/
|
|
1468
|
+
OnUndo(self: GM, name: string, customText: string): boolean;
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
interface GM {
|
|
1472
|
+
/**
|
|
1473
|
+
* Called when the player changes their weapon to another one - and their viewmodel model changes.
|
|
1474
|
+
*
|
|
1475
|
+
* This is not always called clientside.
|
|
1476
|
+
*
|
|
1477
|
+
* @realm shared
|
|
1478
|
+
* @source https://wiki.facepunch.com/gmod/GM:OnViewModelChanged
|
|
1479
|
+
*/
|
|
1480
|
+
OnViewModelChanged(self: GM, viewmodel: Entity, oldModel: string, newModel: string): void;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
interface GM {
|
|
1484
|
+
/**
|
|
1485
|
+
* Called when a player drops an entity with the Physgun.
|
|
1486
|
+
*
|
|
1487
|
+
* See [GM:GravGunOnDropped](https://wiki.facepunch.com/gmod/GM:GravGunOnDropped) for the Gravity Gun drop variant.
|
|
1488
|
+
*
|
|
1489
|
+
* @realm shared
|
|
1490
|
+
* @source https://wiki.facepunch.com/gmod/GM:PhysgunDrop
|
|
1491
|
+
*/
|
|
1492
|
+
PhysgunDrop(self: GM, player: Player, entity: Entity): void;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
interface GM {
|
|
1496
|
+
/**
|
|
1497
|
+
* Called to determine if a player should be able to pick up an entity with the Physics Gun.
|
|
1498
|
+
*
|
|
1499
|
+
* See [GM:OnPhysgunPickup](https://wiki.facepunch.com/gmod/GM:OnPhysgunPickup) for a hook which is called when a player has successfully picked up an entity.
|
|
1500
|
+
*
|
|
1501
|
+
* See [GM:GravGunPickupAllowed](https://wiki.facepunch.com/gmod/GM:GravGunPickupAllowed) for the Gravity Gun pickup variant.
|
|
1502
|
+
* See [GM:AllowPlayerPickup](https://wiki.facepunch.com/gmod/GM:AllowPlayerPickup) for the `+USE` pickup variant.
|
|
1503
|
+
*
|
|
1504
|
+
* @realm shared
|
|
1505
|
+
* @source https://wiki.facepunch.com/gmod/GM:PhysgunPickup
|
|
1506
|
+
*/
|
|
1507
|
+
PhysgunPickup(self: GM, player: Player, entity: Entity): boolean;
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
interface GM {
|
|
1511
|
+
/**
|
|
1512
|
+
* Called after player's reserve ammo count changes.
|
|
1513
|
+
*
|
|
1514
|
+
* @realm shared
|
|
1515
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerAmmoChanged
|
|
1516
|
+
*/
|
|
1517
|
+
PlayerAmmoChanged(self: GM, ply: Player, ammoID: number, oldCount: number, newCount: number): void;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
interface GM {
|
|
1521
|
+
/**
|
|
1522
|
+
* Called after the player gets their [Player:UniqueID](https://wiki.facepunch.com/gmod/Player:UniqueID) set for the first time. This hook will also be called in singleplayer.
|
|
1523
|
+
*
|
|
1524
|
+
* See [GM:NetworkIDValidated](https://wiki.facepunch.com/gmod/GM:NetworkIDValidated) for a hook that is called with the player's SteamID is validated by Steam.
|
|
1525
|
+
*
|
|
1526
|
+
* @realm server
|
|
1527
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerAuthed
|
|
1528
|
+
*/
|
|
1529
|
+
PlayerAuthed(self: GM, ply: Player, steamid: string, uniqueid: string): void;
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
interface GM {
|
|
1533
|
+
/**
|
|
1534
|
+
* Runs when a bind has been pressed. Allows to block commands.
|
|
1535
|
+
*
|
|
1536
|
+
* **NOTE**: By using the "alias" console command, this hook can be effectively circumvented. To prevent this use [input.TranslateAlias](https://wiki.facepunch.com/gmod/input.TranslateAlias).
|
|
1537
|
+
*
|
|
1538
|
+
* To stop the user from using `+attack`, `+left` and any other movement commands of the sort, please look into using [GM:StartCommand](https://wiki.facepunch.com/gmod/GM:StartCommand) instead.
|
|
1539
|
+
*
|
|
1540
|
+
*
|
|
1541
|
+
* The third argument will always be true.
|
|
1542
|
+
*
|
|
1543
|
+
* This does not run for function keys binds (F1-F12).
|
|
1544
|
+
*
|
|
1545
|
+
* @realm client
|
|
1546
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerBindPress
|
|
1547
|
+
*/
|
|
1548
|
+
PlayerBindPress(self: GM, ply: Player, bind: string, pressed: boolean, code: number): boolean;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
interface GM {
|
|
1552
|
+
/**
|
|
1553
|
+
* Called when a player presses a button.
|
|
1554
|
+
*
|
|
1555
|
+
* This will not be called if player has a panel opened with keyboard input enabled, use [PANEL:OnKeyCodePressed](https://wiki.facepunch.com/gmod/PANEL:OnKeyCodePressed) instead.
|
|
1556
|
+
*
|
|
1557
|
+
* See [GM:KeyPress](https://wiki.facepunch.com/gmod/GM:KeyPress) for an alternative that uses [Enums/IN](https://wiki.facepunch.com/gmod/Enums/IN).
|
|
1558
|
+
* See [GM:PlayerButtonUp](https://wiki.facepunch.com/gmod/GM:PlayerButtonUp) for the "key release" event.
|
|
1559
|
+
*
|
|
1560
|
+
* @realm shared
|
|
1561
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerButtonDown
|
|
1562
|
+
*/
|
|
1563
|
+
PlayerButtonDown(self: GM, ply: Player, button: BUTTON_CODE): void;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
interface GM {
|
|
1567
|
+
/**
|
|
1568
|
+
* Called when a player releases a button.
|
|
1569
|
+
*
|
|
1570
|
+
* This will not be called if player has a panel opened with keyboard input enabled, use [PANEL:OnKeyCodeReleased](https://wiki.facepunch.com/gmod/PANEL:OnKeyCodeReleased) instead.
|
|
1571
|
+
*
|
|
1572
|
+
* See [GM:KeyRelease](https://wiki.facepunch.com/gmod/GM:KeyRelease) for an alternative that uses [Enums/IN](https://wiki.facepunch.com/gmod/Enums/IN).
|
|
1573
|
+
* See [GM:PlayerButtonDown](https://wiki.facepunch.com/gmod/GM:PlayerButtonDown) for the "key press" event.
|
|
1574
|
+
*
|
|
1575
|
+
* @realm shared
|
|
1576
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerButtonUp
|
|
1577
|
+
*/
|
|
1578
|
+
PlayerButtonUp(self: GM, ply: Player, button: BUTTON_CODE): void;
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
interface GM {
|
|
1582
|
+
/**
|
|
1583
|
+
* Decides whether a player can hear another player using voice chat.
|
|
1584
|
+
*
|
|
1585
|
+
* **WARNING**: This hook is called **players count * speaking players count** times every 0.3 seconds if at least 1 player is talking or every 5 seconds if no one is talking.
|
|
1586
|
+
* You should ensure that your code is efficient, or this will definitely influence performance.
|
|
1587
|
+
*
|
|
1588
|
+
*
|
|
1589
|
+
* @realm server
|
|
1590
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerCanHearPlayersVoice
|
|
1591
|
+
*/
|
|
1592
|
+
PlayerCanHearPlayersVoice(self: GM, listener: Player, talker: Player): (boolean, boolean);
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
interface GM {
|
|
1596
|
+
/**
|
|
1597
|
+
* Returns whether or not a player is allowed to join a team
|
|
1598
|
+
* **WARNING**: This hook will not work with [hook.Add](https://wiki.facepunch.com/gmod/hook.Add) and it is only called manually from [GM:PlayerJoinTeam](https://wiki.facepunch.com/gmod/GM:PlayerJoinTeam) by the base gamemode
|
|
1599
|
+
*
|
|
1600
|
+
*
|
|
1601
|
+
* @realm server
|
|
1602
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerCanJoinTeam
|
|
1603
|
+
*/
|
|
1604
|
+
PlayerCanJoinTeam(self: GM, ply: Player, team: number): boolean;
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
interface GM {
|
|
1608
|
+
/**
|
|
1609
|
+
* Returns whether or not a player is allowed to pick an item up. (ammo, health, armor)
|
|
1610
|
+
*
|
|
1611
|
+
* This will typically only work for base game entities, unless mod authors that implement similar entities also manually call this hook.
|
|
1612
|
+
*
|
|
1613
|
+
* See [GM:PlayerCanPickupWeapon](https://wiki.facepunch.com/gmod/GM:PlayerCanPickupWeapon) for a hook that controls weapon pickups.
|
|
1614
|
+
*
|
|
1615
|
+
* @realm server
|
|
1616
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerCanPickupItem
|
|
1617
|
+
*/
|
|
1618
|
+
PlayerCanPickupItem(self: GM, ply: Player, item: Entity): boolean;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
interface GM {
|
|
1622
|
+
/**
|
|
1623
|
+
* Returns whether or not a player is allowed to pick up a weapon.
|
|
1624
|
+
*
|
|
1625
|
+
* If this returns `false`, [Player:Give](https://wiki.facepunch.com/gmod/Player:Give) won't work.
|
|
1626
|
+
*
|
|
1627
|
+
* See [GM:PlayerCanPickupItem](https://wiki.facepunch.com/gmod/GM:PlayerCanPickupItem) for a hook that affects things like health kits, armor batteries and ammo entities.
|
|
1628
|
+
*
|
|
1629
|
+
* See [GM:WeaponEquip](https://wiki.facepunch.com/gmod/GM:WeaponEquip) for a hook that is called when a player successfully picks up a weapon after passing this hook.
|
|
1630
|
+
*
|
|
1631
|
+
* @realm server
|
|
1632
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerCanPickupWeapon
|
|
1633
|
+
*/
|
|
1634
|
+
PlayerCanPickupWeapon(self: GM, ply: Player, weapon: Weapon): boolean;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
interface GM {
|
|
1638
|
+
/**
|
|
1639
|
+
* Returns whether or not the player can see the other player's chat.
|
|
1640
|
+
* **NOTE**: The **speaker** parameter does not have to be a valid [Player](https://wiki.facepunch.com/gmod/Player) object which happens when console messages are displayed for example.
|
|
1641
|
+
*
|
|
1642
|
+
* @realm server
|
|
1643
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerCanSeePlayersChat
|
|
1644
|
+
*/
|
|
1645
|
+
PlayerCanSeePlayersChat(self: GM, text: string, teamOnly: boolean, listener: Player, speaker: Player): boolean;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
interface GM {
|
|
1649
|
+
/**
|
|
1650
|
+
* Called when a player has changed team using [Player:SetTeam](https://wiki.facepunch.com/gmod/Player:SetTeam).
|
|
1651
|
+
* **WARNING**: Avoid calling [Player:SetTeam](https://wiki.facepunch.com/gmod/Player:SetTeam) in this hook as it may cause an infinite loop!
|
|
1652
|
+
*
|
|
1653
|
+
* **WARNING**: [Player:Team](https://wiki.facepunch.com/gmod/Player:Team) inside this hook will return `oldTeam`.
|
|
1654
|
+
*
|
|
1655
|
+
*
|
|
1656
|
+
* @realm server
|
|
1657
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerChangedTeam
|
|
1658
|
+
*/
|
|
1659
|
+
PlayerChangedTeam(self: GM, ply: Player, oldTeam: number, newTeam: number): void;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
interface GM {
|
|
1663
|
+
/**
|
|
1664
|
+
* Called whenever a player is about to spawn something to see if they hit a limit for whatever they are spawning.
|
|
1665
|
+
* **NOTE**: This hook will not be called in singleplayer, as singleplayer does not have limits.
|
|
1666
|
+
*
|
|
1667
|
+
* @realm shared
|
|
1668
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerCheckLimit
|
|
1669
|
+
*/
|
|
1670
|
+
PlayerCheckLimit(self: GM, ply: Player, limitName: string, current: number, defaultMax: number): boolean;
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
interface GM {
|
|
1674
|
+
/**
|
|
1675
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
1676
|
+
*
|
|
1677
|
+
*
|
|
1678
|
+
* Called whenever a player's class is changed on the server-side with [player_manager.SetPlayerClass](https://wiki.facepunch.com/gmod/player_manager.SetPlayerClass).
|
|
1679
|
+
*
|
|
1680
|
+
* @realm client
|
|
1681
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerClassChanged
|
|
1682
|
+
*/
|
|
1683
|
+
PlayerClassChanged(self: GM, ply: Player, newID: number): void;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
interface GM {
|
|
1687
|
+
/**
|
|
1688
|
+
* Executes when a player connects to the server. Called before the player has been assigned a [UserID](https://wiki.facepunch.com/gmod/Player:UserID) and entity. See the [player_connect](https://wiki.facepunch.com/gmod/gameevent/player_connect) gameevent for a version of this hook called after the player entity has been created.
|
|
1689
|
+
*
|
|
1690
|
+
* **NOTE**: This is only called clientside for listen server hosts.
|
|
1691
|
+
*
|
|
1692
|
+
* **NOTE**: This is not called clientside for the local player.
|
|
1693
|
+
*
|
|
1694
|
+
*
|
|
1695
|
+
* @realm shared
|
|
1696
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerConnect
|
|
1697
|
+
*/
|
|
1698
|
+
PlayerConnect(self: GM, name: string, ip: string): void;
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
interface GM {
|
|
1702
|
+
/**
|
|
1703
|
+
* Called when a player is killed by [Player:Kill](https://wiki.facepunch.com/gmod/Player:Kill) or any other normal means.
|
|
1704
|
+
*
|
|
1705
|
+
* This hook is **not** called if the player is killed by [Player:KillSilent](https://wiki.facepunch.com/gmod/Player:KillSilent). See [GM:PlayerSilentDeath](https://wiki.facepunch.com/gmod/GM:PlayerSilentDeath) for that.
|
|
1706
|
+
*
|
|
1707
|
+
* * [GM:DoPlayerDeath](https://wiki.facepunch.com/gmod/GM:DoPlayerDeath) is called **before** this hook.
|
|
1708
|
+
* * [GM:PostPlayerDeath](https://wiki.facepunch.com/gmod/GM:PostPlayerDeath) is called **after** this hook.
|
|
1709
|
+
*
|
|
1710
|
+
* See [Player:LastHitGroup](https://wiki.facepunch.com/gmod/Player:LastHitGroup) if you need to get the last hit hitgroup of the player.
|
|
1711
|
+
*
|
|
1712
|
+
* **NOTE**: [Player:Alive](https://wiki.facepunch.com/gmod/Player:Alive) will return false in this hook.
|
|
1713
|
+
*
|
|
1714
|
+
*
|
|
1715
|
+
*
|
|
1716
|
+
* @realm server
|
|
1717
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerDeath
|
|
1718
|
+
*/
|
|
1719
|
+
PlayerDeath(self: GM, victim: Player, inflictor: Entity, attacker: Entity): void;
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
interface GM {
|
|
1723
|
+
/**
|
|
1724
|
+
* Returns whether or not the default death sound should be muted.
|
|
1725
|
+
* @realm server
|
|
1726
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerDeathSound
|
|
1727
|
+
*/
|
|
1728
|
+
PlayerDeathSound(self: GM, ply: Player): boolean;
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
interface GM {
|
|
1732
|
+
/**
|
|
1733
|
+
* Called every think while the player is dead. The return value will determine if the player respawns.
|
|
1734
|
+
*
|
|
1735
|
+
* Overwriting this function will prevent players from respawning by pressing space or clicking.
|
|
1736
|
+
*
|
|
1737
|
+
* This hook is not called for players with the [FL_FROZEN](https://wiki.facepunch.com/gmod/Enums/FL) flag applied.
|
|
1738
|
+
*
|
|
1739
|
+
* @realm server
|
|
1740
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerDeathThink
|
|
1741
|
+
*/
|
|
1742
|
+
PlayerDeathThink(self: GM, ply: Player): boolean;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
interface GM {
|
|
1746
|
+
/**
|
|
1747
|
+
* Called when a player leaves the server. See the [player_disconnect gameevent](https://wiki.facepunch.com/gmod/gameevent/player_disconnect) for a shared version of this hook.
|
|
1748
|
+
*
|
|
1749
|
+
* This is not called in single-player or listen servers for the host.
|
|
1750
|
+
*
|
|
1751
|
+
* @realm server
|
|
1752
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerDisconnected
|
|
1753
|
+
*/
|
|
1754
|
+
PlayerDisconnected(self: GM, ply: Player): void;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
interface GM {
|
|
1758
|
+
/**
|
|
1759
|
+
* Called to update the player's animation during a drive.
|
|
1760
|
+
* @realm shared
|
|
1761
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerDriveAnimate
|
|
1762
|
+
*/
|
|
1763
|
+
PlayerDriveAnimate(self: GM, ply: Player): void;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
interface GM {
|
|
1767
|
+
/**
|
|
1768
|
+
* Called when a weapon is dropped by a player via [Player:DropWeapon](https://wiki.facepunch.com/gmod/Player:DropWeapon). Despite its name, this hook is also called for NPC weapon drops.
|
|
1769
|
+
*
|
|
1770
|
+
* Also called when a weapon is removed from a player via [Player:StripWeapon](https://wiki.facepunch.com/gmod/Player:StripWeapon).
|
|
1771
|
+
*
|
|
1772
|
+
* See also [GM:WeaponEquip](https://wiki.facepunch.com/gmod/GM:WeaponEquip) for a hook when a player picks up a weapon.
|
|
1773
|
+
*
|
|
1774
|
+
* The weapon's [Entity:GetOwner](https://wiki.facepunch.com/gmod/Entity:GetOwner) will be NULL at the time this hook is called.
|
|
1775
|
+
*
|
|
1776
|
+
* [WEAPON:OnDrop](https://wiki.facepunch.com/gmod/WEAPON:OnDrop) will be called before this hook is.
|
|
1777
|
+
*
|
|
1778
|
+
* @realm server
|
|
1779
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerDroppedWeapon
|
|
1780
|
+
*/
|
|
1781
|
+
PlayerDroppedWeapon(self: GM, owner: Player | NPC, wep: Weapon): void;
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
interface GM {
|
|
1785
|
+
/**
|
|
1786
|
+
* Called when player stops using voice chat.
|
|
1787
|
+
* @realm client
|
|
1788
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerEndVoice
|
|
1789
|
+
*/
|
|
1790
|
+
PlayerEndVoice(self: GM, ply: Player): void;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
interface GM {
|
|
1794
|
+
/**
|
|
1795
|
+
* Called when a player enters a vehicle.
|
|
1796
|
+
*
|
|
1797
|
+
* Called just after [GM:CanPlayerEnterVehicle](https://wiki.facepunch.com/gmod/GM:CanPlayerEnterVehicle).
|
|
1798
|
+
*
|
|
1799
|
+
* See also [GM:PlayerLeaveVehicle](https://wiki.facepunch.com/gmod/GM:PlayerLeaveVehicle).
|
|
1800
|
+
*
|
|
1801
|
+
* @realm server
|
|
1802
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerEnteredVehicle
|
|
1803
|
+
*/
|
|
1804
|
+
PlayerEnteredVehicle(self: GM, ply: Player, veh: Vehicle, role: number): void;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
interface GM {
|
|
1808
|
+
/**
|
|
1809
|
+
* Called before firing clientside animation events on a player model.
|
|
1810
|
+
*
|
|
1811
|
+
* See [GM:PlayerHandleAnimEvent](https://wiki.facepunch.com/gmod/GM:PlayerHandleAnimEvent) for the serverside version.
|
|
1812
|
+
*
|
|
1813
|
+
* @realm client
|
|
1814
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerFireAnimationEvent
|
|
1815
|
+
*/
|
|
1816
|
+
PlayerFireAnimationEvent(self: GM, ply: Player, pos: Vector, ang: Angle, event: number, name: string): boolean;
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
interface GM {
|
|
1820
|
+
/**
|
|
1821
|
+
* Called whenever a player steps. Return true to mute the normal sound.
|
|
1822
|
+
*
|
|
1823
|
+
* See [GM:PlayerStepSoundTime](https://wiki.facepunch.com/gmod/GM:PlayerStepSoundTime) for a related hook about footstep frequency.
|
|
1824
|
+
* **NOTE**: This hook is called on all clients.
|
|
1825
|
+
*
|
|
1826
|
+
*
|
|
1827
|
+
* @realm shared
|
|
1828
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerFootstep
|
|
1829
|
+
*/
|
|
1830
|
+
PlayerFootstep(self: GM, ply: Player, pos: Vector, foot: number, sound: string, volume: number, filter: CRecipientFilter): boolean;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
interface GM {
|
|
1834
|
+
/**
|
|
1835
|
+
* Called when a player freezes an object.
|
|
1836
|
+
* @realm server
|
|
1837
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerFrozeObject
|
|
1838
|
+
*/
|
|
1839
|
+
PlayerFrozeObject(self: GM, ply: Player, ent: Entity, physobj: PhysObj): void;
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
interface GM {
|
|
1843
|
+
/**
|
|
1844
|
+
* Called before firing serverside animation events on the player models.
|
|
1845
|
+
*
|
|
1846
|
+
* See [GM:PlayerFireAnimationEvent](https://wiki.facepunch.com/gmod/GM:PlayerFireAnimationEvent) for the clientside version.
|
|
1847
|
+
*
|
|
1848
|
+
* @realm server
|
|
1849
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerHandleAnimEvent
|
|
1850
|
+
*/
|
|
1851
|
+
PlayerHandleAnimEvent(self: GM, ply: Player, event: number, eventTime: number, cycle: number, type: number, options: string): void;
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
interface GM {
|
|
1855
|
+
/**
|
|
1856
|
+
* Called when a player gets hurt.
|
|
1857
|
+
* @realm server
|
|
1858
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerHurt
|
|
1859
|
+
*/
|
|
1860
|
+
PlayerHurt(self: GM, victim: Player, attacker: Entity, healthRemaining: number, damageTaken: number): void;
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
interface GM {
|
|
1864
|
+
/**
|
|
1865
|
+
* Called when the player spawns for the first time.
|
|
1866
|
+
*
|
|
1867
|
+
* See [GM:PlayerSpawn](https://wiki.facepunch.com/gmod/GM:PlayerSpawn) for a hook called every player spawn.
|
|
1868
|
+
*
|
|
1869
|
+
* **NOTE**: This hook is called before the player has fully loaded, when the player is still in seeing the `Starting Lua` screen. For example, trying to use the [Entity:GetModel](https://wiki.facepunch.com/gmod/Entity:GetModel) function will return the default model (`models/player.mdl`).
|
|
1870
|
+
*
|
|
1871
|
+
*
|
|
1872
|
+
* **WARNING**: Sending [net](https://wiki.facepunch.com/gmod/net) messages to the spawned player in this hook may cause them to be received before the player finishes loading, for example [Global.LocalPlayer](https://wiki.facepunch.com/gmod/Global.LocalPlayer) might return NULL since [GM:InitPostEntity](https://wiki.facepunch.com/gmod/GM:InitPostEntity) may have not been called yet clientside though the net message **won't** be lost and the client still should receive it (more information here: https://github.com/Facepunch/garrysmod-requests/issues/718).
|
|
1873
|
+
*
|
|
1874
|
+
* Workaround without networking:
|
|
1875
|
+
* ```
|
|
1876
|
+
* local load_queue = {}
|
|
1877
|
+
*
|
|
1878
|
+
* hook.Add( "PlayerInitialSpawn", "myAddonName/Load", function( ply )
|
|
1879
|
+
* load_queue[ ply ] = true
|
|
1880
|
+
* end )
|
|
1881
|
+
*
|
|
1882
|
+
* hook.Add( "StartCommand", "myAddonName/Load", function( ply, cmd )
|
|
1883
|
+
* if load_queue[ ply ] and not cmd:IsForced() then
|
|
1884
|
+
* load_queue[ ply ] = nil
|
|
1885
|
+
*
|
|
1886
|
+
* -- Send what you need here if it requires the client to be fully loaded!
|
|
1887
|
+
* end
|
|
1888
|
+
* end )
|
|
1889
|
+
* ```
|
|
1890
|
+
*
|
|
1891
|
+
*
|
|
1892
|
+
* With networking:
|
|
1893
|
+
* ```
|
|
1894
|
+
* -- CLIENT
|
|
1895
|
+
* hook.Add( "InitPostEntity", "Ready", function()
|
|
1896
|
+
* net.Start( "cool_addon_client_ready" )
|
|
1897
|
+
* net.SendToServer()
|
|
1898
|
+
* end )
|
|
1899
|
+
* ```
|
|
1900
|
+
* ```
|
|
1901
|
+
* -- SERVER
|
|
1902
|
+
* util.AddNetworkString( "cool_addon_client_ready" )
|
|
1903
|
+
*
|
|
1904
|
+
* net.Receive( "cool_addon_client_ready", function( len, ply )
|
|
1905
|
+
* -- Send what you need here!
|
|
1906
|
+
* end )
|
|
1907
|
+
* ```
|
|
1908
|
+
*
|
|
1909
|
+
*
|
|
1910
|
+
* @realm server
|
|
1911
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerInitialSpawn
|
|
1912
|
+
*/
|
|
1913
|
+
PlayerInitialSpawn(self: GM, player: Player, transition: boolean): void;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
interface GM {
|
|
1917
|
+
/**
|
|
1918
|
+
* Makes the player join a specified team. This is a convenience function that calls [Player:SetTeam](https://wiki.facepunch.com/gmod/Player:SetTeam) and runs the [GM:OnPlayerChangedTeam](https://wiki.facepunch.com/gmod/GM:OnPlayerChangedTeam) hook.
|
|
1919
|
+
* @realm server
|
|
1920
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerJoinTeam
|
|
1921
|
+
*/
|
|
1922
|
+
PlayerJoinTeam(self: GM, ply: Player, team: number): void;
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
interface GM {
|
|
1926
|
+
/**
|
|
1927
|
+
* Called when a player leaves a vehicle for any reason, including [Player:ExitVehicle](https://wiki.facepunch.com/gmod/Player:ExitVehicle).
|
|
1928
|
+
*
|
|
1929
|
+
* See [GM:PlayerEnteredVehicle](https://wiki.facepunch.com/gmod/GM:PlayerEnteredVehicle) for the opposite hook.
|
|
1930
|
+
*
|
|
1931
|
+
* **NOTE**: For vehicles with exit animations, this will be called **at the end** of the animation, **not at the start**!
|
|
1932
|
+
*
|
|
1933
|
+
*
|
|
1934
|
+
* @realm server
|
|
1935
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerLeaveVehicle
|
|
1936
|
+
*/
|
|
1937
|
+
PlayerLeaveVehicle(self: GM, ply: Player, veh: Vehicle): void;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
interface GM {
|
|
1941
|
+
/**
|
|
1942
|
+
* Called to give players the default set of weapons.
|
|
1943
|
+
*
|
|
1944
|
+
*
|
|
1945
|
+
* **NOTE**: This function may not work in your custom gamemode if you have overridden your [GM:PlayerSpawn](https://wiki.facepunch.com/gmod/GM:PlayerSpawn) and you do not use self.BaseClass.PlayerSpawn or [hook.Call](https://wiki.facepunch.com/gmod/hook.Call).
|
|
1946
|
+
*
|
|
1947
|
+
*
|
|
1948
|
+
* @realm server
|
|
1949
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerLoadout
|
|
1950
|
+
*/
|
|
1951
|
+
PlayerLoadout(self: GM, ply: Player): void;
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
interface GM {
|
|
1955
|
+
/**
|
|
1956
|
+
* Called when a player tries to switch noclip mode.
|
|
1957
|
+
*
|
|
1958
|
+
* [MOVETYPE_NOCLIP](https://wiki.facepunch.com/gmod/Enums/MOVETYPE#MOVETYPE_NOCLIP) can be used to determine if a player is currently in noclip mode.
|
|
1959
|
+
*
|
|
1960
|
+
* @realm shared
|
|
1961
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerNoClip
|
|
1962
|
+
*/
|
|
1963
|
+
PlayerNoClip(self: GM, ply: Player, desiredState: boolean): boolean;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
interface GM {
|
|
1967
|
+
/**
|
|
1968
|
+
* Called after the player's think, just after [GM:FinishMove](https://wiki.facepunch.com/gmod/GM:FinishMove).
|
|
1969
|
+
*
|
|
1970
|
+
*
|
|
1971
|
+
* **NOTE**: On the client side, it is only called for the local player.
|
|
1972
|
+
*
|
|
1973
|
+
*
|
|
1974
|
+
* @realm shared
|
|
1975
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerPostThink
|
|
1976
|
+
*/
|
|
1977
|
+
PlayerPostThink(self: GM, ply: Player): void;
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
interface GM {
|
|
1981
|
+
/**
|
|
1982
|
+
* Request a player to join the team. This function will check if the team is available to join or not.
|
|
1983
|
+
*
|
|
1984
|
+
* This hook is called when the player runs "changeteam" in the console.
|
|
1985
|
+
*
|
|
1986
|
+
* To prevent the player from changing teams, see [GM:PlayerCanJoinTeam](https://wiki.facepunch.com/gmod/GM:PlayerCanJoinTeam)
|
|
1987
|
+
*
|
|
1988
|
+
* @realm server
|
|
1989
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerRequestTeam
|
|
1990
|
+
*/
|
|
1991
|
+
PlayerRequestTeam(self: GM, ply: Player, team: number): void;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
interface GM {
|
|
1995
|
+
/**
|
|
1996
|
+
* Called when a player dispatched a chat message. For the clientside equivalent, see [GM:OnPlayerChat](https://wiki.facepunch.com/gmod/GM:OnPlayerChat).
|
|
1997
|
+
*
|
|
1998
|
+
* **NOTE**: It may be more reliable to use [gameevent/player_say](https://wiki.facepunch.com/gmod/gameevent/player_say) to read messages serverside because addons commonly return values in this hook to change chat messages.
|
|
1999
|
+
*
|
|
2000
|
+
*
|
|
2001
|
+
* @realm server
|
|
2002
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerSay
|
|
2003
|
+
*/
|
|
2004
|
+
PlayerSay(self: GM, sender: Player, text: string, teamChat: boolean): string;
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
interface GM {
|
|
2008
|
+
/**
|
|
2009
|
+
* Called to determine a spawn point for a player to spawn at.
|
|
2010
|
+
* **NOTE**: The spawn point entity will also impact the player's eye angle. For example, if the entity is upside down, the player's view will be as well.
|
|
2011
|
+
*
|
|
2012
|
+
*
|
|
2013
|
+
* @realm server
|
|
2014
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerSelectSpawn
|
|
2015
|
+
*/
|
|
2016
|
+
PlayerSelectSpawn(self: GM, ply: Player, transition: boolean): Entity;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
interface GM {
|
|
2020
|
+
/**
|
|
2021
|
+
* Find a team spawn point entity for this player.
|
|
2022
|
+
* @realm server
|
|
2023
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerSelectTeamSpawn
|
|
2024
|
+
*/
|
|
2025
|
+
PlayerSelectTeamSpawn(self: GM, team: number, ply: Player): Entity;
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
interface GM {
|
|
2029
|
+
/**
|
|
2030
|
+
* Called whenever view model hands needs setting a model. By default this calls [PLAYER:GetHandsModel](https://wiki.facepunch.com/gmod/PLAYER:GetHandsModel) and if that fails, sets the hands model according to his player model.
|
|
2031
|
+
* @realm server
|
|
2032
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerSetHandsModel
|
|
2033
|
+
*/
|
|
2034
|
+
PlayerSetHandsModel(self: GM, ply: Player, ent: Entity): void;
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
interface GM {
|
|
2038
|
+
/**
|
|
2039
|
+
* Called whenever a player spawns and must choose a model. A good place to assign a model to a player.
|
|
2040
|
+
* **NOTE**: This function may not work in your custom gamemode if you have overridden your [GM:PlayerSpawn](https://wiki.facepunch.com/gmod/GM:PlayerSpawn) and you do not use [self.BaseClass.PlayerSpawn](https://wiki.facepunch.com/gmod/Global.DEFINE_BASECLASS) in it, or [hook.Call](https://wiki.facepunch.com/gmod/hook.Call) this hook from [GM:PlayerSpawn](https://wiki.facepunch.com/gmod/GM:PlayerSpawn).
|
|
2041
|
+
*
|
|
2042
|
+
*
|
|
2043
|
+
* @realm server
|
|
2044
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerSetModel
|
|
2045
|
+
*/
|
|
2046
|
+
PlayerSetModel(self: GM, ply: Player): void;
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
interface GM {
|
|
2050
|
+
/**
|
|
2051
|
+
* Returns true if the player should take damage from the given attacker.
|
|
2052
|
+
*
|
|
2053
|
+
* **WARNING**: Applying damage from this hook to the player taking damage will lead to infinite loop/crash.
|
|
2054
|
+
*
|
|
2055
|
+
*
|
|
2056
|
+
* @realm server
|
|
2057
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerShouldTakeDamage
|
|
2058
|
+
*/
|
|
2059
|
+
PlayerShouldTakeDamage(self: GM, ply: Player, attacker: Entity): boolean;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
interface GM {
|
|
2063
|
+
/**
|
|
2064
|
+
* Allows to suppress player taunts.
|
|
2065
|
+
* @realm server
|
|
2066
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerShouldTaunt
|
|
2067
|
+
*/
|
|
2068
|
+
PlayerShouldTaunt(self: GM, ply: Player, act: number): boolean;
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
interface GM {
|
|
2072
|
+
/**
|
|
2073
|
+
* Called when the player is killed by [Player:KillSilent](https://wiki.facepunch.com/gmod/Player:KillSilent).
|
|
2074
|
+
*
|
|
2075
|
+
* The player is already considered dead when this hook is called.
|
|
2076
|
+
*
|
|
2077
|
+
* * See [GM:PlayerDeath](https://wiki.facepunch.com/gmod/GM:PlayerDeath) for a hook which handles all other death causes.
|
|
2078
|
+
* * [GM:PostPlayerDeath](https://wiki.facepunch.com/gmod/GM:PostPlayerDeath) is called **after** this hook.
|
|
2079
|
+
*
|
|
2080
|
+
* **NOTE**: [Player:Alive](https://wiki.facepunch.com/gmod/Player:Alive) will return true in this hook.
|
|
2081
|
+
*
|
|
2082
|
+
*
|
|
2083
|
+
* @realm server
|
|
2084
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerSilentDeath
|
|
2085
|
+
*/
|
|
2086
|
+
PlayerSilentDeath(self: GM, ply: Player): void;
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
interface GM {
|
|
2090
|
+
/**
|
|
2091
|
+
* Called whenever a player spawns, including respawns.
|
|
2092
|
+
*
|
|
2093
|
+
* See [GM:PlayerInitialSpawn](https://wiki.facepunch.com/gmod/GM:PlayerInitialSpawn) for a hook called only the first time a player spawns.
|
|
2094
|
+
*
|
|
2095
|
+
* See the [player_spawn gameevent](https://wiki.facepunch.com/gmod/gameevent/player_spawn) for a shared version of this hook.
|
|
2096
|
+
*
|
|
2097
|
+
* **WARNING**: By default, in "base" derived gamemodes, this hook will also call [GM:PlayerLoadout](https://wiki.facepunch.com/gmod/GM:PlayerLoadout) and [GM:PlayerSetModel](https://wiki.facepunch.com/gmod/GM:PlayerSetModel), which may override your [Entity:SetModel](https://wiki.facepunch.com/gmod/Entity:SetModel) and [Player:Give](https://wiki.facepunch.com/gmod/Player:Give) calls. Consider using the other hooks or a 0-second timer.
|
|
2098
|
+
*
|
|
2099
|
+
*
|
|
2100
|
+
* @realm server
|
|
2101
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerSpawn
|
|
2102
|
+
*/
|
|
2103
|
+
PlayerSpawn(self: GM, player: Player, transition: boolean): void;
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
interface GM {
|
|
2107
|
+
/**
|
|
2108
|
+
* Called to spawn the player as a spectator.
|
|
2109
|
+
* @realm server
|
|
2110
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerSpawnAsSpectator
|
|
2111
|
+
*/
|
|
2112
|
+
PlayerSpawnAsSpectator(self: GM, ply: Player): void;
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
interface GM {
|
|
2116
|
+
/**
|
|
2117
|
+
* Determines if the player can spray using the `impulse 201` console command.
|
|
2118
|
+
* @realm server
|
|
2119
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerSpray
|
|
2120
|
+
*/
|
|
2121
|
+
PlayerSpray(self: GM, sprayer: Player): boolean;
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
interface GM {
|
|
2125
|
+
/**
|
|
2126
|
+
* Called when player starts taunting.
|
|
2127
|
+
* @realm server
|
|
2128
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerStartTaunt
|
|
2129
|
+
*/
|
|
2130
|
+
PlayerStartTaunt(self: GM, ply: Player, act: number, length: number): void;
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
interface GM {
|
|
2134
|
+
/**
|
|
2135
|
+
* Called when a player starts using voice chat.
|
|
2136
|
+
* **NOTE**: Set mp_show_voice_icons to 0, if you want disable icons above player.
|
|
2137
|
+
*
|
|
2138
|
+
*
|
|
2139
|
+
* @realm client
|
|
2140
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerStartVoice
|
|
2141
|
+
*/
|
|
2142
|
+
PlayerStartVoice(self: GM, ply: Player, plyIndex?: number): boolean;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
interface GM {
|
|
2146
|
+
/**
|
|
2147
|
+
* Allows you to override the time between footsteps.
|
|
2148
|
+
*
|
|
2149
|
+
* See [GM:PlayerFootstep](https://wiki.facepunch.com/gmod/GM:PlayerFootstep) for a related hook about footstep sounds themselves.
|
|
2150
|
+
* **NOTE**: This hook is called on all clients.
|
|
2151
|
+
*
|
|
2152
|
+
*
|
|
2153
|
+
* @realm shared
|
|
2154
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerStepSoundTime
|
|
2155
|
+
*/
|
|
2156
|
+
PlayerStepSoundTime(self: GM, ply: Player, type: number, walking: boolean): number;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
interface GM {
|
|
2160
|
+
/**
|
|
2161
|
+
* Called whenever a player attempts to either turn on or off their flashlight, returning false will deny the change.
|
|
2162
|
+
* **NOTE**: Also gets called when using [Player:Flashlight](https://wiki.facepunch.com/gmod/Player:Flashlight).
|
|
2163
|
+
*
|
|
2164
|
+
*
|
|
2165
|
+
*
|
|
2166
|
+
* @realm server
|
|
2167
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerSwitchFlashlight
|
|
2168
|
+
*/
|
|
2169
|
+
PlayerSwitchFlashlight(self: GM, ply: Player, enabled: boolean): boolean;
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
interface GM {
|
|
2173
|
+
/**
|
|
2174
|
+
* Called when a player attempts to switch their weapon.
|
|
2175
|
+
*
|
|
2176
|
+
* Primary usage of this hook is to prevent/allow weapon switching, **not** to detect weapon switching. It will not be called for [Player:SetActiveWeapon](https://wiki.facepunch.com/gmod/Player:SetActiveWeapon).
|
|
2177
|
+
*
|
|
2178
|
+
* @realm shared
|
|
2179
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerSwitchWeapon
|
|
2180
|
+
*/
|
|
2181
|
+
PlayerSwitchWeapon(self: GM, player: Player, oldWeapon: Weapon, newWeapon: Weapon): boolean;
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
interface GM {
|
|
2185
|
+
/**
|
|
2186
|
+
* The Move hook is called for you to manipulate the player's [CMoveData](https://wiki.facepunch.com/gmod/CMoveData). This hook is called moments before [GM:Move](https://wiki.facepunch.com/gmod/GM:Move) and [GM:PlayerNoClip](https://wiki.facepunch.com/gmod/GM:PlayerNoClip).
|
|
2187
|
+
*
|
|
2188
|
+
* **WARNING**: This hook will not run when inside a vehicle. [GM:VehicleMove](https://wiki.facepunch.com/gmod/GM:VehicleMove) will be called instead.
|
|
2189
|
+
*
|
|
2190
|
+
*
|
|
2191
|
+
* @realm shared
|
|
2192
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerTick
|
|
2193
|
+
*/
|
|
2194
|
+
PlayerTick(self: GM, player: Player, mv: CMoveData): void;
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
interface GM {
|
|
2198
|
+
/**
|
|
2199
|
+
* Called when a player has been hit by a trace and damaged (such as from a bullet). Returning true overrides the damage handling and prevents [GM:ScalePlayerDamage](https://wiki.facepunch.com/gmod/GM:ScalePlayerDamage) from being called.
|
|
2200
|
+
* @realm shared
|
|
2201
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerTraceAttack
|
|
2202
|
+
*/
|
|
2203
|
+
PlayerTraceAttack(self: GM, ply: Player, dmginfo: CTakeDamageInfo, dir: Vector, trace: TraceResult): boolean;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
interface GM {
|
|
2207
|
+
/**
|
|
2208
|
+
* Called when a player unfreezes an object.
|
|
2209
|
+
* @realm server
|
|
2210
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerUnfrozeObject
|
|
2211
|
+
*/
|
|
2212
|
+
PlayerUnfrozeObject(self: GM, ply: Player, ent: Entity, physobj: PhysObj): void;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
interface GM {
|
|
2216
|
+
/**
|
|
2217
|
+
* Triggered when the player presses use on an object. Continuously runs until USE is released but will not activate other Entities until the USE key is released; dependent on activation type of the Entity.
|
|
2218
|
+
*
|
|
2219
|
+
* @realm server
|
|
2220
|
+
* @source https://wiki.facepunch.com/gmod/GM:PlayerUse
|
|
2221
|
+
*/
|
|
2222
|
+
PlayerUse(self: GM, ply: Player, ent: Entity): boolean;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
interface GM {
|
|
2226
|
+
/**
|
|
2227
|
+
* Called when it's time to populate the context menu menu bar at the top.
|
|
2228
|
+
* @realm client
|
|
2229
|
+
* @source https://wiki.facepunch.com/gmod/GM:PopulateMenuBar
|
|
2230
|
+
*/
|
|
2231
|
+
PopulateMenuBar(self: GM, menubar: Panel): void;
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
interface GM {
|
|
2235
|
+
/**
|
|
2236
|
+
* Called right after the map has cleaned up (usually because [game.CleanUpMap](https://wiki.facepunch.com/gmod/game.CleanUpMap) was called)
|
|
2237
|
+
*
|
|
2238
|
+
* See also [GM:PreCleanupMap](https://wiki.facepunch.com/gmod/GM:PreCleanupMap).
|
|
2239
|
+
*
|
|
2240
|
+
* @realm shared
|
|
2241
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostCleanupMap
|
|
2242
|
+
*/
|
|
2243
|
+
PostCleanupMap(self: GM): void;
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
interface GM {
|
|
2247
|
+
/**
|
|
2248
|
+
* Called right after the 2D skybox has been drawn - allowing you to draw over it.
|
|
2249
|
+
*
|
|
2250
|
+
*
|
|
2251
|
+
*
|
|
2252
|
+
* @realm client
|
|
2253
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostDraw2DSkyBox
|
|
2254
|
+
*/
|
|
2255
|
+
PostDraw2DSkyBox(self: GM): void;
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
interface GM {
|
|
2259
|
+
/**
|
|
2260
|
+
* Called after rendering effects. This is where halos are drawn. Called just before [GM:PreDrawHUD](https://wiki.facepunch.com/gmod/GM:PreDrawHUD) (The two hooks are basically identical).
|
|
2261
|
+
*
|
|
2262
|
+
* See [GM:PreDrawEffects](https://wiki.facepunch.com/gmod/GM:PreDrawEffects) for the associated hook.
|
|
2263
|
+
*
|
|
2264
|
+
*
|
|
2265
|
+
*
|
|
2266
|
+
* @realm client
|
|
2267
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostDrawEffects
|
|
2268
|
+
*/
|
|
2269
|
+
PostDrawEffects(self: GM): void;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
interface GM {
|
|
2273
|
+
/**
|
|
2274
|
+
* Called after [GM:PreDrawHUD](https://wiki.facepunch.com/gmod/GM:PreDrawHUD), [GM:HUDPaintBackground](https://wiki.facepunch.com/gmod/GM:HUDPaintBackground) and [GM:HUDPaint](https://wiki.facepunch.com/gmod/GM:HUDPaint) but before [GM:DrawOverlay](https://wiki.facepunch.com/gmod/GM:DrawOverlay).
|
|
2275
|
+
*
|
|
2276
|
+
* Unlike [GM:HUDPaint](https://wiki.facepunch.com/gmod/GM:HUDPaint)([Background](https://wiki.facepunch.com/gmod/GM:HUDPaintBackground)) hooks, this will still be called when the main menu is visible. And so will be [GM:PreDrawHUD](https://wiki.facepunch.com/gmod/GM:PreDrawHUD)
|
|
2277
|
+
*
|
|
2278
|
+
*
|
|
2279
|
+
*
|
|
2280
|
+
* @realm client
|
|
2281
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostDrawHUD
|
|
2282
|
+
*/
|
|
2283
|
+
PostDrawHUD(self: GM): void;
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
interface GM {
|
|
2287
|
+
/**
|
|
2288
|
+
* Called after drawing opaque entities.
|
|
2289
|
+
*
|
|
2290
|
+
* See also [GM:PostDrawTranslucentRenderables](https://wiki.facepunch.com/gmod/GM:PostDrawTranslucentRenderables) and [GM:PreDrawOpaqueRenderables](https://wiki.facepunch.com/gmod/GM:PreDrawOpaqueRenderables).
|
|
2291
|
+
*
|
|
2292
|
+
*
|
|
2293
|
+
*
|
|
2294
|
+
* @realm client
|
|
2295
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostDrawOpaqueRenderables
|
|
2296
|
+
*/
|
|
2297
|
+
PostDrawOpaqueRenderables(self: GM, bDrawingDepth: boolean, bDrawingSkybox: boolean, isDraw3DSkybox: boolean): void;
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
interface GM {
|
|
2301
|
+
/**
|
|
2302
|
+
* Called after the player hands are drawn.
|
|
2303
|
+
*
|
|
2304
|
+
* See [GM:PostDrawViewModel](https://wiki.facepunch.com/gmod/GM:PostDrawViewModel) for the view model alternative.
|
|
2305
|
+
* See [GM:PreDrawPlayerHands](https://wiki.facepunch.com/gmod/GM:PreDrawPlayerHands) for a hook that is called just before view model hands are drawn.
|
|
2306
|
+
*
|
|
2307
|
+
*
|
|
2308
|
+
* @realm client
|
|
2309
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostDrawPlayerHands
|
|
2310
|
+
*/
|
|
2311
|
+
PostDrawPlayerHands(self: GM, hands: Entity, vm: Entity, ply: Player, weapon: Weapon, flags: number): void;
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
interface GM {
|
|
2315
|
+
/**
|
|
2316
|
+
* Called after drawing the 3D skybox. This will not be called if skybox rendering was prevented via the [GM:PreDrawSkyBox](https://wiki.facepunch.com/gmod/GM:PreDrawSkyBox) hook.
|
|
2317
|
+
*
|
|
2318
|
+
* See also [GM:PostDraw2DSkyBox](https://wiki.facepunch.com/gmod/GM:PostDraw2DSkyBox).
|
|
2319
|
+
*
|
|
2320
|
+
*
|
|
2321
|
+
*
|
|
2322
|
+
* @realm client
|
|
2323
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostDrawSkyBox
|
|
2324
|
+
*/
|
|
2325
|
+
PostDrawSkyBox(self: GM): void;
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
interface GM {
|
|
2329
|
+
/**
|
|
2330
|
+
* Called after all translucent entities are drawn.
|
|
2331
|
+
*
|
|
2332
|
+
* See also [GM:PostDrawOpaqueRenderables](https://wiki.facepunch.com/gmod/GM:PostDrawOpaqueRenderables) and [GM:PreDrawTranslucentRenderables](https://wiki.facepunch.com/gmod/GM:PreDrawTranslucentRenderables).
|
|
2333
|
+
*
|
|
2334
|
+
*
|
|
2335
|
+
*
|
|
2336
|
+
* This is still called when r_drawentities or r_drawopaquerenderables is disabled.
|
|
2337
|
+
* This is not called when r_drawtranslucentworld is disabled.
|
|
2338
|
+
*
|
|
2339
|
+
* @realm client
|
|
2340
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostDrawTranslucentRenderables
|
|
2341
|
+
*/
|
|
2342
|
+
PostDrawTranslucentRenderables(self: GM, bDrawingDepth: boolean, bDrawingSkybox: boolean, isDraw3DSkybox: boolean): void;
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
interface GM {
|
|
2346
|
+
/**
|
|
2347
|
+
* Called after view model is drawn.
|
|
2348
|
+
*
|
|
2349
|
+
* The render FOV in this hook is different from the main view, as view models are usually rendered with a different FOV. Every render operation will only be accurate with the view model entity.
|
|
2350
|
+
*
|
|
2351
|
+
* See [GM:PreDrawViewModel](https://wiki.facepunch.com/gmod/GM:PreDrawViewModel) for a hook that is called just before a view model is drawn.
|
|
2352
|
+
*
|
|
2353
|
+
* For view model hands alternative, see [GM:PostDrawPlayerHands](https://wiki.facepunch.com/gmod/GM:PostDrawPlayerHands).
|
|
2354
|
+
*
|
|
2355
|
+
*
|
|
2356
|
+
*
|
|
2357
|
+
*
|
|
2358
|
+
* @realm client
|
|
2359
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostDrawViewModel
|
|
2360
|
+
*/
|
|
2361
|
+
PostDrawViewModel(self: GM, viewmodel: Entity, player: Player, weapon: Weapon, flags: number): void;
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
interface GM {
|
|
2365
|
+
/**
|
|
2366
|
+
* Called every time a bullet pellet (i.e. this hook is called multiple times for a shotgun shot) is fired from an entity. Notably this hook will have the final damage and aim direction for the bullet pellet.
|
|
2367
|
+
*
|
|
2368
|
+
* See [GM:EntityFireBullets](https://wiki.facepunch.com/gmod/GM:EntityFireBullets) if you wish to modify the bullets before they are fired.
|
|
2369
|
+
*
|
|
2370
|
+
* **WARNING**: This hook is called directly from [Entity:FireBullets](https://wiki.facepunch.com/gmod/Entity:FireBullets). Due to this, you cannot call [Entity:FireBullets](https://wiki.facepunch.com/gmod/Entity:FireBullets) inside this hook or an infinite loop will occur crashing the game.
|
|
2371
|
+
*
|
|
2372
|
+
*
|
|
2373
|
+
* @realm shared
|
|
2374
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostEntityFireBullets
|
|
2375
|
+
*/
|
|
2376
|
+
PostEntityFireBullets(self: GM, entity: Entity, data: FiredBullet): boolean;
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
interface GM {
|
|
2380
|
+
/**
|
|
2381
|
+
* Called when an entity receives a damage event, after passing damage filters, etc.
|
|
2382
|
+
*
|
|
2383
|
+
* See [GM:EntityTakeDamage](https://wiki.facepunch.com/gmod/GM:EntityTakeDamage) if you wish to prevent damage events, or otherwise alter them.
|
|
2384
|
+
*
|
|
2385
|
+
* **WARNING**: Applying damage from this hook to the entity taking damage will lead to infinite loop/crash.
|
|
2386
|
+
*
|
|
2387
|
+
*
|
|
2388
|
+
* @realm server
|
|
2389
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostEntityTakeDamage
|
|
2390
|
+
*/
|
|
2391
|
+
PostEntityTakeDamage(self: GM, ent: Entity, dmginfo: CTakeDamageInfo, wasDamageTaken: boolean): void;
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
interface GM {
|
|
2395
|
+
/**
|
|
2396
|
+
* Called after the gamemode has loaded.
|
|
2397
|
+
* @realm shared
|
|
2398
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostGamemodeLoaded
|
|
2399
|
+
*/
|
|
2400
|
+
PostGamemodeLoaded(self: GM): void;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
interface GM {
|
|
2404
|
+
/**
|
|
2405
|
+
* Called right after [GM:DoPlayerDeath](https://wiki.facepunch.com/gmod/GM:DoPlayerDeath), [GM:PlayerDeath](https://wiki.facepunch.com/gmod/GM:PlayerDeath) and [GM:PlayerSilentDeath](https://wiki.facepunch.com/gmod/GM:PlayerSilentDeath).
|
|
2406
|
+
*
|
|
2407
|
+
* This hook will be called for all deaths, including [Player:KillSilent](https://wiki.facepunch.com/gmod/Player:KillSilent)
|
|
2408
|
+
*
|
|
2409
|
+
* **NOTE**: [Player:Alive](https://wiki.facepunch.com/gmod/Player:Alive) will return false in this hook.
|
|
2410
|
+
*
|
|
2411
|
+
*
|
|
2412
|
+
*
|
|
2413
|
+
* @realm server
|
|
2414
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostPlayerDeath
|
|
2415
|
+
*/
|
|
2416
|
+
PostPlayerDeath(self: GM, ply: Player): void;
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
interface GM {
|
|
2420
|
+
/**
|
|
2421
|
+
* Called after a given player in your [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS "PVS - Valve Developer Community") was drawn.
|
|
2422
|
+
*
|
|
2423
|
+
* This hook will not be called if player was prevented from being drawn via [GM:PrePlayerDraw](https://wiki.facepunch.com/gmod/GM:PrePlayerDraw).
|
|
2424
|
+
*
|
|
2425
|
+
*
|
|
2426
|
+
* @realm client
|
|
2427
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostPlayerDraw
|
|
2428
|
+
*/
|
|
2429
|
+
PostPlayerDraw(self: GM, ply: Player, flags: number): void;
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
interface GM {
|
|
2433
|
+
/**
|
|
2434
|
+
* Allows you to suppress post processing effect drawing.
|
|
2435
|
+
* @realm client
|
|
2436
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostProcessPermitted
|
|
2437
|
+
*/
|
|
2438
|
+
PostProcessPermitted(self: GM, effect_name: string): boolean;
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
interface GM {
|
|
2442
|
+
/**
|
|
2443
|
+
* Called after the frame has been rendered.
|
|
2444
|
+
* @realm client
|
|
2445
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostRender
|
|
2446
|
+
*/
|
|
2447
|
+
PostRender(self: GM): void;
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
interface GM {
|
|
2451
|
+
/**
|
|
2452
|
+
* Called after the VGUI has been drawn.
|
|
2453
|
+
*
|
|
2454
|
+
*
|
|
2455
|
+
*
|
|
2456
|
+
* @realm client
|
|
2457
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostRenderVGUI
|
|
2458
|
+
*/
|
|
2459
|
+
PostRenderVGUI(self: GM): void;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
interface GM {
|
|
2463
|
+
/**
|
|
2464
|
+
* Called just after performing an undo.
|
|
2465
|
+
* @realm server
|
|
2466
|
+
* @source https://wiki.facepunch.com/gmod/GM:PostUndo
|
|
2467
|
+
*/
|
|
2468
|
+
PostUndo(self: GM, undo: Undo, count: number): void;
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
interface GM {
|
|
2472
|
+
/**
|
|
2473
|
+
* Called right before the map cleans up (usually because [game.CleanUpMap](https://wiki.facepunch.com/gmod/game.CleanUpMap) was called)
|
|
2474
|
+
*
|
|
2475
|
+
* See also [GM:PostCleanupMap](https://wiki.facepunch.com/gmod/GM:PostCleanupMap).
|
|
2476
|
+
*
|
|
2477
|
+
* @realm shared
|
|
2478
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreCleanupMap
|
|
2479
|
+
*/
|
|
2480
|
+
PreCleanupMap(self: GM): void;
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
interface GM {
|
|
2484
|
+
/**
|
|
2485
|
+
* Called just after [GM:PreDrawViewModel](https://wiki.facepunch.com/gmod/GM:PreDrawViewModel) and can technically be considered as a "PostDrawAllViewModels".
|
|
2486
|
+
*
|
|
2487
|
+
* See [GM:PostDrawEffects](https://wiki.facepunch.com/gmod/GM:PostDrawEffects) for the associated hook.
|
|
2488
|
+
*
|
|
2489
|
+
*
|
|
2490
|
+
*
|
|
2491
|
+
* @realm client
|
|
2492
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreDrawEffects
|
|
2493
|
+
*/
|
|
2494
|
+
PreDrawEffects(self: GM): void;
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
interface GM {
|
|
2498
|
+
/**
|
|
2499
|
+
* Called just after [GM:PostDrawEffects](https://wiki.facepunch.com/gmod/GM:PostDrawEffects) (duplicate of it). Drawing anything in it seems to work incorrectly.
|
|
2500
|
+
*
|
|
2501
|
+
* See [GM:PostDrawHUD](https://wiki.facepunch.com/gmod/GM:PostDrawHUD) for the associated hook.
|
|
2502
|
+
*
|
|
2503
|
+
* @realm client
|
|
2504
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreDrawHUD
|
|
2505
|
+
*/
|
|
2506
|
+
PreDrawHUD(self: GM): void;
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
interface GM {
|
|
2510
|
+
/**
|
|
2511
|
+
* Called before rendering the halos. This is the place to call [halo.Add](https://wiki.facepunch.com/gmod/halo.Add). This hook is actually running inside of [GM:PostDrawEffects](https://wiki.facepunch.com/gmod/GM:PostDrawEffects).
|
|
2512
|
+
*
|
|
2513
|
+
*
|
|
2514
|
+
*
|
|
2515
|
+
* @realm client
|
|
2516
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreDrawHalos
|
|
2517
|
+
*/
|
|
2518
|
+
PreDrawHalos(self: GM): void;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
interface GM {
|
|
2522
|
+
/**
|
|
2523
|
+
* Called before all opaque entities are drawn.
|
|
2524
|
+
*
|
|
2525
|
+
* See also [GM:PreDrawTranslucentRenderables](https://wiki.facepunch.com/gmod/GM:PreDrawTranslucentRenderables) and [GM:PostDrawOpaqueRenderables](https://wiki.facepunch.com/gmod/GM:PostDrawOpaqueRenderables).
|
|
2526
|
+
*
|
|
2527
|
+
*
|
|
2528
|
+
*
|
|
2529
|
+
* @realm client
|
|
2530
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreDrawOpaqueRenderables
|
|
2531
|
+
*/
|
|
2532
|
+
PreDrawOpaqueRenderables(self: GM, isDrawingDepth: boolean, isDrawSkybox: boolean, isDraw3DSkybox: boolean): boolean;
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
interface GM {
|
|
2536
|
+
/**
|
|
2537
|
+
* Called before the player hands are drawn.
|
|
2538
|
+
*
|
|
2539
|
+
* See [GM:PreDrawViewModel](https://wiki.facepunch.com/gmod/GM:PreDrawViewModel) for the view model alternative.
|
|
2540
|
+
* See [GM:PostDrawPlayerHands](https://wiki.facepunch.com/gmod/GM:PostDrawPlayerHands) for a hook that is called just before view model hands are drawn.
|
|
2541
|
+
*
|
|
2542
|
+
* @realm client
|
|
2543
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreDrawPlayerHands
|
|
2544
|
+
*/
|
|
2545
|
+
PreDrawPlayerHands(self: GM, hands: Entity, vm: Entity, ply: Player, weapon: Weapon, flags: number): boolean;
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
interface GM {
|
|
2549
|
+
/**
|
|
2550
|
+
* Called before the 3D sky box is drawn. This will not be called for maps with no 3D skybox, or when the 3d skybox is disabled. (`r_3dsky 0`)
|
|
2551
|
+
*
|
|
2552
|
+
* See also [GM:PostDrawSkyBox](https://wiki.facepunch.com/gmod/GM:PostDrawSkyBox)
|
|
2553
|
+
*
|
|
2554
|
+
*
|
|
2555
|
+
*
|
|
2556
|
+
* @realm client
|
|
2557
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreDrawSkyBox
|
|
2558
|
+
*/
|
|
2559
|
+
PreDrawSkyBox(self: GM): boolean;
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
interface GM {
|
|
2563
|
+
/**
|
|
2564
|
+
* Called before all the translucent entities are drawn.
|
|
2565
|
+
*
|
|
2566
|
+
* See also [GM:PreDrawOpaqueRenderables](https://wiki.facepunch.com/gmod/GM:PreDrawOpaqueRenderables) and [GM:PostDrawTranslucentRenderables](https://wiki.facepunch.com/gmod/GM:PostDrawTranslucentRenderables).
|
|
2567
|
+
*
|
|
2568
|
+
*
|
|
2569
|
+
*
|
|
2570
|
+
* This is still called when r_drawentities or r_drawopaquerenderables is disabled.
|
|
2571
|
+
* This is not called when r_drawtranslucentworld is disabled.
|
|
2572
|
+
*
|
|
2573
|
+
* @realm client
|
|
2574
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreDrawTranslucentRenderables
|
|
2575
|
+
*/
|
|
2576
|
+
PreDrawTranslucentRenderables(self: GM, isDrawingDepth: boolean, isDrawSkybox: boolean, isDraw3DSkybox: boolean): boolean;
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
interface GM {
|
|
2580
|
+
/**
|
|
2581
|
+
* Called before the view model has been drawn.
|
|
2582
|
+
*
|
|
2583
|
+
* By default this hook also calls [WEAPON:PreDrawViewModel](https://wiki.facepunch.com/gmod/WEAPON:PreDrawViewModel), so you can use that if developing a scripted weapon.
|
|
2584
|
+
*
|
|
2585
|
+
* See [GM:PostDrawViewModel](https://wiki.facepunch.com/gmod/GM:PostDrawViewModel) for a hook that runs immediately after rendering a view model.
|
|
2586
|
+
* See [GM:PreDrawViewModels](https://wiki.facepunch.com/gmod/GM:PreDrawViewModels) for a hook that runs before **all** view models are drawn within a frame.
|
|
2587
|
+
*
|
|
2588
|
+
* For view model hands, see [GM:PreDrawPlayerHands](https://wiki.facepunch.com/gmod/GM:PreDrawPlayerHands).
|
|
2589
|
+
*
|
|
2590
|
+
*
|
|
2591
|
+
*
|
|
2592
|
+
* @realm client
|
|
2593
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreDrawViewModel
|
|
2594
|
+
*/
|
|
2595
|
+
PreDrawViewModel(self: GM, vm: Entity, ply: Player, weapon: Weapon, flags: number): boolean;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
interface GM {
|
|
2599
|
+
/**
|
|
2600
|
+
* Called just before all view models (there are 3 per player, see [Player:GetViewModel](https://wiki.facepunch.com/gmod/Player:GetViewModel)) and entities with `RENDERGROUP_VIEWMODEL` are drawn.
|
|
2601
|
+
*
|
|
2602
|
+
* See [GM:PreDrawViewModel](https://wiki.facepunch.com/gmod/GM:PreDrawViewModel) and [GM:PostDrawViewModel](https://wiki.facepunch.com/gmod/GM:PostDrawViewModel) for hooks that run for specific view models.
|
|
2603
|
+
*
|
|
2604
|
+
* You can use [GM:PreDrawEffects](https://wiki.facepunch.com/gmod/GM:PreDrawEffects) as a "`PostDrawViewModels`" hook as it is called just after the all the view model(s) are drawn.
|
|
2605
|
+
*
|
|
2606
|
+
*
|
|
2607
|
+
*
|
|
2608
|
+
* @realm client
|
|
2609
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreDrawViewModels
|
|
2610
|
+
*/
|
|
2611
|
+
PreDrawViewModels(self: GM): void;
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
interface GM {
|
|
2615
|
+
/**
|
|
2616
|
+
* Called before the gamemode is loaded.
|
|
2617
|
+
* @realm shared
|
|
2618
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreGamemodeLoaded
|
|
2619
|
+
*/
|
|
2620
|
+
PreGamemodeLoaded(self: GM): void;
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
interface GM {
|
|
2624
|
+
/**
|
|
2625
|
+
* Called before the player is drawn.
|
|
2626
|
+
*
|
|
2627
|
+
* See also [GM:PostPlayerDraw](https://wiki.facepunch.com/gmod/GM:PostPlayerDraw).
|
|
2628
|
+
*
|
|
2629
|
+
* @realm client
|
|
2630
|
+
* @source https://wiki.facepunch.com/gmod/GM:PrePlayerDraw
|
|
2631
|
+
*/
|
|
2632
|
+
PrePlayerDraw(self: GM, player: Player, flags: number): boolean;
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2635
|
+
interface GM {
|
|
2636
|
+
/**
|
|
2637
|
+
* Called by [scripted_ents.Register](https://wiki.facepunch.com/gmod/scripted_ents.Register).
|
|
2638
|
+
*
|
|
2639
|
+
* @realm shared
|
|
2640
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreRegisterSENT
|
|
2641
|
+
*/
|
|
2642
|
+
PreRegisterSENT(self: GM, ent: table, _class: string): boolean;
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
interface GM {
|
|
2646
|
+
/**
|
|
2647
|
+
* Called when a Scripted Weapon (SWEP) is about to be registered, allowing addons to alter the weapon's SWEP table with custom data for later usage. Called internally from [weapons.Register](https://wiki.facepunch.com/gmod/weapons.Register).
|
|
2648
|
+
*
|
|
2649
|
+
* @realm shared
|
|
2650
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreRegisterSWEP
|
|
2651
|
+
*/
|
|
2652
|
+
PreRegisterSWEP(self: GM, swep: table, _class: string): boolean;
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
interface GM {
|
|
2656
|
+
/**
|
|
2657
|
+
* Called before the renderer is about to start rendering the next frame.
|
|
2658
|
+
* @realm client
|
|
2659
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreRender
|
|
2660
|
+
*/
|
|
2661
|
+
PreRender(self: GM): boolean;
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
interface GM {
|
|
2665
|
+
/**
|
|
2666
|
+
* Called just before performing an undo.
|
|
2667
|
+
* @realm server
|
|
2668
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreUndo
|
|
2669
|
+
*/
|
|
2670
|
+
PreUndo(self: GM, undo: Undo): boolean;
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
interface GM {
|
|
2674
|
+
/**
|
|
2675
|
+
* This will prevent IN_ATTACK from sending to server when player tries to shoot from C menu.
|
|
2676
|
+
* @realm client
|
|
2677
|
+
* @source https://wiki.facepunch.com/gmod/GM:PreventScreenClicks
|
|
2678
|
+
*/
|
|
2679
|
+
PreventScreenClicks(self: GM): boolean;
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
interface GM {
|
|
2683
|
+
/**
|
|
2684
|
+
* Called when a prop has been destroyed.
|
|
2685
|
+
* @realm shared
|
|
2686
|
+
* @source https://wiki.facepunch.com/gmod/GM:PropBreak
|
|
2687
|
+
*/
|
|
2688
|
+
PropBreak(self: GM, attacker: Player, prop: Entity): void;
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
interface GM {
|
|
2692
|
+
/**
|
|
2693
|
+
* Render the scene. Used by the `Stereoscopy` post-processing effect.
|
|
2694
|
+
*
|
|
2695
|
+
* **NOTE**: Materials rendered in this hook require `$ignorez` parameter to draw properly.
|
|
2696
|
+
*
|
|
2697
|
+
*
|
|
2698
|
+
* @realm client
|
|
2699
|
+
* @source https://wiki.facepunch.com/gmod/GM:RenderScene
|
|
2700
|
+
*/
|
|
2701
|
+
RenderScene(self: GM, origin: Vector, angles: Angle, fov: number): boolean;
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2704
|
+
interface GM {
|
|
2705
|
+
/**
|
|
2706
|
+
* Used to render post processing effects.
|
|
2707
|
+
*
|
|
2708
|
+
*
|
|
2709
|
+
*
|
|
2710
|
+
* @realm client
|
|
2711
|
+
* @source https://wiki.facepunch.com/gmod/GM:RenderScreenspaceEffects
|
|
2712
|
+
*/
|
|
2713
|
+
RenderScreenspaceEffects(self: GM): void;
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
interface GM {
|
|
2717
|
+
/**
|
|
2718
|
+
* Called when the game is reloaded from a Source Engine save system ( not the Sandbox saves or dupes ).
|
|
2719
|
+
*
|
|
2720
|
+
* See [GM:Saved](https://wiki.facepunch.com/gmod/GM:Saved) for a hook that is called when such a save file is created.
|
|
2721
|
+
*
|
|
2722
|
+
* @realm shared
|
|
2723
|
+
* @source https://wiki.facepunch.com/gmod/GM:Restored
|
|
2724
|
+
*/
|
|
2725
|
+
Restored(self: GM): void;
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
interface GM {
|
|
2729
|
+
/**
|
|
2730
|
+
* Called when the game is saved using the Source Engine save system (not the Sandbox saves or dupes).
|
|
2731
|
+
*
|
|
2732
|
+
* See [GM:Restored](https://wiki.facepunch.com/gmod/GM:Restored) for a hook that is called when such a save file is loaded.
|
|
2733
|
+
*
|
|
2734
|
+
* See also the [saverestore](https://wiki.facepunch.com/gmod/saverestore) for relevant functions.
|
|
2735
|
+
*
|
|
2736
|
+
* @realm shared
|
|
2737
|
+
* @source https://wiki.facepunch.com/gmod/GM:Saved
|
|
2738
|
+
*/
|
|
2739
|
+
Saved(self: GM): void;
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
interface GM {
|
|
2743
|
+
/**
|
|
2744
|
+
* Called when an NPC takes damage.
|
|
2745
|
+
*
|
|
2746
|
+
* **NOTE**: This hook is called only when a specific hit group of the NPC is hit. In cases where the hitgroup doesn't matter, you should use [GM:EntityTakeDamage](https://wiki.facepunch.com/gmod/GM:EntityTakeDamage) instead!
|
|
2747
|
+
*
|
|
2748
|
+
*
|
|
2749
|
+
* @realm server
|
|
2750
|
+
* @source https://wiki.facepunch.com/gmod/GM:ScaleNPCDamage
|
|
2751
|
+
*/
|
|
2752
|
+
ScaleNPCDamage(self: GM, npc: NPC, hitgroup: number, dmginfo: CTakeDamageInfo): void;
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
interface GM {
|
|
2756
|
+
/**
|
|
2757
|
+
* This hook allows you to change how much damage a player receives when one takes damage to a specific body part.
|
|
2758
|
+
*
|
|
2759
|
+
* **NOTE**: This is called only for bullet damage a player receives, you should use [GM:EntityTakeDamage](https://wiki.facepunch.com/gmod/GM:EntityTakeDamage) instead if you need to detect **ALL** damage.
|
|
2760
|
+
*
|
|
2761
|
+
*
|
|
2762
|
+
* @realm shared
|
|
2763
|
+
* @source https://wiki.facepunch.com/gmod/GM:ScalePlayerDamage
|
|
2764
|
+
*/
|
|
2765
|
+
ScalePlayerDamage(self: GM, ply: Player, hitgroup: number, dmginfo: CTakeDamageInfo): boolean;
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
interface GM {
|
|
2769
|
+
/**
|
|
2770
|
+
* Called when player released the scoreboard button (TAB by default).
|
|
2771
|
+
* @realm client
|
|
2772
|
+
* @source https://wiki.facepunch.com/gmod/GM:ScoreboardHide
|
|
2773
|
+
*/
|
|
2774
|
+
ScoreboardHide(self: GM): void;
|
|
2775
|
+
}
|
|
2776
|
+
|
|
2777
|
+
interface GM {
|
|
2778
|
+
/**
|
|
2779
|
+
* Called when player presses the scoreboard button (TAB by default).
|
|
2780
|
+
* @realm client
|
|
2781
|
+
* @source https://wiki.facepunch.com/gmod/GM:ScoreboardShow
|
|
2782
|
+
*/
|
|
2783
|
+
ScoreboardShow(self: GM): boolean;
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
interface GM {
|
|
2787
|
+
/**
|
|
2788
|
+
* An internal function used to send a death notice event to all clients.
|
|
2789
|
+
*
|
|
2790
|
+
* @realm server
|
|
2791
|
+
* @source https://wiki.facepunch.com/gmod/GM:SendDeathNotice
|
|
2792
|
+
*/
|
|
2793
|
+
SendDeathNotice(self: GM, attacker: Entity | string | nil, inflictor: string, victim: Entity | string, flags: number): void;
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
interface GM {
|
|
2797
|
+
/**
|
|
2798
|
+
* Sets player run and sprint speeds.
|
|
2799
|
+
* Using a speed of `0` can lead to prediction errors, and can cause players to move at `sv_maxvelocity`
|
|
2800
|
+
* **WARNING**: This is not a hook. Treat this as a utility function to set the player's speed.
|
|
2801
|
+
*
|
|
2802
|
+
*
|
|
2803
|
+
* @realm shared
|
|
2804
|
+
* @source https://wiki.facepunch.com/gmod/GM:SetPlayerSpeed
|
|
2805
|
+
*/
|
|
2806
|
+
SetPlayerSpeed(self: GM, ply: Player, walkSpeed: number, runSpeed: number): void;
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
interface GM {
|
|
2810
|
+
/**
|
|
2811
|
+
* SetupMove is called before the engine process movements. This allows us to override the players movement.
|
|
2812
|
+
*
|
|
2813
|
+
* See [Game Movement](https://wiki.facepunch.com/gmod/Game_Movement) for an explanation on the move system.
|
|
2814
|
+
*
|
|
2815
|
+
* @realm shared
|
|
2816
|
+
* @source https://wiki.facepunch.com/gmod/GM:SetupMove
|
|
2817
|
+
*/
|
|
2818
|
+
SetupMove(self: GM, ply: Player, mv: CMoveData, cmd: CUserCmd): void;
|
|
2819
|
+
}
|
|
2820
|
+
|
|
2821
|
+
interface GM {
|
|
2822
|
+
/**
|
|
2823
|
+
* Allows you to add extra positions to the player's [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS "PVS - Valve Developer Community"). This is the place to call [Global.AddOriginToPVS](https://wiki.facepunch.com/gmod/Global.AddOriginToPVS).
|
|
2824
|
+
* @realm server
|
|
2825
|
+
* @source https://wiki.facepunch.com/gmod/GM:SetupPlayerVisibility
|
|
2826
|
+
*/
|
|
2827
|
+
SetupPlayerVisibility(self: GM, ply: Player, viewEntity: Entity): void;
|
|
2828
|
+
}
|
|
2829
|
+
|
|
2830
|
+
interface GM {
|
|
2831
|
+
/**
|
|
2832
|
+
* Allows you to use render.Fog* functions to manipulate skybox fog.
|
|
2833
|
+
* This will not be called for maps with no 3D skybox, or when the 3d skybox is disabled. (`r_3dsky 0`)
|
|
2834
|
+
*
|
|
2835
|
+
* @realm client
|
|
2836
|
+
* @source https://wiki.facepunch.com/gmod/GM:SetupSkyboxFog
|
|
2837
|
+
*/
|
|
2838
|
+
SetupSkyboxFog(self: GM, scale: number): boolean;
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
interface GM {
|
|
2842
|
+
/**
|
|
2843
|
+
* Allows you to use render.Fog* functions to manipulate world fog.
|
|
2844
|
+
* @realm client
|
|
2845
|
+
* @source https://wiki.facepunch.com/gmod/GM:SetupWorldFog
|
|
2846
|
+
*/
|
|
2847
|
+
SetupWorldFog(self: GM): boolean;
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
interface GM {
|
|
2851
|
+
/**
|
|
2852
|
+
* Called to decide whether a pair of entities should collide with each other. This is only called if [Entity:SetCustomCollisionCheck](https://wiki.facepunch.com/gmod/Entity:SetCustomCollisionCheck) was used on one or both entities.
|
|
2853
|
+
*
|
|
2854
|
+
* Where applicable, consider using [constraint.NoCollide](https://wiki.facepunch.com/gmod/constraint.NoCollide) or a [logic_collision_pair](https://developer.valvesoftware.com/wiki/Logic_collision_pair) entity instead - they are considerably easier to use and may be more appropriate in some situations.
|
|
2855
|
+
*
|
|
2856
|
+
* **WARNING**: This hook **must** return the same value consistently for the same pair of entities.
|
|
2857
|
+
* If an entity changed in such a way that its collision rules change, you **must** call [Entity:CollisionRulesChanged](https://wiki.facepunch.com/gmod/Entity:CollisionRulesChanged) on that entity immediately - **not in this hook and not in physics callbacks.**
|
|
2858
|
+
* As long as you religiously follow the rules set by the examples this hook will work reliably without breaking, even a small mistake might break physics.
|
|
2859
|
+
*
|
|
2860
|
+
*
|
|
2861
|
+
* This hook can cause all physics to break under certain conditions.
|
|
2862
|
+
*
|
|
2863
|
+
* @realm shared
|
|
2864
|
+
* @source https://wiki.facepunch.com/gmod/GM:ShouldCollide
|
|
2865
|
+
*/
|
|
2866
|
+
ShouldCollide(self: GM, ent1: Entity, ent2: Entity): boolean;
|
|
2867
|
+
}
|
|
2868
|
+
|
|
2869
|
+
interface GM {
|
|
2870
|
+
/**
|
|
2871
|
+
* Called to determine if the [Global.LocalPlayer](https://wiki.facepunch.com/gmod/Global.LocalPlayer) should be drawn.
|
|
2872
|
+
*
|
|
2873
|
+
* If you're using this hook to draw a player for a [GM:CalcView](https://wiki.facepunch.com/gmod/GM:CalcView) hook, then you may want to consider using the `drawviewer` variable you can use in your [Structures/CamData](https://wiki.facepunch.com/gmod/Structures/CamData) table instead.
|
|
2874
|
+
*
|
|
2875
|
+
* **NOTE**: This hook has an internal cache that is reset at the start of every frame. This will prevent this hook from running in certain cases. This cache is reset in [cam.Start](https://wiki.facepunch.com/gmod/cam.Start) and in a future update in [render.RenderView](https://wiki.facepunch.com/gmod/render.RenderView) when rendering extra views.
|
|
2876
|
+
*
|
|
2877
|
+
*
|
|
2878
|
+
* @realm client
|
|
2879
|
+
* @source https://wiki.facepunch.com/gmod/GM:ShouldDrawLocalPlayer
|
|
2880
|
+
*/
|
|
2881
|
+
ShouldDrawLocalPlayer(self: GM, ply: Player): boolean;
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
interface GM {
|
|
2885
|
+
/**
|
|
2886
|
+
* Called when a player executes `gm_showhelp` console command. (Default bind is F1)
|
|
2887
|
+
*
|
|
2888
|
+
* @realm shared
|
|
2889
|
+
* @source https://wiki.facepunch.com/gmod/GM:ShowHelp
|
|
2890
|
+
*/
|
|
2891
|
+
ShowHelp(self: GM, ply: Player): void;
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
interface GM {
|
|
2895
|
+
/**
|
|
2896
|
+
* Called when a player executes `gm_showspare1` console command ( Default bind is F3 ).
|
|
2897
|
+
* @realm shared
|
|
2898
|
+
* @source https://wiki.facepunch.com/gmod/GM:ShowSpare1
|
|
2899
|
+
*/
|
|
2900
|
+
ShowSpare1(self: GM, ply: Player): void;
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
interface GM {
|
|
2904
|
+
/**
|
|
2905
|
+
* Called when a player executes `gm_showspare2` console command ( Default bind is F4 ).
|
|
2906
|
+
* @realm shared
|
|
2907
|
+
* @source https://wiki.facepunch.com/gmod/GM:ShowSpare2
|
|
2908
|
+
*/
|
|
2909
|
+
ShowSpare2(self: GM, ply: Player): void;
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
interface GM {
|
|
2913
|
+
/**
|
|
2914
|
+
* Called when a player executes `gm_showteam` console command. ( Default bind is F2 )
|
|
2915
|
+
* @realm shared
|
|
2916
|
+
* @source https://wiki.facepunch.com/gmod/GM:ShowTeam
|
|
2917
|
+
*/
|
|
2918
|
+
ShowTeam(self: GM, ply: Player): void;
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
interface GM {
|
|
2922
|
+
/**
|
|
2923
|
+
* Called whenever the Lua environment is about to be shut down, for example on map change, or when the server is going to shut down.
|
|
2924
|
+
*
|
|
2925
|
+
* @realm shared
|
|
2926
|
+
* @source https://wiki.facepunch.com/gmod/GM:ShutDown
|
|
2927
|
+
*/
|
|
2928
|
+
ShutDown(self: GM): void;
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
interface GM {
|
|
2932
|
+
/**
|
|
2933
|
+
* Called when the Spawnmenu is Created.
|
|
2934
|
+
* @realm client
|
|
2935
|
+
* @source https://wiki.facepunch.com/gmod/GM:SpawnMenuCreated
|
|
2936
|
+
*/
|
|
2937
|
+
SpawnMenuCreated(self: GM): void;
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
interface GM {
|
|
2941
|
+
/**
|
|
2942
|
+
* Called when spawn icon is generated.
|
|
2943
|
+
* @realm client
|
|
2944
|
+
* @source https://wiki.facepunch.com/gmod/GM:SpawniconGenerated
|
|
2945
|
+
*/
|
|
2946
|
+
SpawniconGenerated(self: GM, lastmodel: string, imagename: string, modelsleft: number): void;
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
interface GM {
|
|
2950
|
+
/**
|
|
2951
|
+
* Runs when the user tries to open the chat box.
|
|
2952
|
+
*
|
|
2953
|
+
* **WARNING**: Returning `true` won't stop the chatbox from taking VGUI focus. [chat.Close](https://wiki.facepunch.com/gmod/chat.Close) may be of use to mitigate that, or usage of [GM:PlayerBindPress](https://wiki.facepunch.com/gmod/GM:PlayerBindPress).
|
|
2954
|
+
*
|
|
2955
|
+
*
|
|
2956
|
+
* @realm client
|
|
2957
|
+
* @source https://wiki.facepunch.com/gmod/GM:StartChat
|
|
2958
|
+
*/
|
|
2959
|
+
StartChat(self: GM, isTeamChat: boolean): boolean;
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
interface GM {
|
|
2963
|
+
/**
|
|
2964
|
+
* Allows you to change the players inputs before they are processed by the server. This function is also called for bots, making it the best solution to control them.
|
|
2965
|
+
*
|
|
2966
|
+
* This is basically a shared version of [GM:CreateMove](https://wiki.facepunch.com/gmod/GM:CreateMove).
|
|
2967
|
+
*
|
|
2968
|
+
*
|
|
2969
|
+
* **NOTE**: This hook is predicted, but not by usual means, it is called when a [CUserCmd](https://wiki.facepunch.com/gmod/CUserCmd) is generated on the client, and on the server when it is received, so it is necessary for this hook to be called clientside even on singleplayer
|
|
2970
|
+
*
|
|
2971
|
+
*
|
|
2972
|
+
* @realm shared
|
|
2973
|
+
* @source https://wiki.facepunch.com/gmod/GM:StartCommand
|
|
2974
|
+
*/
|
|
2975
|
+
StartCommand(self: GM, ply: Player, ucmd: CUserCmd): void;
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
interface GM {
|
|
2979
|
+
/**
|
|
2980
|
+
* Called right before an entity starts driving. Overriding this hook will cause it to not call [drive.Start](https://wiki.facepunch.com/gmod/drive.Start) and the player will not begin driving the entity.
|
|
2981
|
+
* @realm shared
|
|
2982
|
+
* @source https://wiki.facepunch.com/gmod/GM:StartEntityDriving
|
|
2983
|
+
*/
|
|
2984
|
+
StartEntityDriving(self: GM, ent: Entity, ply: Player): void;
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
interface GM {
|
|
2988
|
+
/**
|
|
2989
|
+
* Called when you start a new game via the menu.
|
|
2990
|
+
* @realm menu
|
|
2991
|
+
* @source https://wiki.facepunch.com/gmod/GM:StartGame
|
|
2992
|
+
*/
|
|
2993
|
+
StartGame(self: GM): void;
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2996
|
+
interface GM {
|
|
2997
|
+
/**
|
|
2998
|
+
* Called every rendered frame on client, except when the game is paused.
|
|
2999
|
+
*
|
|
3000
|
+
* Called every game tick on the server. This will be the same as [GM:Tick](https://wiki.facepunch.com/gmod/GM:Tick) on the server when there is no lag, but will only be called once every processed server frame during lag.
|
|
3001
|
+
* [Global.CurTime](https://wiki.facepunch.com/gmod/Global.CurTime) is guaranteed to be different with each call to this hook on the server.
|
|
3002
|
+
*
|
|
3003
|
+
* See [GM:Tick](https://wiki.facepunch.com/gmod/GM:Tick) for a hook that runs every tick on both the client and server.
|
|
3004
|
+
*
|
|
3005
|
+
* **NOTE**: On server, this hook **WILL NOT** run if the server is empty, unless you set the [ConVar](https://wiki.facepunch.com/gmod/ConVar) `sv_hibernate_think` to `1`.
|
|
3006
|
+
*
|
|
3007
|
+
*
|
|
3008
|
+
* @realm shared and menu
|
|
3009
|
+
* @source https://wiki.facepunch.com/gmod/GM:Think
|
|
3010
|
+
*/
|
|
3011
|
+
Think(self: GM): void;
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
interface GM {
|
|
3015
|
+
/**
|
|
3016
|
+
* Called every game tick. [engine.TickCount](https://wiki.facepunch.com/gmod/engine.TickCount) is guaranteed to be different between each call.
|
|
3017
|
+
*
|
|
3018
|
+
* Server side, this is similar to [GM:Think](https://wiki.facepunch.com/gmod/GM:Think) (See that page for details).
|
|
3019
|
+
*
|
|
3020
|
+
* The default tickrate is `66.6666` (15 millisecond intervals). It can be changed via the `-tickrate` [command line option](https://wiki.facepunch.com/gmod/Command_Line_Parameters).
|
|
3021
|
+
* See [engine.TickInterval](https://wiki.facepunch.com/gmod/engine.TickInterval) for a function to retrieve this data at runtime.
|
|
3022
|
+
*
|
|
3023
|
+
* **NOTE**: This hook **WILL NOT** run if the server is empty, unless you set the [ConVar](https://wiki.facepunch.com/gmod/ConVar) `sv_hibernate_think` to 1
|
|
3024
|
+
*
|
|
3025
|
+
* @realm shared
|
|
3026
|
+
* @source https://wiki.facepunch.com/gmod/GM:Tick
|
|
3027
|
+
*/
|
|
3028
|
+
Tick(self: GM): void;
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
interface GM {
|
|
3032
|
+
/**
|
|
3033
|
+
* **NOTE**: Isn't called when CalcMainActivity returns a valid override sequence id
|
|
3034
|
+
*
|
|
3035
|
+
* Allows you to translate player activities.
|
|
3036
|
+
*
|
|
3037
|
+
* @realm shared
|
|
3038
|
+
* @source https://wiki.facepunch.com/gmod/GM:TranslateActivity
|
|
3039
|
+
*/
|
|
3040
|
+
TranslateActivity(self: GM, ply: Player, act: number): number;
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
interface GM {
|
|
3044
|
+
/**
|
|
3045
|
+
* Animation updates (pose params etc) should be done here.
|
|
3046
|
+
* @realm shared
|
|
3047
|
+
* @source https://wiki.facepunch.com/gmod/GM:UpdateAnimation
|
|
3048
|
+
*/
|
|
3049
|
+
UpdateAnimation(self: GM, ply: Player, velocity: Vector, maxSeqGroundSpeed: number): void;
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
interface GM {
|
|
3053
|
+
/**
|
|
3054
|
+
* Called when user clicks on a VGUI panel.
|
|
3055
|
+
* @realm client
|
|
3056
|
+
* @source https://wiki.facepunch.com/gmod/GM:VGUIMousePressAllowed
|
|
3057
|
+
*/
|
|
3058
|
+
VGUIMousePressAllowed(self: GM, button: number): boolean;
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
interface GM {
|
|
3062
|
+
/**
|
|
3063
|
+
* Called when a mouse button is pressed on a VGUI element or menu.
|
|
3064
|
+
* @realm client and menu
|
|
3065
|
+
* @source https://wiki.facepunch.com/gmod/GM:VGUIMousePressed
|
|
3066
|
+
*/
|
|
3067
|
+
VGUIMousePressed(self: GM, pnl: Panel, mouseCode: number): void;
|
|
3068
|
+
}
|
|
3069
|
+
|
|
3070
|
+
interface GM {
|
|
3071
|
+
/**
|
|
3072
|
+
* Called when a variable is edited on an Entity (called by Edit Properties... menu). See [Editable Entities](https://wiki.facepunch.com/gmod/Editable_Entities) for more information.
|
|
3073
|
+
*
|
|
3074
|
+
* **WARNING**: This hook is called to change a variable and not after a variable was changed
|
|
3075
|
+
*
|
|
3076
|
+
*
|
|
3077
|
+
* @realm server
|
|
3078
|
+
* @source https://wiki.facepunch.com/gmod/GM:VariableEdited
|
|
3079
|
+
*/
|
|
3080
|
+
VariableEdited(self: GM, ent: Entity, ply: Player, key: string, val: string, editor: table): void;
|
|
3081
|
+
}
|
|
3082
|
+
|
|
3083
|
+
interface GM {
|
|
3084
|
+
/**
|
|
3085
|
+
* Called when you are driving a vehicle. This hook works just like [GM:Move](https://wiki.facepunch.com/gmod/GM:Move).
|
|
3086
|
+
*
|
|
3087
|
+
* This hook is called before [GM:Move](https://wiki.facepunch.com/gmod/GM:Move) and will be called when [GM:PlayerTick](https://wiki.facepunch.com/gmod/GM:PlayerTick) is not.
|
|
3088
|
+
*
|
|
3089
|
+
* @realm shared
|
|
3090
|
+
* @source https://wiki.facepunch.com/gmod/GM:VehicleMove
|
|
3091
|
+
*/
|
|
3092
|
+
VehicleMove(self: GM, ply: Player, veh: Vehicle, mv: CMoveData): void;
|
|
3093
|
+
}
|
|
3094
|
+
|
|
3095
|
+
interface GM {
|
|
3096
|
+
/**
|
|
3097
|
+
* Called as a weapon entity is picked up by a player. (Including [Player:Give](https://wiki.facepunch.com/gmod/Player:Give))
|
|
3098
|
+
*
|
|
3099
|
+
* Contrary to the name of the hook, it is **not called** when the player switches their active weapon to another.
|
|
3100
|
+
*
|
|
3101
|
+
* See also [GM:PlayerDroppedWeapon](https://wiki.facepunch.com/gmod/GM:PlayerDroppedWeapon) and [GM:PlayerCanPickupWeapon](https://wiki.facepunch.com/gmod/GM:PlayerCanPickupWeapon).
|
|
3102
|
+
*
|
|
3103
|
+
* **NOTE**: At the time when this hook is called [Entity:GetOwner](https://wiki.facepunch.com/gmod/Entity:GetOwner) will return `NULL`. The owner is set on the next frame.
|
|
3104
|
+
*
|
|
3105
|
+
* **NOTE**: This will not be called when picking up a weapon you already have as the weapon will be removed and [WEAPON:EquipAmmo](https://wiki.facepunch.com/gmod/WEAPON:EquipAmmo) will be called instead.
|
|
3106
|
+
*
|
|
3107
|
+
*
|
|
3108
|
+
* @realm server
|
|
3109
|
+
* @source https://wiki.facepunch.com/gmod/GM:WeaponEquip
|
|
3110
|
+
*/
|
|
3111
|
+
WeaponEquip(self: GM, weapon: Weapon, owner: Player): void;
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
interface GM {
|
|
3115
|
+
/**
|
|
3116
|
+
* Called when an addon from the Steam workshop begins downloading. Used by default to place details on the workshop downloading panel.
|
|
3117
|
+
* @realm menu
|
|
3118
|
+
* @source https://wiki.facepunch.com/gmod/GM:WorkshopDownloadFile
|
|
3119
|
+
*/
|
|
3120
|
+
WorkshopDownloadFile(self: GM, id: number, imageID: number, title: string, size: number): void;
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
interface GM {
|
|
3124
|
+
/**
|
|
3125
|
+
* Called while an addon from the Steam workshop is downloading. Used by default to update details on the fancy workshop download panel.
|
|
3126
|
+
* @realm menu
|
|
3127
|
+
* @source https://wiki.facepunch.com/gmod/GM:WorkshopDownloadProgress
|
|
3128
|
+
*/
|
|
3129
|
+
WorkshopDownloadProgress(self: GM, id: number, imageID: number, title: string, downloaded: number, expected: number): void;
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
interface GM {
|
|
3133
|
+
/**
|
|
3134
|
+
* Called after [GM:WorkshopStart](https://wiki.facepunch.com/gmod/GM:WorkshopStart).
|
|
3135
|
+
* @realm menu
|
|
3136
|
+
* @source https://wiki.facepunch.com/gmod/GM:WorkshopDownloadTotals
|
|
3137
|
+
*/
|
|
3138
|
+
WorkshopDownloadTotals(self: GM, remain: number, total: number): void;
|
|
3139
|
+
}
|
|
3140
|
+
|
|
3141
|
+
interface GM {
|
|
3142
|
+
/**
|
|
3143
|
+
* Called when an addon from the Steam workshop finishes downloading. Used by default to update details on the workshop downloading panel.
|
|
3144
|
+
* @realm menu
|
|
3145
|
+
* @source https://wiki.facepunch.com/gmod/GM:WorkshopDownloadedFile
|
|
3146
|
+
*/
|
|
3147
|
+
WorkshopDownloadedFile(self: GM, id: number, title: string): void;
|
|
3148
|
+
}
|
|
3149
|
+
|
|
3150
|
+
interface GM {
|
|
3151
|
+
/**
|
|
3152
|
+
* Called when downloading content from Steam workshop ends. Used by default to hide fancy workshop downloading panel.
|
|
3153
|
+
* @realm menu
|
|
3154
|
+
* @source https://wiki.facepunch.com/gmod/GM:WorkshopEnd
|
|
3155
|
+
*/
|
|
3156
|
+
WorkshopEnd(self: GM): void;
|
|
3157
|
+
}
|
|
3158
|
+
|
|
3159
|
+
interface GM {
|
|
3160
|
+
/**
|
|
3161
|
+
* Called while an addon from the Steam workshop is extracting. Used by default to update details on the fancy workshop download panel.
|
|
3162
|
+
* @realm menu
|
|
3163
|
+
* @source https://wiki.facepunch.com/gmod/GM:WorkshopExtractProgress
|
|
3164
|
+
*/
|
|
3165
|
+
WorkshopExtractProgress(self: GM, id: number, ImageID: number, title: string, percent: number): void;
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
interface GM {
|
|
3169
|
+
/**
|
|
3170
|
+
* Called when downloading content from Steam workshop begins. Used by default to show fancy workshop downloading panel.
|
|
3171
|
+
*
|
|
3172
|
+
* The order of Workshop hooks is this:
|
|
3173
|
+
* * WorkshopStart
|
|
3174
|
+
* * WorkshopDownloadTotals
|
|
3175
|
+
* * * These are called for each new item:
|
|
3176
|
+
* * WorkshopDownloadFile
|
|
3177
|
+
* * WorkshopDownloadProgress - This is called until the file is finished
|
|
3178
|
+
* * WorkshopDownloadedFile
|
|
3179
|
+
* * WorkshopEnd (this ones called once)
|
|
3180
|
+
*
|
|
3181
|
+
* @realm menu
|
|
3182
|
+
* @source https://wiki.facepunch.com/gmod/GM:WorkshopStart
|
|
3183
|
+
*/
|
|
3184
|
+
WorkshopStart(self: GM): void;
|
|
3185
|
+
}
|
|
3186
|
+
|
|
3187
|
+
interface GM {
|
|
3188
|
+
/**
|
|
3189
|
+
* Called when UGC subscription status changes.
|
|
3190
|
+
* @realm menu
|
|
3191
|
+
* @source https://wiki.facepunch.com/gmod/GM:WorkshopSubscriptionsChanged
|
|
3192
|
+
*/
|
|
3193
|
+
WorkshopSubscriptionsChanged(self: GM): void;
|
|
3194
|
+
}
|
|
3195
|
+
|
|
3196
|
+
interface GM {
|
|
3197
|
+
/**
|
|
3198
|
+
* Called when a Workshop Message is received?. Currently, it seems like the message will be **#ugc.mounting** every time.
|
|
3199
|
+
* When does this exactly get called?. If an addon is subscribed, unsubscribed, error occurs or on any event?
|
|
3200
|
+
*
|
|
3201
|
+
* @realm menu
|
|
3202
|
+
* @source https://wiki.facepunch.com/gmod/GM:WorkshopSubscriptionsMessage
|
|
3203
|
+
*/
|
|
3204
|
+
WorkshopSubscriptionsMessage(self: GM, message: string): void;
|
|
3205
|
+
}
|
|
3206
|
+
|
|
3207
|
+
interface GM {
|
|
3208
|
+
/**
|
|
3209
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
3210
|
+
*
|
|
3211
|
+
* Called by the engine when the game initially fetches subscriptions to be displayed on the bottom of the main menu screen.
|
|
3212
|
+
*
|
|
3213
|
+
* @realm menu
|
|
3214
|
+
* @source https://wiki.facepunch.com/gmod/GM:WorkshopSubscriptionsProgress
|
|
3215
|
+
*/
|
|
3216
|
+
WorkshopSubscriptionsProgress(self: GM, num: number, max: number): void;
|
|
3217
|
+
}
|
|
3218
|
+
|