trinity.cfg не работает.

tokyoghoul

Новичок
Автор темы
17
2
Версия SA-MP
  1. Другая
Белый чат если что делает на тринити, но не работает. CLEO 4, SAMPFUNCS 5.2 вот этот короче, забыл следующую ну новые.
Вот сам код:
script_name("Trinity Config")
script_author("brown.")
script_version_number(1)
script_dependencies("SAMPFUNCS, SAMP")
require("lib.moonloader")
local cfg = require 'inicfg'
local samp = require 'lib.samp.events'
local Config = cfg.load({
Settings = {
RemoveUnderlines = false,
RemoveSystemMessages = false,
RemoveArmour = false,
DeleteTextdraw = false,

ColorChat = 'e6e7e5',
ColorChatLow = 'c4c4c4',
ColorShout = 'e6e7e5',
ColorRoleplay = 'c2a2da',
ColorICRadio = '8d8dff',
ColorOOCRadio = '5a5abb',
ColorPrefixICDep = 'b22222',
ColorPrefixOOCDep = '921111',
ColorICDep = 'ffe4b5',
ColorOOCDep = 'aa8070',
ColorW = '98ff98',
ColorStatus = false,

MDWanted = false,
MDChase = false,
MDArrest = false,
MDCalls = false,
MDAirdrop = false,
MDAdvertisement = false
}
}, 'TrinityCfg')

function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end

sampRegisterChatCommand('trinityconfig', MainMenu)
sampRegisterChatCommand('trinitycfg', MainMenu)
sampRegisterChatCommand('cfg', MainMenu)

while true do
wait(0)
local result, button, list, _ = sampHasDialogRespond(60001)
if result then
if button == 1 and list == 0 then
ColorChanger()
end
if button == 1 and list == 1 then
MessageDisabler()
end
if button == 1 and list == 2 then
Config.Settings.RemoveUnderlines = not Config.Settings.RemoveUnderlines
MainMenu()
end
if button == 1 and list == 3 then
Config.Settings.RemoveSystemMessages = not Config.Settings.RemoveSystemMessages
MainMenu()
end
if button == 1 and list == 4 then
Config.Settings.RemoveArmour = not Config.Settings.RemoveArmour
MainMenu()
end
if button == 1 and list == 5 then
Config.Settings.DeleteTextdraw = not Config.Settings.DeleteTextdraw
MainMenu()
end
end

