elseif string.match(event.content, “^循环自杀(%d+) (%d+)$”) then
— 新增循环自杀功能
local playerID, loopCount = string.match(event.content, “^循环自杀(%d+) (%d+)$”)
playerID, loopCount = tonumber(playerID), tonumber(loopCount)
if playerID and loopCount then
local function killPlayer()
if loopCount > 0 then
— 使用 Actor:killSelf 方法让玩家死亡
Actor:killSelf(playerID)
loopCount = loopCount – 1
threadpool:wait(0.1) — 每0.1秒自杀一次
killPlayer() — 递归调用,继续自杀
end
end
killPlayer()
else
print(“循环自杀指令格式错误,正确格式为:循环自杀<玩家ID> <循环次数>”)–并非完整脚本
没有回复内容