High-performance, powerful vscript libraries; written mainly for CSGO.
It is advised to always use the latest version.
- See Documentation.md
Place vs_library.nut
in your vscripts directory /csgo/scripts/vscripts/
Method 1. Manually download the library by right clicking HERE, and choosing "Save Link As...".
After acquiring the file, place it in your vscripts directory: /csgo/scripts/vscripts/
Method 2. Using curl, use the following line to download the library directly into your game files.
cd "W:/Program Files (x86)/Steam/steamapps/common/Counter-Strike Global Offensive/csgo/scripts/vscripts/";curl -O https://raw.githubusercontent.com/samisalreadytaken/vs_library/master/vs_library.nut
Add this following line in the beginning of your script: IncludeScript("vs_library")
Done!
It only needs to be included once in the lifetime of the map running in the server. Including it more than once does not affect the performance.
Set up these event listeners to automatically validate player userids. This will let you access player userids, SteamIDs, and Steam names.
Entity targetnames are arbitrary.
logic_eventlistener:
targetname: player_connect
EventName: player_connect
FetchEventData: Yes
OnEventFired > player_connect > RunScriptCode > VS.Events.player_connect(event_data)
logic_eventlistener:
targetname: player_spawn
EventName: player_spawn
FetchEventData: Yes
OnEventFired > player_spawn > RunScriptCode > VS.Events.player_spawn(event_data)
You can access the player data via their scope.
player.GetScriptScope().userid
player.GetScriptScope().networkid
player.GetScriptScope().name
You can get the player handle from their userid.
local player = VS.GetPlayerByUserid(userid)
Use VS.DumpPlayers(1)
to see every player data.
] script VS.DumpPlayers(1)
=======================================
1 players found
2 bots found
[BOT] - ([2] player) :: 8b4f4f2f171_player
--- Script dump for entity ([2] player)
networkid = "BOT"
userid = 24
name = "Ethan"
--- End script dump
[BOT] - ([3] player) :: b02f4f5e377_player
--- Script dump for entity ([3] player)
networkid = "BOT"
userid = 25
name = "Tim"
--- End script dump
[PLAYER] - ([1] player) :: b3ff40ba523_player
--- Script dump for entity ([1] player)
networkid = "STEAM_1:0:11101"
userid = 14
name = "Sam"
--- End script dump
=======================================
See CHANGELOG.txt
You are free to use, modify and share this library under the terms of the MIT License. The only condition is keeping the copyright notice, and state whether or not the code was modified. See LICENSE for details.
- vscripts repository: Some of my projects using this library
- YouTube channel: Related videos and tutorials
- Notepad++ syntax highlighter