Skip to content

New game events

dounai2333 edited this page Jan 24, 2025 · 2 revisions

Introduction

dounai_lib provide new events that wasn't exist in base game, they are meant to make things easier.

accept_input

function accept_input(entindex, activator, input, param)
end

Called when a map I/O event occurs.

Can be disabled by a global switch: dounai_lib.event.accept_input.enable = false

entindex: number. Example: When player open a door, this is the door entity.

activator: number. Example: When player open a door, this is the player.

input: string. Example: Use, Press, Enable and Disable

param: string. In most cases this is empty.

// Console command
ent_fire button Press // "input" is "Press", "param" is empty
ent_fire !self AddOutput "origin 0 0 0" // "input" is "AddOutput", "param" is "origin 0 0 0"
ent_fire foo IgniteLifetime 3 // "input" is "IgniteLifetime", "param" is "3"

cso2_throw_grenade_fixed

function cso2_throw_grenade_fixed(userid, entindex, weapon)
end

Called when player throw a grenade and the grenade is successfully spawned. This is 8 ticks late than original cso2_throw_grenade event.

WARNING: If entity_created event is disabled, this event will be force disabled!

Can be disabled by a global switch: dounai_lib.event.cso2_throw_grenade_fixed.enable = false

userid: number

entindex: number

weapon: string

entity_created

function entity_created(entindex, classname)
end

Called as soon as the entity is created. Very little of the entity's properties will be initialized at this stage. (keyvalues, classname, flags, anything).

Can be disabled by a global switch: dounai_lib.event.entity_created.enable = false

entindex: number

classname: string

player_use

function player_use(userid, entity)
end

Called when the player presses use on an object.

WARNING: If accept_input event is disabled, this event will be force disabled!

Can be disabled by a global switch: dounai_lib.event.player_use.enable = false

userid: number

entity: number

Clone this wiki locally