<?xml version="1.0" encoding="UTF-8"?>
<mod name="broadcast" author="C" enabled="yes" web="otland.net">
<config name="setup">
<![CDATA[
Bstorage = 16784
--> BLACKLIST WORDS <--
list = { --lowercase only
'dot','.com','.net','servegame','hopto','ip','no-ip','.org','whore','slut','fuck',
'mother','fucker','hopto','ass','cock','pussy',
}
exhaustionStorage = 16785
exhaustionTime = 60 --in seconds
char = 100 --chars limit in the message
]]>
</config>
<event type="login" name="broad" event="script">
<![CDATA[
domodlib('setup')
function onLogin(cid)
doCreatureSetStorage(cid, Bstorage, 0)
return true
end
]]>
</event>
<action itemid="6577" event="script">
<![CDATA[
domodlib('setup')
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getCreatureStorage(cid, Bstorage) > 0 then
doPlayerSendCancel(cid, 'Use !broadcast command to broadcast a message.')
return true
end
if getItemAttribute(item.uid, 'charges') == nil then
doItemSetAttribute(item.uid, 'charges', 100)
end
if getItemAttribute(item.uid, 'charges') == 1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Now use !broadcast command to broadcast a message, this item disappears...')
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doCreatureSetStorage(cid, Bstorage, 1)
doRemoveItem(item.uid, 1)
else
doCreatureSetStorage(cid, Bstorage, 1)
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doItemSetAttribute(item.uid, 'charges', getItemAttribute(item.uid, 'charges')-1)
doItemSetAttribute(item.uid, 'description', 'This item has '.. getItemAttribute(item.uid, 'charges') ..' charges left.')
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Now use !broadcast command to broadcast a message, this item has '.. getItemAttribute(item.uid, 'charges') ..' charges left.')
end
return true
end
]]>
</action>
<talkaction words="!broadcast" event="script">
<![CDATA[
domodlib('setup')
function onSay(cid, words, param, channel)
if getCreatureStorage(cid, Bstorage) < 1 then
doPlayerSendCancel(cid, 'You must use the broadcast item in order to be able to broadcast.')
return true
end
if param == '' then
doPlayerSendCancel(cid, 'Command requires a message.')
return true
end
if exhaustion.check(cid, exhaustionStorage) then
doPlayerSendCancel(cid, 'You can not use this command yet['..exhaustion.get(cid, exhaustionStorage)..'].')
return true
else
exhaustion.set(cid, exhaustionStorage, exhaustionTime)
end
local forbid, param2 = false, param:lower()
for i = 1, #list do
if string.find(param2, list[i]) ~= nil then
forbid = true
break
end
end
if forbid then
doCreatureSetStorage(cid, Bstorage, 0)
doPlayerSendCancel(cid, 'Your message contains a forbidden word.')
return true
end
if string.len(param) >= char then
doPlayerSendCancel(cid, 'Your message is too long.')
return true
end
doPlayerBroadcastMessage(cid, param)
doCreatureSetStorage(cid, Bstorage, 0)
return true
end
]]>
</talkaction>
</mod>