local result, button, list, _ = sampHasDialogRespond(60010)
if result then
if button == 1 and list == 0 then sampShowDialog(60011, 'Укажите цвет простого чата', '', 'Выбрать', 'Отмена', 1) end
if button == 1 and list == 1 then sampShowDialog(60012, 'Укажите цвет тихого чата', '', 'Выбрать', 'Отмена', 1) end
if button == 1 and list == 2 then sampShowDialog(60013, 'Укажите цвет крика', '', 'Выбрать', 'Отмена', 1) end
if button == 1 and list == 3 then sampShowDialog(60014, 'Укажите цвет отыгровок', '', 'Выбрать', 'Отмена', 1) end
if button == 1 and list == 4 then sampShowDialog(60015, 'Укажите цвет IC рации', '', 'Выбрать', 'Отмена', 1) end
if button == 1 and list == 5 then sampShowDialog(60016, 'Укажите цвет OOC рации', '', 'Выбрать', 'Отмена', 1) end
if button == 1 and list == 6 then sampShowDialog(60017, 'Укажите цвет префикса /d', '', 'Выбрать', 'Отмена', 1) end
if button == 1 and list == 7 then sampShowDialog(60018, 'Укажите цвет префикса /d!', '', 'Выбрать', 'Отмена', 1) end
if button == 1 and list == 8 then sampShowDialog(60019, 'Укажите цвет /d чата', '', 'Выбрать', 'Отмена', 1) end
if button == 1 and list == 9 then sampShowDialog(60020, 'Укажите цвет /d! чата', '', 'Выбрать', 'Отмена', 1) end
if button == 1 and list == 10 then sampShowDialog(60021, 'Укажите цвет шёпота', '', 'Выбрать', 'Отмена', 1) end
if button == 1 and list == 11 then Config.Settings.ColorStatus = not Config.Settings.ColorStatus ColorChanger() end
if button == 0 then MainMenu() end
end
local result, button, _, input = sampHasDialogRespond(60011)
if result then if button == 1 then Config.Settings.ColorChat = input end ColorChanger() end
if result then if button == 0 then ColorChanger() end end
local result, button, _, input = sampHasDialogRespond(60012)
if result then if button == 1 then Config.Settings.ColorChatLow = input end ColorChanger() end
if result then if button == 0 then ColorChanger() end end
local result, button, _, input = sampHasDialogRespond(60013)
if result then if button == 1 then Config.Settings.ColorShout = input end ColorChanger() end
if result then if button == 0 then ColorChanger() end end
local result, button, _, input = sampHasDialogRespond(60014)
if result then if button == 1 then Config.Settings.ColorRoleplay = input end ColorChanger() end
if result then if button == 0 then ColorChanger() end end
local result, button, _, input = sampHasDialogRespond(60015)
if result then if button == 1 then Config.Settings.ColorICRadio = input end ColorChanger() end
if result then if button == 0 then ColorChanger() end end
local result, button, _, input = sampHasDialogRespond(60016)
if result then if button == 1 then Config.Settings.ColorOOCRadio = input end ColorChanger() end
if result then if button == 0 then ColorChanger() end end
local result, button, _, input = sampHasDialogRespond(60017)
if result then if button == 1 then Config.Settings.ColorPrefixICDep = input end ColorChanger() end
if result then if button == 0 then ColorChanger() end end
local result, button, _, input = sampHasDialogRespond(60018)
if result then if button == 1 then Config.Settings.ColorPrefixOOCDep = input end ColorChanger() end
if result then if button == 0 then ColorChanger() end end
local result, button, _, input = sampHasDialogRespond(60019)
if result then if button == 1 then Config.Settings.ColorICDep = input end ColorChanger() end
if result then if button == 0 then ColorChanger() end end
local result, button, _, input = sampHasDialogRespond(60020)
if result then if button == 1 then Config.Settings.ColorOOCDep = input end ColorChanger() end
if result then if button == 0 then ColorChanger() end end
local result, button, _, input = sampHasDialogRespond(60021)
if result then if button == 1 then Config.Settings.ColorW = input end ColorChanger() end
if result then if button == 0 then ColorChanger() end end

local result, button, list, _ = sampHasDialogRespond(60200)
if result then
if button == 1 and list == 0 then Config.Settings.MDWanted = not Config.Settings.MDWanted MessageDisabler() end
if button == 1 and list == 1 then Config.Settings.MDChase = not Config.Settings.MDChase MessageDisabler() end
if button == 1 and list == 2 then Config.Settings.MDArrest = not Config.Settings.MDArrest MessageDisabler() end
if button == 1 and list == 3 then Config.Settings.MDCalls = not Config.Settings.MDCalls MessageDisabler() end
if button == 1 and list == 4 then Config.Settings.MDAirdrop = not Config.Settings.MDAirdrop MessageDisabler() end
if button == 1 and list == 5 then Config.Settings.MDAdvertisement = not Config.Settings.MDAdvertisement MessageDisabler() end
if button == 0 then MainMenu() end
end

local positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
local result, object = findAllRandomObjectsInSphere(positionX, positionY, positionZ, 150.0, true)
if result and doesObjectExist(object) then
local result, oX, oY, oZ = getObjectCoordinates(object)
local modelId = getObjectModel(object)
if modelId > 371 or modelId < 331 then
if Config.Settings.RemoveArmour == true then
if modelId == 19142 or modelId == 19515 then setObjectVisible(object, false) end
else
if modelId == 19142 or modelId == 19515 then setObjectVisible(object, true) end
end
end
end

if Config.Settings.DeleteTextdraw then
for a = 0, 2304 do
if sampTextdrawIsExists(a) then
if sampTextdrawGetString(a) == 'gta-trinity.ru' then sampTextdrawSetString(a, '') end
end
end
else
for a = 0, 2304 do
if sampTextdrawIsExists(a) then
if sampTextdrawGetString(a) == '' then sampTextdrawSetString(a, 'gta-trinity.ru') end
end
end
end
cfg.save(Config, 'TrinityCfg')
end
end

function MainMenu()
if Config.Settings.RemoveUnderlines then UnderlineStatus = '{33AA33}не отображаются{C4C4C4}.' else UnderlineStatus = '{FF0000}отображаются{C4C4C4}.' end
if Config.Settings.RemoveSystemMessages then SystemStatus = '{33AA33}не отображаются{C4C4C4}.' else SystemStatus = '{FF0000}отображаются{C4C4C4}.' end
if Config.Settings.RemoveArmour then ArmourStatus = '{33AA33}не отображаются{C4C4C4}.' else ArmourStatus = '{FF0000}отображаются{C4C4C4}.' end
if Config.Settings.DeleteTextdraw then TextdrawStatus = '{33AA33}не отображается{C4C4C4}.' else TextdrawStatus = '{FF0000}отображается{C4C4C4}.' end
MainMenuText = '{FFA07A}#1{FFFFFF} Изменение цвета чата.'..'\n{FFA07A}#2{FFFFFF} Отключение сообщений.'..'\n{FFA07A}#3{FFFFFF} Нижние подчёркивания '..UnderlineStatus..'\n{FFA07A}#4{FFFFFF} Системные отыгровки '..SystemStatus..'\n{FFA07A}#5{FFFFFF} Модели бронежилетов '..ArmourStatus..'\n{FFA07A}#6{FFFFFF} Надпись GTA-TRINITY.RU '..TextdrawStatus
sampShowDialog(60001, 'Твики для Trinity GTA', MainMenuText, 'Выбрать', 'Отмена', 4)
end

function ColorChanger()
if Config.Settings.ColorStatus then ColorStatus = '\t{33AA33}Включено\n' else ColorStatus = '\t{FF0000}Выключено\n' end
local ChangeSettingsText = 'Обычный чат\t{'..Config.Settings.ColorChat..'}#'..Config.Settings.ColorChat..'\nТихий чат\t{'..Config.Settings.ColorChatLow..'}#'..Config.Settings.ColorChatLow..'\nКрик\t{'..Config.Settings.ColorShout..'}#'..Config.Settings.ColorShout..'\nОтыгровки\t{'..Config.Settings.ColorRoleplay..'}#'..Config.Settings.ColorRoleplay..'\nIC рация\t{'..Config.Settings.ColorICRadio..'}#'..Config.Settings.ColorICRadio..'\nOOC рация\t{'..Config.Settings.ColorOOCRadio..'}#'..Config.Settings.ColorOOCRadio..'\nПрефикс IC рации департамента\t{'..Config.Settings.ColorPrefixICDep..'}#'..Config.Settings.ColorPrefixICDep..'\nПрефикс OOC рации департамента\t{'..Config.Settings.ColorPrefixOOCDep..'}#'..Config.Settings.ColorPrefixOOCDep..'\nIC рация департамента\t{'..Config.Settings.ColorICDep..'}#'..Config.Settings.ColorICDep..'\nOOC рация департамента\t{'..Config.Settings.ColorOOCDep..'}#'..Config.Settings.ColorOOCDep..'\nШёпот\t{'..Config.Settings.ColorW..'}#'..Config.Settings.ColorW..'\nЗамена цвета'..ColorStatus
sampShowDialog(60010, 'Изменение цвета чата', ChangeSettingsText, 'Выбрать', 'Отмена', 4)
end

function MessageDisabler()
local MDStatus = {}
if Config.Settings.MDWanted then MDStatus[1] = '\t{33AA33}Скрыто\n' else MDStatus[1] = '\t{FF0000}Показано\n' end
if Config.Settings.MDChase then MDStatus[2] = '\t{33AA33}Скрыто\n' else MDStatus[2] = '\t{FF0000}Показано\n' end
if Config.Settings.MDArrest then MDStatus[3] = '\t{33AA33}Скрыто\n' else MDStatus[3] = '\t{FF0000}Показано\n' end
if Config.Settings.MDCalls then MDStatus[4] = '\t{33AA33}Скрыто\n' else MDStatus[4] = '\t{FF0000}Показано\n' end
if Config.Settings.MDAirdrop then MDStatus[5] = '\t{33AA33}Скрыто\n' else MDStatus[5] = '\t{FF0000}Показано\n' end
if Config.Settings.MDAdvertisement then MDStatus[6] = '\t{33AA33}Скрыто\n' else MDStatus[6] = '\t{FF0000}Показано\n' end
MDText = 'Выдача и снятие розыска'..MDStatus[1]..'\nНачало преследований'..MDStatus[2]..'\nАресты и освобождения'..MDStatus[3]..'\nЗвонки в 911'..MDStatus[4]..'\nПерехваты грузов'..MDStatus[5]
MDText = MDText..'\nОбъявления на радио'..MDStatus[6]
sampShowDialog(60200, 'Отключение сообщений чата', MDText, 'Выбрать', 'Отмена', 4)
end

