-
Notifications
You must be signed in to change notification settings - Fork 0
Home
I'm still working on the document, so if something is missing: wait, or just ask me on the Discord!
And, you know what? Most of the function are 1:1 the same name as in GMod wiki! Even the document are copy-paste!
So, check it out, maybe you will find something you needed before I add it: https://wiki.facepunch.com/gmod
How to install dounai_lib:
- Download latest release.
- Unpack it to your main CSO2 folder (The one with "Bin" and "Data" folder exists).
- Open your lua project, add following code to the first line:
require("dounai-lib")Once everything is done, when goes into the game, you should see this message in the chatbox:

If you see this message, dounai_lib is successfully loaded and working, if there is nothing, you should check your console, looking for the error message.
The usage of dounai_lib is not like other common Lua libs, you don't have to do local dounai_lib = require("dounai-lib").
Instead, a global variable called dounai_lib will be set, with everything you needed in it.
When calling a function from dounai_lib, you can simply do this:
-- Directly use the function.
local entities = dounai_lib.ents.GetAll()
dounai_lib.timer.Simple(1, function()
print("Hello World!")
endOR
-- Create another variable for easier coding.
local ents = dounai_lib.ents
local entities = ents.GetAll()
local timer = dounai_lib.timer
timer.Simple(1, function()
print("Hello World!")
endThese are "install to working", doesn't need extra code or function calls!
When player throw a grenade, there will be a trail following the grenade projectile.
By default, the he grenade come with red color, and the flashbang is white, smoke grenade is green.
This feature can be disabled by a global switch: dounai_lib.feature.GrenadeTrails.enable = false.
Come in handy server-side only entities (CServerOnlyEntity: "env_fade", "filter_activator_team" and "math_counter" etc) support, now you can get them normally by using Entity(index) or original GetEntityByIndex(index), with all entity APIs working!
The delay parameter now support using decimal point, you can use 0.5 or 2.9 seconds as delay without issue.
Only 1 timer can be triggered in single tick is also fixed.
The event will no longer use "userid" as argument, instead, it has been replaced to "pointer", which is the pointer address of the grenade projectile itself.
By giving the pointer to dounai_lib.c.GetEntityIndexByPointer(), you can get the entity index without unnecessary code.
As a additional changes, "x" "y" "z" arguments has been restored, they are the origin of the entity.
By overriding bulit-in print() function, now using print("Hello World!") will print the message directly to your console.
printf("Hello %s!", "World") is also available.
Block the chat message ("say" and "say_team" commands) that will send to the other players. They are useless for normal players, but useful for programmer.
Game events can now be created and fired even there is no listener attach to it, this is mainly for debugging (net_showevents 2).