Skip to content

Instantly share code, notes, and snippets.

@strawberrylua
Created October 20, 2021 23:06
Show Gist options
  • Save strawberrylua/09004c78f81151ca863418faec5d466f to your computer and use it in GitHub Desktop.
Save strawberrylua/09004c78f81151ca863418faec5d466f to your computer and use it in GitHub Desktop.
gamesense.vip ― Lua User Snippets for Visual Studio Code
{"Config save":{"prefix":"config.save()","body":"config.save()$1","description":"Takes no arguments\n\n"},"Config load":{"prefix":"config.load()","body":"config.load()$1","description":"Takes no arguments\n\n"},"Set clan tag":{"prefix":"client.set_clan_tag()","body":"client.set_clan_tag($1)","description":"(str) name\n\n"},"Set event callback":{"prefix":"client.set_event_callback()","body":"client.set_event_callback($1)","description":"(str) event name\n\n"},"Run script":{"prefix":"client.run_script()","body":"client.run_script($1)","description":"(str) scriptname\n\n"},"Reload active scripts":{"prefix":"client.reload_active_scripts()","body":"client.reload_active_scripts($1)","description":"Takes no arguments\n\n"},"Create font":{"prefix":"surface.create_font()","body":"surface.create_font($1)","description":"(str) fontname , (int) width, (int) height, (int/hex) flags\n\nreturns (int) font"},"Create texture":{"prefix":"surface.create_texture()","body":"surface.create_texture($1)","description":"Takes no arguments \n\nreturns (int) texture"},"Draw filled rectangle":{"prefix":"surface.draw_filled_rect()","body":"surface.draw_filled_rect($1)","description":"(int) x, (int) y, (int) width, (int) height\n\n"},"Draw line":{"prefix":"surface.draw_line()","body":"surface.draw_line($1)","description":"(int) x, (int) y, (int) x2, (int) y2\n\n"},"Draw outlined circle":{"prefix":"surface.draw_outlined_circle()","body":"surface.draw_outlined_circle($1)","description":"(int) x, (int) y, (int) radius, (int) segments\n\n"},"Draw outlined rectangle":{"prefix":"surface.draw_outlined_rect()","body":"surface.draw_outlined_rect($1)","description":"(int) x, (int) y, (int) width, (int) height\n\n"},"Draw text":{"prefix":"surface.draw_text()","body":"surface.draw_text($1)","description":"(str) text\n\n"},"Draw textured rectangle":{"prefix":"surface.draw_textured_rect()","body":"surface.draw_textured_rect($1)","description":"(int) x, (int) y, (int) width, (int) height\n\n"},"Get text size":{"prefix":"surface.get_text_size()","body":"surface.get_text_size($1)","description":"(int) font, (str) text\n\nreturns (int) width, (int) height\n\n"},"Indicator":{"prefix":"surface.indicator()","body":"surface.indicator($1)","description":"(str) text, (int) r, (int) g, (int) b, (int) a\n\n"},"Set color":{"prefix":"surface.set_color()","body":"surface.set_color($1)","description":"(int) r, (int) g, (int) b, (int) a\n\n"},"Set texture":{"prefix":"surface.set_texture()","body":"surface.set_texture($1)","description":"(int) id \n\n"},"Set text color":{"prefix":"surface.set_text_color()","body":"surface.set_text_color($1)","description":"(int) r, (int) g, (int) b, (int) a\n\n"},"Set text font":{"prefix":"surface.set_text_font()","body":"surface.set_text_font($1)","description":"(int) font\n\n"},"Set text pos":{"prefix":"surface.set_text_pos()","body":"surface.set_text_pos($1)","description":"(int) x, (int), y\n\n"},"Draw Gradient":{"prefix":"surface.draw_filled_rect_fade()","body":"surface.draw_filled_rect_fade($1)","description":"(int) x, (int) y, (int) x2, (int) y2, (int) alpha1, (int) alpha2, (bool) horizontal\n\n"},"Get model materials":{"prefix":"models.get_model_materials()","body":"models.get_model_materials($1)","description":"(model_t*) mdl, (int) count\n\nreturns (sol::table)"},"Get model name":{"prefix":"models.get_model_name()","body":"models.get_model_name($1)","description":"(model_t*) mdl\n\nreturns (string) name"},"Get Studio model":{"prefix":"models.get_studio_model()","body":"models.get_studio_model($1)","description":"(model_t*) mdl\n\nreturns (studiohdr_t*)"},"Get model index":{"prefix":"models.get_model_index()","body":"models.get_model_index($1)","description":"(string) name\n\nreturns (int)"},"Console color print":{"prefix":"engine.console_color_print()","body":"engine.console_color_print($1)","description":"(int) r, (int) g, (int) b, (int) a, (str) text\n\n"},"Console print":{"prefix":"engine.console_print()","body":"engine.console_print($1)","description":"(str) text\n\n"},"Get username":{"prefix":"engine.get_user_name()","body":"engine.get_user_name()$1","description":"Takes no arguments\n\nreturns (str) client name"},"Client cmd":{"prefix":"engine.client_cmd()","body":"engine.client_cmd($1)","description":"(str) cmd\n\n"},"Client cmd unrestricted":{"prefix":"engine.client_cmd_unrestricted()","body":"engine.client_cmd_unrestricted($1)","description":"(str) cmd\n\n"},"Execute client cmd":{"prefix":"engine.execute_client_cmd()","body":"engine.execute_client_cmd($1)","description":"(str) cmd\n\n"},"Get game directory":{"prefix":"engine.get_game_directory()","body":"engine.get_game_directory()$1","description":"Takes no arguments\n\nreturns (str) path\n\n"},"Get local player index":{"prefix":"engine.get_local_player_index()","body":"engine.get_local_player_index()$1","description":"Takes no arguments\n\nreturns (int) index\n\n"},"Get player info":{"prefix":"engine.get_player_info()","body":"engine.get_player_info()$1","description":"(int) ent\n\nreturns (player_info_t) player_info"},"Get screen size":{"prefix":"engine.get_screen_size()","body":"engine.get_screen_size()$1","description":"Takes no arguments\n\nreturns (int) w, (int) h"},"Get view angles":{"prefix":"engine.get_view_angles()","body":"engine.get_view_angles()$1","description":"Takes no arguments\n\nreturns (vector) angles"},"Get time scale":{"prefix":"engine.get_timescale()","body":"engine.get_timescale()$1","description":"Takes no arguments\n\nreturns (float) value"},"Is in game":{"prefix":"engine.is_in_game()","body":"engine.is_in_game()$1","description":"Takes no arguments\n\nreturns (bool) value"},"Is connected":{"prefix":"engine.is_connected()","body":"engine.is_connected()$1","description":"Takes no arguments\n\nreturns (bool) value"},"Is paused":{"prefix":"engine.is_paused()","body":"engine.is_paused()$1","description":"Takes no arguments\n\nreturns (bool) value"},"Is playing demo":{"prefix":"engine.is_playing_demo()","body":"engine.is_playing_demo()$1","description":"Takes no arguments\n\nreturns (bool) value"},"Write screenshot":{"prefix":"engine.write_screenshot()","body":"engine.write_screenshot($1)","description":"(str) filename\n\n"},"Set timescale":{"prefix":"engine.set_timescale()","body":"engine.set_timescale($1)","description":"(float) number\n\n"},"Get_client_entity":{"prefix":"entity_list.get_client_entity()","body":"entity_list.get_client_entity($1)","description":"(int) index\n\nreturns (CBaseEntity*) entity"},"Get client_entity from handle":{"prefix":"get_client_entity_from_handle()","body":"get_client_entity_from_handle($1)","description":"(ULONG) ent\n\nreturns (CBaseEntity*) entity"},"Get highest entity index":{"prefix":"entity_list.get_highest_entity_index()","body":"entity_list.get_highest_entity_index($1)","description":"returns (int) index\n\n"},"Get number of entities":{"prefix":"entity_list.number_of_entities()","body":"entity_list.number_of_entities($1)","description":"(bool) bool\n\nreturns (int) value"},"Get player data":{"prefix":"utils.get_player_data()","body":"utils.get_player_data($1)","description":"(player_info_t) p\n\nreturns (sol::table) table"},"Clamp":{"prefix":"utils.clamp()","body":"utils.clamp($1)","description":"(float) value, (float) min, (float) max\n\nreturns (float) value"},"World to screen":{"prefix":"utils.world_to_screen()","body":"utils.world_to_screen($1)","description":"(vector) pos\n\nreturns (Vector) pos"},"Distance on screen":{"prefix":"utils.distance_on_screen()","body":"utils.distance_on_screen($1)","description":"(vector2D) a, (vector2D) b\n\nreturns (float) value"},"Realtime":{"prefix":"globals.realtime()","body":"globals.realtime()$1","description":"Takes no arguments\n\nreturns (float) value"},"Framecount":{"prefix":"globals.framecount()","body":"globals.framecount()$1","description":"Takes no arguments\n\nreturns (int) value"},"Absoluteframetime":{"prefix":"globals.absoluteframetime()","body":"globals.absoluteframetime()$1","description":"Takes no arguments\n\nreturns (float) value"},"Curtime":{"prefix":"globals.curtime()","body":"globals.curtime()$1","description":"Takes no arguments\n\nreturns (float) value"},"Frametime":{"prefix":"globals.frametime()","body":"globals.frametime()$1","description":"Takes no arguments\n\nreturns (float) value"},"Max clients":{"prefix":"globals.maxclients()","body":"globals.maxclients()$1","description":"Takes no arguments\n\nreturns (int) value"},"Tick count":{"prefix":"globals.tickcount()","body":"globals.tickcount()$1","description":"Takes no arguments\n\nreturns (int) value"},"Tick Interval":{"prefix":"globals.tickinterval()","body":"globals.tickinterval()$1","description":"Takes no arguments\n\nreturns (float) value"},"Trace":{"prefix":"trace.traceray()","body":"trace.traceray($1)","description":"(vector) from, (vector) to, (int) mask\n\nreturns (float) value, (CBaseEntity*) entity"},"Find var":{"prefix":"cvar.find_var()","body":"cvar.find_var($1)","description":"(string) name\n\nreturns (ConVar*) convar"},"Get float":{"prefix":"cvar.get_float()","body":"cvar.get_float($1)","description":"(ConVar*) name\n\nreturns (float) value"},"Get int":{"prefix":"cvar.get_int()","body":"cvar.get_int($1)","description":"(ConVar*) name\n\nreturns (int) value"},"Set float":{"prefix":"cvar.set_float()","body":"cvar.set_float($1)","description":"(ConVar*) name, (float) value\n\n"},"Set int":{"prefix":"cvar.set_int()","body":"cvar.set_int($1)","description":"(ConVar*) name, (int) value\n\n"},"Box overlay":{"prefix":"overlay.add_box_overlay()","body":"overlay.add_box_overlay($1)","description":"(vector) pos, (vector) mins, (vector) maxs, (vector) orientation, (int) r, (int) g, (int) b, (int) a, (float) duration\n\n"},"Capsule overlay":{"prefix":"overlay.add_capsule_overlay()","body":"overlay.add_capsule_overlay($1)","description":"(vector) mins, (vector) maxs, (float) pill, (int) r, (int) g, (int) b, (int) a, (float) duration\n\n"},"Entity text overlay":{"prefix":"overlay.add_entity_text_overlay()","body":"overlay.add_entity_text_overlay($1)","description":"(int) ent, (int) line_offset, (float) duration, (int) r, (int) g, (int) b, (int) a, (str) txt\n\n"},"Line overlay":{"prefix":"overlay.add_line_overlay()","body":"overlay.add_line_overlay($1)","description":"(vector) p, (vector) pp, (int) r, (int) g, (int) b, (int) a, (bool) nodepth, (float) duration\n\n"},"Screen text overlay":{"prefix":"overlay.add_screen_text_overlay()","body":"overlay.add_screen_text_overlay($1)","description":"(vector) pos, (float) duration, (int) r, (int) g, (int) b, (int) a, (str) txt\n\n"},"Sphere overlay":{"prefix":"overlay.add_sphere_overlay()","body":"overlay.add_sphere_overlay($1)","description":"(vector) pos, (float) rad, (int) theta, (int) phi, (int) r, (int) g, (int) b, (int) a, (float) duration\n\n"},"Text overlay":{"prefix":"overlay.add_text_overlay()","body":"overlay.add_text_overlay($1)","description":"(vector) pos, (int) line_offset, (float) duration, (int) r, (int) g, (int) b, (int) a, (str) txt\n\n"},"Triangle overlay":{"prefix":"overlay.add_triangle_overlay()","body":"overlay.add_triangle_overlay($1)","description":"(vector) p1, (vector) p2, (vector) p3, (int) r, (int) g, (int) b, (int) a, (bool) nodepth, (float) duration\n\n"},"Screen positon":{"prefix":"overlay.screen_position()","body":"overlay.screen_position($1)","description":"(vector) pos\n\nreturns (vector) pos"},"Create circle points":{"prefix":"beams.create_circle_points()","body":"beams.create_circle_points($1)","description":"(BeamInfo_t) beam_info\n\nreturns (Beam_t*) beam_t"},"Create ents":{"prefix":"beams.create_ents()","body":"beams.create_ents($1)","description":"(BeamInfo_t) beam_info\n\nreturns (Beam_t*) beam_t"},"Create ent point":{"prefix":"beams.create_ent_point()","body":"beams.create_ent_point($1)","description":"(BeamInfo_t) beam_info\n\nreturns (Beam_t*) beam_t"},"Create follow":{"prefix":"beams.create_follow()","body":"beams.create_follow($1)","description":"(BeamInfo_t) beam_info\n\nreturns (Beam_t*) beam_t"},"Create points":{"prefix":"beams.create_points()","body":"beams.create_points($1)","description":"(BeamInfo_t) beam_info\n\nreturns (Beam_t*) beam_t"},"Create ring":{"prefix":"beams.create_ring()","body":"beams.create_ring($1)","description":"(BeamInfo_t) beam_info\n\nreturns (Beam_t*) beam_t"},"Create ring point":{"prefix":"beams.draw_beam()","body":"beams.draw_beam($1)","description":"(BeamInfo_t) beam_info\n\nreturns (Beam_t*) beam_t"},"Draw beam":{"prefix":"beams.create_follow()","body":"beams.create_follow($1)","description":"(Beam_t*) beam\n\n"},"Free beam":{"prefix":"beams.free_beam()","body":"beams.free_beam($1)","description":"(Beam_t*) beam\n\n"},"Update beam info":{"prefix":"beams.update_beam_info()","body":"beams.update_beam_info($1)","description":"(Beam_t*) beam, (BeamInfo_t) beam_info\n\n"},"Encode":{"prefix":"base64.encode()","body":"base64.encode($1)","description":"(str) text\n\nreturns (str) string"},"Decode":{"prefix":"base64.decode()","body":"base64.decode($1)","description":"(str) string\n\nreturns (str) text"},"Get":{"prefix":"ui.get()","body":"ui.get($1)","description":"(str) key\n\n"},"Set":{"prefix":"ui.set()","body":"ui.set($1)","description":"(str) key, (int\\bool\\float\\color) value\n\n"},"Checkbox":{"prefix":"ui.new_checkbox()","body":"ui.new_checkbox($1)","description":"(str) tab, (str) groupbox, (str) name, (str) key,\n[optional] (bool) def, (function) callback\n\n"},"Keybind":{"prefix":"ui.new_keybind()","body":"ui.new_keybind($1)","description":"(str) tab, (str) groupbox, (str) name, (str) key,\n[optional] (bool) allowstylechange, (bool) def, (function) callback\n\n"},"Multiselect":{"prefix":"ui.new_multiselect()","body":"ui.new_multiselect($1)","description":"(str) tab, (str) groupbox, (str) name, (str) key,\n(table) items,\n[optional] (table<int, bool>) def, (function) callback\n\n"},"Singleselect":{"prefix":"ui.new_singleselect()","body":"ui.new_singleselect($1)","description":"(str) tab, (str) groupbox, (str) name, (str) key, (table) items,\n[optional] (int) def, (function) callback\n\n"},"Slider int":{"prefix":"ui.new_slider_int()","body":"ui.new_slider_int($1)","description":"(str) tab, (str) groupbox, (str) name, (str) key,(int) min, (int) max,\n[optional] (string), format, (int) def, (function) callback\n\n"},"Slider float":{"prefix":"ui.new_slider_float()","body":"ui.new_slider_float($1)","description":"(str) tab, (str) groupbox, (str) name, (str) key, (float) min, (float) max,\n[optional] (string), format, (int) def, (function) callback\n\n"},"Text":{"prefix":"ui.new_text()","body":"ui.new_text($1)","description":"(str) tab, (str) groupbox, (str) name, (str) key\n\n"},"Button":{"prefix":"ui.new_button()","body":"ui.new_button($1)","description":"(str) tab, (str) groupbox, (str) name, (str) key,\n[optional] (function) callback\n\n"},"Colorpicker":{"prefix":"ui.new_colorpicker()","body":"ui.new_colorpicker($1)","description":"(str) tab, (str) groupbox, (str) name, (str) key,\n[optional] (int) r, (int) g, (int) b, (int) a, (function) callback\n\n"},"Set callback":{"prefix":"ui.set_callback()","body":"ui.set_callback($1)","description":"(str) key, (function) callback\n\n"},"Set items":{"prefix":"ui.set_items()","body":"ui.set_items($1)","description":"(str) key, (table) items\n\n"},"Set label":{"prefix":"ui.set_label()","body":"ui.set_label($1)","description":"(str) key, (str) text\n\n"},"Set visibility":{"prefix":"ui.set_visibility()","body":"ui.set_visibility($1)","description":"(str) key, (bool) value\n\n"},"Is bind active":{"prefix":"ui.is_bind_active()","body":"ui.is_bind_active($1)","description":"(str) key\n\nreturns (bool) value"}}
@strawberrylua
Copy link
Author

Lua Code Snippets for VS Code

gamesense.vip ― Lua User Snippets for Visual Studio Code

Installation

» Place the lua.json file in your VS Code snippets folder. %userprofile%\AppData\Roaming\Code\User\snippets
» TIP! Press Windows key + r on your keyboard to write %userprofile%\AppData\Roaming\Code\User\snippets and hit the enter button!

Any problems? Join discord!
» https://gamesense.vip/forums/viewtopic.php?id=716

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment