- 5
- 0
- Версия MoonLoader
- .026-beta
Я пытаюсь создать скрипт, который определяет, кто присоединяется к зоне трансляции, но он не работает. Что я делаю не так?
Lua:
script_name("Player Stream Notifier")
script_version("1.1")
require "lib.moonloader"
require "lib.sampfuncs"
local streamNotificationsEnabled = true
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("streamon", function()
sampAddChatMessage("[StreamZone] Streaming notifications are enabled.", 0x00FF00)
end)
sampRegisterChatCommand("streamoff", function()
streamNotificationsEnabled = false
sampAddChatMessage("[StreamZone] Streaming notifications are disabled.", 0xFF0000)
end)
sampAddChatMessage("[StreamZone] Loaded. USE /streamon or /streamoff", 0xAAAAAA)
end
function onPlayerStreamIn(playerId)
if streamNotificationsEnabled then
local nickname = sampGetPlayerNickname(playerId)
sampAddChatMessage(string.format("[StreamZone] %s (ID: %d) joined the streaming zone.", nickname, playerId), 0xFFFF00)
end
end