• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Request] Broadcast item...

Status
Not open for further replies.

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
I want one item that the player speaks on broadcast, comand typed on default !broadcast Msg here ... need have censure ... to avoid the noobs advertising ot ... i wanted to censure example:
!broadcast go to youtube now .***
it did not let him talk .com, net, org, etc, so avoid hack/advertise etcs
and it can only be used 100x ... after using the 100x item ENDS!

And it shows the Default Channel
"You can still use the broadcast item by: 90x
"

Thx​
 
Last edited:
aaah, he means the item has charges.. he can use it 100x then it is removed and the player says !broadcast "msg"
to make it work...
it's probably

if getPlayerItemCount(cid, xxxx) == TRUE then
doPlayerBroadcastMessage(cid, "its something like that..")
 
aaah, he means the item has charges.. he can use it 100x then it is removed and the player says !broadcast "msg"
to make it work...
it's probably

if getPlayerItemCount(cid, xxxx) == TRUE then
doPlayerBroadcastMessage(cid, "its something like that..")

I think he wants links to be censored?
 
mod
~message characters limit
~blacklist word forbid, you can add more
~60 seconds exhaustion for command
~charges can be seen clicking on item after first usage
XML:
<?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>
remember to change itemid 6577 to the one you want
 
I tested it on my rev 3953 and it worked perfect, perhaps you are doing smth wrong, maybe the item's itemid?
 
Status
Not open for further replies.
Back
Top