Wysłany: 2016-09-06, 19:21
pawelos2455
Wiek: 31 Na forum: 4841 dni Posty: 5
Witam. Ot?? mam taki problem, i? na moim serwerze MTA (host pukawka) wyst?pi? podw?jny czat. Mam skrypt kt?rym chce zast?pi? czat ale co? nie dzia?a i czat wy?wietla si? w obydw?ch formach. Prosz? o pomoc P.S. Sry je?eli w z?ym dziale, jestem tu nowy.
A no i wy??czy?em ten skrypt w Freeroam, bo wtedy czat wy?wietla? si? nawet potr?jnie.
Ostatnio zmieniony przez pawelos2455 2016-09-06, 19:37, w całości zmieniany 1 raz
Wysłany: 2016-09-06, 19:42
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Jaki? inny skrypt musi posiada? event kt?ry si? wykonuje i tam i w tym twoim skrypcie.
Wysłany: 2016-09-06, 20:09
pawelos2455
Wiek: 31 Na forum: 4841 dni Posty: 5
M?j skrypt wygl?da tak : Kod:
-- DISCLAIMER
--[[
Any user of this resource is allowed to modify the code for personal use, and are not allowed to share their own version with people. Do not attempt to resell this resource as it is avaiblable for FREE. Anyone caught breaking the disclamer will find themselves in trouble with the law under the Copyright Act 2008. You may use / edit only for PERSONAL USE. This code is copyrighted to Christopher Graham Smith (Urangan, Queensland, AUS).
]]
-- Settings - These settings will change the scripts functions and allow you to disable certain parts.
settings = {
['enableTeamChat'] = true,
['adminTag'] = {
['enabled'] = true,
['ACL'] = { -- A bit more advanced.
{ 'Admin', '#0C0CFF[POLICJA k****] ' },
{ 'SuperModerator', '#F200FF[Administrator] ' },
{ 'Moderator', '#A1FF9C[Moderator] ' },
{ 'donator2', '#A1FF9C[$$_Donator_$$] ' },
{ 'Everyone', '#FFEA00[Gracz] ' },
}
},
['swearFilter'] = {
['enabled'] = false,
['swearCost'] = 0,
['swears'] = { -- Allows you to set the blocked swear words, syntax is ['WORD'] = 'REPLACEMENT'
['asshole'] = '*******',
['fuck'] = '****',
['slut'] = '****',
['bitch'] = '*****',
['cunt'] = '****',
['whore'] = '*****',
['pussy'] = '*****',
['fag'] = '***',
['perro'] = '*****',
['puta'] = '****',
['joder'] = '*****'
}
},
['antiSpamFilter'] = {
['enabled'] = true,
['execeptionGroups'] = 'Admin', -- Groups which can spam, eg. 'Admin,SuperModerator,Moderator'
['chatTimeOut'] = 1 -- Set in seconds.
},
['freezeChat'] = {
['enabled'] = true,
['command'] = 'freezechat', -- Command to use when activating frozen chat.
['allowedGroups'] = 'Admin,SuperModerator', -- Groups which have access to this command.
['resetTime'] = 5 -- Time in minutes before it automatically resets.
},
['clearChat'] = {
['enabled'] = false,
['command'] = 'clearchat',
['allowedGroups'] = 'Admin,SuperModerator'
}
}
-- Required variables
spam = { }
stopChat = false
function chatbox(message, msgtype)
if stopChat then cancelEvent() outputChatBox('#FF0000[FREEZECHAT] #FFFFFFAn Administrator w?a?nie zatrzyma? czat!', source, 255, 255, 255, true) return end
local account = getAccountName(getPlayerAccount(source))
local name = getPlayerName(source)
local serial = getPlayerSerial(source)
local r, g, b = getPlayerNametagColor(source)
local text = message:gsub("%a", string.upper, 1)
local check = 0
local spamCheck = false
if settings['swearFilter']['enabled'] then
for i, v in pairs(settings['swearFilter']['swears']) do
while text:lower():find(i:lower(),1,true) do
local start, end_ = text:lower():find(i:lower(),1,true)
local found = text:sub(start,end_)
text = text:gsub(found,v)
if settings['swearFilter']['swearCost'] ~= 0 then
takePlayerMoney(source, settings['swearFilter']['swearCost'])
end
end
end
end
if msgtype == 0 then
cancelEvent()
if not settings['adminTag']['enabled'] and not spam[serial] then
message = RGBToHex(r, g, b) .. name .. ':#FFFFFF ' .. text
if 128 <= #message then
outputChatBox('#FF0000Error: Wiadomo?? kt?r? napisa?e? jest za d?uga! Prosz? skr?? j?! ', source, 255, 255, 255, true)
else
outputChatBox(message, getRootElement(), 255, 255, 255, true)
aclgroup = split(settings['antiSpamFilter']['execeptionGroups'], ', ') or settings['antiSpamFilter']['execeptionGroups']
for i, v in ipairs(aclgroup) do if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup(v)) then spamCheck = true end end
if not spamCheck then
if settings['antiSpamFilter']['enabled'] then
spam[serial] = true
setTimer(function()
spam[serial] = false
end, settings['antiSpamFilter']['chatTimeOut']*1000, 1)
end
end
outputServerLog('CHAT: ' .. name .. ': ' .. text)
end
return
end
for _,v in ipairs(settings['adminTag']['ACL']) do
if isObjectInACLGroup('user.' .. account, aclGetGroup(v[1])) and check == 0 and not spam[serial] then
local message = v[2] .. RGBToHex(r, g, b) .. name .. ":#FFFFFF " .. text
if 128 <= #message then
outputChatBox('#FF0000Error: Wiadomo?? kt?r? napisa?e? jest za d?uga! Prosz? skr?? j?! ', source, 255, 255, 255, true)
check = 1
else
check = 1
outputChatBox(message, getRootElement(), 255, 255, 255, true)
if settings['antiSpamFilter']['enabled'] then
aclgroup = split(settings['antiSpamFilter']['execeptionGroups'], ', ') or settings['antiSpamFilter']['execeptionGroups']
for i, v in ipairs(aclgroup) do if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup(v)) then spamCheck = true end end
if not spamCheck then
spam[serial] = true
check = 1
setTimer(function()
spam[serial] = false
end, settings['antiSpamFilter']['chatTimeOut']*1000, 1)
end
end
outputServerLog('CHAT: '.. v[2] .. name .. ': ' .. text)
end
elseif spam[serial] and check == 0 then
outputChatBox('#FF0000Error: Prosz? poczekaj '..settings['antiSpamFilter']['chatTimeOut']..' sekund zanim wy?lesz kolejn? wiadomo??!', source, 255, 255, 255, true)
check = 1
end
end
elseif msgtype == 1 and not settings['enableTeamChat'] then
cancelEvent()
end
end
addEventHandler("onPlayerChat", getRootElement(), chatbox)
addEventHandler("onPlayerQuit", getRootElement(),
function()
local serial = getPlayerName(source)
spam[serial] = false
end )
-- Freeze chat
addCommandHandler(settings['freezeChat']['command'],
function(player)
if not settings['freezeChat']['enabled'] then return end
aclgroup = split(settings['freezeChat']['allowedGroups'], ', ') or settings['freezeChat']['allowedGroups']
for i, v in ipairs(aclgroup) do if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup(v)) then check = true end end
if not check then return end
if not stopChat then
outputChatBox('#FF0000[FREEZECHAT] #FFFFFF'..getPlayerName(player)..' has frozen the chat!', getRootElement(), 255, 255, 255, true)
stopChat = true
frozenTimer = setTimer(function() stopChat = false end, (settings['freezeChat']['resetTime'] * 60000), 1)
else
outputChatBox('#FF0000[FREEZECHAT] #FFFFFF'..getPlayerName(player)..' has unfrozen the chat!', getRootElement(), 255, 255, 255, true)
stopChat = false
end
end
)
-- Clear chat
addCommandHandler(settings['clearChat']['command'],
function(player)
if not settings['clearChat']['enabled'] then return end
aclgroup = split(settings['clearChat']['allowedGroups'], ',') or settings['clearChat']['allowedGroups']
for i, v in ipairs(aclgroup) do if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup(v)) then check = true end end
if not check then return end
for i = 2, getElementData(player, 'chatLines') do
outputChatBox(' ')
end
outputChatBox('#FF0000[CLEARCHAT]#FFFFFF '..getPlayerName(player)..' has cleared the chat', getRootElement(), 255, 255, 255, true)
end
)
function RGBToHex(red, green, blue, alpha)
return string.format("#%.2X%.2X%.2X", red,green,blue)
end
[ Komentarz dodany przez: Emm : 2016-09-06, 20:10 ]
Stosuj znaczniki lua/code
Ostatnio zmieniony przez Emm 2016-09-06, 20:09, w całości zmieniany 1 raz
Wysłany: 2016-09-06, 20:49
pawelos2455
Wiek: 31 Na forum: 4841 dni Posty: 5
Ale freeroam ma zosta?, ma by? freeroam i ten skrypt.
Wysłany: 2016-09-06, 21:00
GabWas
Wiek: 24 Na forum: 3881 dni Posty: 289
Nick w MP: GabWas
Piwa : 65
Nie freeroam odpowiada za czat, tylko play. Wpisz "stop play" w konsoli albo na serwerze i powinno przesta? dublowa? wiadomo?ci.
Wysłany: 2016-09-06, 22:09
Brzysiek
Skrypter pralek
Wiek: 27 Na forum: 5198 dni Posty: 488
Nick w MP: Brzysiek
Piwa : 1034
Freeroam ma wbudowany czat. Je?li u?yjesz innego skryptu na czat to b?d? si? nak?ada?. Musisz sam zmodyfikowa? jeden z nich
Cytat:
Nie freeroam odpowiada za czat, tylko play. Wpisz "stop play" w konsoli albo na serwerze i powinno przesta? dublowa? wiadomo?ci.
No niekoniecznie. W meta.xml gamemode'a play jest magiczna linijka:
<include resource = "freeroam" />
Wysłany: 2016-09-09, 19:56
pawelos2455
Wiek: 31 Na forum: 4841 dni Posty: 5
Ale i freeroam i play ma zosta? Chyba ze macie jaki? skrypt Freeroamo-podobny.
Wysłany: 2016-09-09, 20:33
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
W folderze gamemodes->freeroam otw?rz plik fr_server.lua znajdz w nim "onPlayerChat" i usu?. Nie usuwaj ca?ej linijki tylko "" aby by?o addEventHandler ( "" , g_Root ) czy jak tam jest poprostu usu? sam wyraz "onPlayerChat" zapisz i zrestartuj freeroam.
Ostatnio zmieniony przez _Wicek_ 2016-09-09, 20:46, w całości zmieniany 1 raz
Wysłany: 2016-09-09, 20:46
pawelos2455
Wiek: 31 Na forum: 4841 dni Posty: 5
Tyle ze to usunalem wcze?niej i w tym jest wlasnie problem A nie wiesz mo?e czy w tym skrypcie wy?ej napisanym nie da rady czego? zrobi??
Wysłany: 2016-09-09, 20:58
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Musisz mie? jaki? inny skrypt kt?ry to powoduje. To nie wina freeroamu. Co do pytania nieda si? bo je?li usuniesz event to nie bedziesz mial oczekiwanego efektu.
Tagi: czat
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: