The Game Modding Community - Since 2001

GMOD Console Commands

A Tutorial for Garry's Mod

Updates

Version 5
  • Addition Added env_laser explanation
2mo
Version 4
  • Addition Added func_reflective_glass explanation.
2mo
Alright, Let's get this tutorial started.

In GMOD, you can use Developer Console for execute Commands and have Fun too with sv_cheats 1.

So, here i'm going to show you some developer console Commands in GMOD

(And Some of them Need sv_cheats 1 for Work!)

  1. sv_cheats 1 - Enables cheats on the server.
  2. buddha -  Makes you survive if your health reaches on 1.
  3. noclip - Makes you fly around on the map. (Is the same effect If you press V [By Default] on sandbox.)
  4. thirdperson - Enables the Third Person camera. (It makes your camera on your back.)
  5. firstperson - Enables the First Person camera. (It resets the camera to normal if you use thirdperson.)

Well, That was SOME commands that can have in Source Engine games.

Now, Time to show some POSSIBLE entities on Gmod.

  1. ent_create weapon_alyxgun - Creates a Alyx's Gun on the map.
  2. ent_create weapon_357 - Creates a 357 weapon on the map.
  3. ent_create weapon_stunstick - Creates a Stun Stick weapon on the map.
  4. ent_create weapon_crowbar - Creates a Crowbar weapon on the map.
  5. ent_create weapon_physcannon - Creates a Gravity Gun on the map.
  6. ent_create weapon_crossbow - Creates a Crossbow on the map.
  7. ent_create weapon_bugbait - Creates a Bug Bait on the map.
  8. ent_create weapon_smg1 - Creates a SMG on the map.
  9. ent_create weapon_striderbuster - Creates a Strider Buster on the map. (BUT i think it need Half-Life: Episode Two to work.)
  10. ent_create weapon_shotgun - Creates a Shotgun on the map.
  11. ent_create weapon_rpg - Creates a RPG on the map.
  12. ent_create weapon_pistol - Creates a Pistol on the map.
  13. ent_create weapon_frag - Creates a Grenade on the map.
  14. ent_create weapon_ar2 - Creates a AR2 on the map.
  15. ent_create weapon_annabelle - Creates a Annabelle on the map.

Now, Some GMOD Commands.

  1. sv_kickerrornum 0 - Disables kicking for lua errors.
  2. sv_unlag 0 - Disables lag compesation.
  3. sv_password - Sets the password of the server.
  4. npc_create <NPCclassname> - Create the NPC matching <classname> at the point you're looking at, if it can fit in the space. (For example: npc_create npc_combine_s)

Now, point_viewcontrol.

point_viewcontrol?, Lemme Explain.

point_viewcontrol is a point entity available in all Source games. It is a camera entity that controls the player's view. While it's active, the player will see out of the camera.

In code it is represented by class CTriggerCamera, defined in triggers.cpp.

 Bug:

This class appears to have some problems. Please see its discussion page for notes.

For Example:

  1. ent_create point_viewcontrol fov 80 target path01 wait 10 moveto path02 speed 10 targetname testingviewcontrol01 - Creates a point_viewcontrol.
  2. ent_fire testingviewcontrol01 Enable - Enables the point_viewcontrol.

BUT WAIT!!

You need to create path_track for make the Command work!

path_track?, Lemme Explain.

path_track is a point entity available in all Source games. It is used to build paths for other entities to follow. Each path_track is a node on the path, each holding the name of the next path_track in the path.

For Example:

  1. ent_create path_track targetname path01 - Creates a path_track with targetname path01.

Then look somewhere then do:

  1. ent_create path_track targetname path02 - Creates a path_track with targetname path02.

Then Done!

Now, env_flare.

env_flare?, Lemme Explain.

Creates a red flare. Useful for creating a dark environment with just enough light to navigate. The flickering red light of the flare creates a tense atmosphere and a strong feeling of fight-or-die, as it's mainly used in HL2 only by the Combine.

In code it is represented by class CFlare, defined in hl2_dll\weapon_flaregun.cpp.

 Note:This entity is derived from CBaseCombatCharacter and can have relationships defined towards it.

 Tip:See the beginning of d2_prison_08 for an example of its use.

For Example:

  1. ent_create env_flare targetname flare01 scale 10 duration 5 - Creates a env_flare.

Here how it looks like in-game.


A env_flare in action.

env_flare's Keyvalues, Inputs, Flags and Outputs.

Keyvalues

Targetname:

