forked from Dave-Zhou/h-lua
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathecho.lua
26 lines (26 loc) · 862 Bytes
/
echo.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- 在屏幕打印信息给所有玩家
---@param msg string
---@param whichPlayer userdata 可选,打印给某玩家
---@param duration number
---@param x number 可选,屏幕x处
---@param y number 可选,屏幕y处
echo = function(msg, whichPlayer, duration, x, y)
duration = duration or 0
x = x or 0
y = y or 0
if (whichPlayer == nil) then
for i = 0, bj_MAX_PLAYERS - 1, 1 do
if (duration == nil or duration < 5) then
cj.DisplayTextToPlayer(cj.Player(i), x, y, msg)
else
cj.DisplayTimedTextToPlayer(cj.Player(i), x, y, duration, msg)
end
end
else
if (duration < 5) then
cj.DisplayTextToPlayer(whichPlayer, x, y, msg)
else
cj.DisplayTimedTextToPlayer(whichPlayer, x, y, duration, msg)
end
end
end