function samp.onServerMessage(color, text)
if Config.Settings.RemoveSystemMessages then
if color == -1029514497 and string.find(text, '* ', 1, 2) == nil and string.find(text, '! ', 1, 2) == nil then return false end
end

if Config.Settings.RemoveUnderlines then
for w in string.gmatch(text, '(%w+)_(%w+)') do
text = string.gsub(text, '_', ' ')
end
end

if Config.Settings.ColorStatus then
if color == 885597439 then text = '{'..Config.Settings.ColorChat..'}'..text end
if color == 597432063 then text = '{'..Config.Settings.ColorChatLow..'}'..text end
if color == 12582911 then text = '{'..Config.Settings.ColorShout..'}'..text text = string.gsub(text, '{00BFFF}', '{'..Config.Settings.ColorShout..'}') end
if color == -1029514497 then text = '{'..Config.Settings.ColorRoleplay..'}'..text end
if color == -1920073729 then text = '{'..Config.Settings.ColorICRadio..'}'..text end
if color == -1306385665 then text = '{'..Config.Settings.ColorPrefixICDep..'}'..text end
if color == -1844375041 then text = '{'..Config.Settings.ColorPrefixOOCDep..'}'..text end
if color == -1306385665 then text = string.gsub(text, '{FFE4B5}', '{'..Config.Settings.ColorICDep..'}') end
if color == -1844375041 then text = string.gsub(text, '{AA8070}', '{'..Config.Settings.ColorOOCDep..'}') end
if color == -1728079617 then text = '{'..Config.Settings.ColorW..'}'..text end
end

if Config.Settings.MDWanted then
if color == -8224001 and string.find(text, "W: ", 1, true) then return false end
end
if Config.Settings.MDChase then
if color == -12254977 and string.find(text, "HQ: Офицер ", 1, true) then return false end
if color == -12254977 and string.find(text, "HQ: Агент ", 1, true) then return false end
if color == -12254977 and string.find(text, "HQ: Подозреваемый ", 1, true) then return false end
if color == -12254977 and string.find(text, "HQ: Подозреваемая ", 1, true) then return false end
end
if Config.Settings.MDArrest then
if color == 1687547391 and string.find(text, "HQ: Офицер ", 1, true) then return false end
if color == 1687547391 and string.find(text, "HQ: Агент ", 1, true) then return false end
if color == 1687547391 and string.find(text, "HQ: Обвиняемый ", 1, true) then return false end
if color == 1687547391 and string.find(text, "HQ: Беглый преступник ", 1, true) then return false end
end
if Config.Settings.MDCalls then
if color == -12320513 and string.find(text, "Вызов 911:", 1, true) then return false end
end
if Config.Settings.MDAirdrop then
if color == 1687547391 and string.find(text, "HQ: По сообщению информаторов", 1, true) then return false end
end
if Config.Settings.MDAdvertisement then
if color == -290866945 and string.find(text, "[Реклама", 1, true) then return false end
if color == -290866945 and string.find(text, "[Гос. реклама", 1, true) then return false end
end
return {color, text}
end

function samp.onPlayerChatBubble(playerId, color, distance, duration , message)
if Config.Settings.ColorStatus then
if color == 885597439 then message = '{'..Config.Settings.ColorChat..'}'..message end
if color == 597432063 then message = '{'..Config.Settings.ColorChatLow..'}'..message end
if color == 12582911 then message = '{'..Config.Settings.ColorShout..'}'..message message = string.gsub(message, '{00BFFF}', '{'..Config.Settings.ColorShout..'}') end
if color == -1029514497 then message = '{'..Config.Settings.ColorRoleplay..'}'..message end
end
return {playerId, color, distance, duration , message}
end