Name <string>
The targetname that other entities refer to this entity by.
Entity Scripts <scriptlist> (New with Left 4 Dead 2)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
Script think function <string> (New with Left 4 Dead 2)
Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call. Note:Try to avoid expensive operations in this function, as it may cause performance problems.

Parentname:

Parent <targetname>
Specifies a movement parent. An entity will maintain its initial offset from its parent. An attachment point can be added to the end of the name, separated by a comma.
Angles:

Pitch Yaw Roll (Y Z X) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
Scale <float>
Size of the light signal.
Duration <float>
Active time of the entity.

Flags

  • 1 : No DLight
  • 2 : No Smoke
  • 4 : Infinite
  • 8 : Start off

Inputs

Targetname:

Kill
Removes this entity from the world.
KillHierarchy
Removes this entity and all its children from the world.
AddOutput  <string>
Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
Format: <key> <value>
Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
FireUser1 to FireUser4
Fire the OnUser outputs; see User Inputs and Outputs.
Use  !FGD
Same as a player invoking +use; may not do anything. Can also be invoked by creating an output that does not specify an input.
This input is not included in Valve's FGDs.
RunScriptFile  <script> (New with Left 4 Dead 2)
Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode  <string> (New with Left 4 Dead 2)
Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console. Bug:

In <Left 4 Dead 2>, the code is executed in the script scope of the entity that fires the output, not the one receiving the input.

 Warning:Never try to pass string parameters to a script function with this input. It will corrupt the VMF structure because of the nested quotation marks, which then must be removed manually with a text editor.

CallScriptFunction  <string> (New with Left 4 Dead 2) !FGD
Execute a VScript function in the scope of the receiving entity. Note:This input is missing from some games FGD files.

SetLocalOrigin  <origin> (New with Alien Swarm) !FGD
Set this entity's origin in the map. Note:This input is missing from some games FGD files.

SetLocalAngles  <angles> (New with Alien Swarm) !FGD
Set this entity's angles in the map. Note:This input is missing from some games FGD files.

Parentname:

SetParent  <string>
Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment  <string>
Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset  <string>
As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
ClearParent
Removes this entity from the the movement hierarchy, leaving it free to move independently.
Start  <float>
Starts the flare Emitting Smoke and light.
Die  <float>
Removes the flare.
Launch  <float>
Launch the flare forward with the specified speed.

Outputs

Targetname:

OnUser1 to OnUser4
These Outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.
OnKilled  
(New with Left 4 Dead)

This Output fires when the entity is killed and removed from the game.

Now, env_laser.

env_laser?, Lemme Explain.

It creates a laser beam between itself and a given target. It is somewhat similar to env_beam and not to be confused with env_portal_laser. If you are wondering why your env_laser entity doesn't damage you, first make sure that the "damage per second" value is not set to zero then you have to make sure that the centerpoint of the env laser in hammer is not inside a brush also make sure that the center of the env_laser is not on the edge of a brush in both those cases the damage is negated by the brushes.

To move a brush / entity very slightly so the center point doesn't intersect with the side of a wall anymore use "<ctrl> M" quick-key for hammer it opens up a small window. Click on Move!!!!! -and then click on the desired direction x y or z then fill in a value of either 0.01 or -0.01 to place the brush slightly off the grid by only a fraction... If you are still planning on moving these brushes afterwards do this when your map is finished because if you move these entities together with other parts of your map they might all get off the grid which isn't good for optimization.

If your env_laser doesn't have a targetname the "start on" flag doesn't have to be set since it starts automatically. If the env_laser does have a targetname you do need the "start on" flag if you want it to start when the map spawns.

 In code, it is represented by class CEnvLaser, defined in EnvLaser.cpp.


For Example:

  1. ent_create env_laser targetname laser01 width 5 texture sprites/laserbeam.spr renderamt 255 rendercolor "255 255 255" - Creates a env_laser.

Here how it looks like in-game.


A env_laser in action. It can target entities like npc_zombie for example.


env_laser's Keyvalues:

