Garry's Mod

Garry's Mod

Not enough ratings
Tool API for Expression 2
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Build, Fun
File Size
Posted
12.046 KB
18 Jul, 2021 @ 11:38am
1 Change Note ( view )

Subscribe to download
Tool API for Expression 2

Description
This E2 extension provides functions to work with Garry's Mod tools. You can get and set players' tools, trigger execution of chips by switching to your toolgun and check the presence of a tool.

Enable this extension by typing the following in your console:
wire_expression2_extension_enable toolapi

Registered ConVars
  • wire_e2_toolapi_adminonly - If set to 1, only superadmins are able to call Tool API functions.
  • wire_e2_toolapi_set_adminonly - If set to 1, only superadmins are able to call functions that set the players' active tool (players can set active tool for themselves even if this is set to 1).

Full list of provided types
  • gtool - table{ string, string, string, entity }

Full list of provided APIs
Triggers
  • runOnTool
  • toolClk
Gathering Tool Information
  • gtool:getMode
  • gtool:getCategory
  • gtool:getHolder
  • gtool:getPrettyName
  • getToolMode
  • getToolCategory
  • getToolHolder
  • getToolPrettyName
Checking Presence Of A Tool
  • playerHasTool(entity, gtool)
  • playerHasTool(entity, string)
  • entity:hasTool(gtool)
  • entity:hasTool(string)
Getting Tool
  • getPlayerTool(entity, string)
  • getPlayerTool(entity)
  • entity:getTool(string)
  • entity:getTool
Setting Tool
  • setPlayerTool(entity, gtool)
  • setPlayerTool(entity, string)
  • entity:setTool(gtool)
  • entity:setTool(string)

GitHub Page
https://github.com/staticdehydration/e2-tool-api