diff --git a/mentoclist.lua b/mentoclist.lua new file mode 100644 index 0000000..876c25c --- /dev/null +++ b/mentoclist.lua @@ -0,0 +1,118 @@ +--[[ + +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to + +]] + +script_name("mentoclist") +script_author("treywisp") + +local sampev = require("samp.events") + +local active = false +local last_color = 0 + +local colors = { + [16777215] = 0, + [2852758528] = 1, + [2857893711] = 2, + [2857434774] = 3, + [2855182459] = 4, + [2863589376] = 5, + [2854722334] = 6, + [2858002005] = 7, + [2868839942] = 8, + [2868810859] = 9, + [2868137984] = 10, + [2864613889] = 11, + [2863857664] = 12, + [2862896983] = 13, + [2868880928] = 14, + [2868784214] = 15, + [2868878774] = 16, + [2853375487] = 17, + [2853039615] = 18, + [2853411820] = 19, + [2855313575] = 20, + [2853260657] = 21, + [2861962751] = 22, + [2865042943] = 23, + [2860620717] = 24, + [2868895268] = 25, + [2868899466] = 26, + [2868167680] = 27, + [2868164608] = 28, + [2864298240] = 29, + [2863640495] = 30, + [2864232118] = 31, + [2855811128] = 32, + [2866272215] = 33 +} + +local function notify(text) + sampAddChatMessage("[mentoclist] {FFFFFF}" .. text, 0xDC143C) +end + +local function mentoclist() + active = not active + + if active then + last_color = sampGetPlayerColor(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) + notify("Ментовские мигалки запущены. Для отключения напиши команду /mcl") + else + lua_thread.create(function() + local idx = colors[last_color] or 0 + wait(666) + sampSendChat("/clist " .. idx) + if idx == 0 then + notify("Мигалки выключены, прошлый клист невозможно выбрать, включен нулевой") + else + notify("Мигалки выключены, возвращен прошлый клист '" .. idx .. "'") + end + end) + + end +end + +function main() + if not isSampfuncsLoaded() or not isSampLoaded() then return end + while not isSampAvailable() do wait(100) end + + notify("Скрипт загружен. Команда активации и деактивации: /mcl") + + sampRegisterChatCommand("mcl", mentoclist) + + while true do wait(0) + if active then sampSendChat("/clist 17") wait(1400) end + if active then sampSendChat("/clist 8") wait(1400) end + end +end + +function sampev.onServerMessage(color, text) + if active and text:find("^ Цвет выбран") then + return false + end +end \ No newline at end of file