Target of Laser (LaserTarget) <targetname>
Name of entity, or entities, to strike at. The target is randomly chosen if there are multiple entities matching the given name.
Brightness (1 - 255) (renderamt) <integer>
Beam brightness.
Beam Color (R G B) (rendercolor) <color255>
Beam color.
Width of Beam <float>
The width of the laser beam, in pixels.
Amount of noise (0-255 (NoiseAmplitude) <integer>
The amount of noise in the beam. 0 is a perfectly straight beam.
Sprite Name (texture) <sprite>
The material used to draw the laser beam.
End Sprite (endsprite) <sprite>
If specified, this sprite will be drawn at the end of the laser beam.
Texture Scroll Rate (0-100) (texturescroll) <integer>
Rate at which the beam texture should scroll along the beam.
Starting Frame (framestart) <integer>
The frame to start the beam texture on.
Damage / second <string>
How much damage this laser does. per second. to things it hits.
Dissolve Type (dissolvetype) <choices>
Dissolve effect type.
 Note:This effect is not available in all games.

  • -1 : None
  • 0 : Energy
  • 1 : Heavy electrical
  • 2 : Light electrical

env_laser's Flags:

  • 1 : Start On
  • 16 : StartSparks
  • 32 : EndSparks
  • 64 : Decal End

Now, func_reflective_glass.

func_reflective_glass?, Lemme Explain.

It is used to produce perfectly reflective glass that renders world + entities. You must use a reflectiveglass texture (glass/reflectiveglass001.vmt is a good start) on one side of the brush, and the rest of the sides either nodraw or some other opaque texture for this to work properly.

 Note:This entity will not show a player their own reflection, however it will render other players.

 Bug:

This entity will cease to render or cause visual artifacts if water and or portals are in a visible visleaf.

 Bug:

If more than one face of this brush entity contains a reflective or translucent texture, then the mirror's behavior will suddenly switch depending on one's perspective. To prevent this, make sure exactly one surface has the reflective texture. All others must be opaque.

For Example:

  1. ent_create func_reflective_glass model *6 targetname refle01 - Creates a func_reflective_glass with model *6

BUT..

It only works with brushes that have reflective glass texture!

Here how it looks like in-game.


A func_reflective_glass in action.  gm_construct have a brush that have reflective texture.

Now, lua_run.

lua_run?, Lemme Explain.

A console command that allows you to run lua code on the server.

Examples:

lua_run Entity(1):SetHealth(300)
 Set's the first player's health to 300.

lua_run zombie = ents.Create("npc_zombie") zombie:Spawn()
Creates a zombie and spawns it (at the origin by default).

lua_run zombie:Ignite()
Sets our previously spawned zombie on fire.

BUT WAIT..

There's lua_run_cl too!

lua_run_cl?, Lemme Explain.

A console command that allows you to run lua code on the client.

For Example:

lua_run_cl print(LocalPlayer():GetPos(),LocalPlayer():EyeAngles())
Prints your world position and eye angles.

Alright, that was not all GMOD Developer console commands..
Maybe later i add more on the tutorial..

But Don't Worry..

I will find Even more GMOD Console commands for the Tutorial.

That's it for now, Bye!

------------------------------------------------------------------------------------------------

Updates:

Version 5 (Minor Update)

  • -Added env_laser explanation.

Version 4 (Minor Update)

  • -Added func_reflective_glass explanation.

Version 3 (Minor Update)

  • -Added env_flare explanation
  • -Added env_flare's Keyvalues, Inputs, Flags and Outputs.

Version 2.5 (Minor Update)

  • -Added lua_run explanation.
  • -Added lua_run_cl explanation.

Version 2 (Just Getting Started Update)

  • -Added point_viewcontrol explanation.
  • -Added path_track explanation.
  • -Added more ent_create commands.

Todos

Gmod_ entities explanations..

Posts

Embed

Share banner
Image URL:
HTML embed code:
BB embed code:
Markdown embed code:

Credits

Creators
Lukaswbrr avatar
Lukaswbrr username pic Joined 3y ago
Offline
Creator of this tutorial.
Special Thanks
Valve Developer Community
For list of Entities and Commands.

Submitter

Lukaswbrr avatar
Lukaswbrr username pic Joined 3y ago
Offline

Lukaswbrr avatar
Lukaswbrr

Creator
Sign up to access this!
Sign up to access this!
Sign up to access this!
Sign up to access this!

Category

Details

Difficulty Level
Beginner Difficulty

Attributes

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • Share on Google+

Stats

  • 6,883 Views
  • 2 Posts
  • 11mo Submitted
  • 2mo Modified
  • 2mo Updated

Scores

  • Not yet rated
Sign up to access this!

Greetings! Mascot

GameBanana is one of the oldest mod sites on the net. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation - send modders points.
  • Post: Give modders your thoughts on their work.
  • Vote: Help your favorite modders win monthly awards.
  • Rate: Rate mods and help them stand out.
  • Flag: Alert moderators and warn members of problems with mods.
  • Watch: Get notified when mods are updated.

Resistance is futile... Sign up now!

Already a Bananite? Login

bcp.crwdcntrl.net tracking pixel