-
Notifications
You must be signed in to change notification settings - Fork 0
Extended userdata APIs
dounai2333 edited this page Jan 4, 2025
·
3 revisions
Extended APIs are not in the global dounai_lib variable, they are directly extended and are ready-to-use.
For example, you can directly use them without refer to dounai_lib:
-- This will get the entity at index 2 (normally is the listenserver host)
local player = Entity(2)
-- Make this player have blink effect for 5 seconds, the effect color is set to green, and blink 2 times in a second.
player:Blink(Color(0, 255, 0), 5, 2)The player:Blink() is the simplified version of following code in original:
local player = GetPlayerByIndex(2)
player:SetBlinkColor(0, 1, 0)
player:SetBlink(2)
EventManager:RegisterTimer("PlayerBlink", 5, player:GetUserID(), false)
function PlayerBlink(userid)
local player = GetPlayerByUserId(userid)
if player then
player:SetBlink(0)
end
endExtended APIs are needed to use another page to properly format.