• 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!

player broadcast talkaction request! rep+ for help

Dramix

New Member
Joined
Jun 26, 2009
Messages
289
Reaction score
1
Hello Otlanders! I need help with talkactions -"broadcast" script..


and you can't write > www, zapto, no-ip.org,. net,. com,. org and other sites in the broadcast.

here is my broadcast talkaction!
--- Config ---
local levelReq = 100 -- minimum level requirement
local minChars = 3 -- minimum characters in message
local basePrice = 500 -- Base price, will be multiplied by the player's level.
local group_id = 2 -- players with this group_id or higher won't be able to use this command
local exhaustionInSeconds = 60
local a = math.floor(exhaustionInSeconds/60)
local storage = 73210


function onSay(cid, words, param)
local letterPrice = basePrice + getPlayerLevel(cid) * 2
local broadcastPrice = letterPrice * param:len()
if(getPlayerLevel(cid) < levelReq) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Sorry, you need to be atleast level " .. levelReq .. " to use this command.")
elseif(exhaustion.check(cid, storage) == TRUE) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you need to wait before broadcasting another message.")
elseif(param:len() < minChars) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you need to enter atleast " .. minChars .. " characters. Each character will cost you " .. letterPrice .. " gold coins.")
elseif(getPlayerGroupId(cid) >= group_id) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, staff members do not need to broadcast messages with this command.")
elseif(doPlayerRemoveMoney(cid, broadcastPrice) == FALSE) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you have not enough money. This message would have costed you " .. broadcastPrice .. " gold coins.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Broadcast successfully sent. Your message contained " .. param:len() .. " characters and costed you " .. broadcastPrice .. " gold coins. You may broadcast again in " .. a .. " minute.")
broadcastMessage(getCreatureName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_STATUS_WARNING)
exhaustion.set(cid, storage, exhaustionInSeconds)
end
end
 
PHP:
--- Config ---
local levelReq = 100 -- player can broadcast at level
local basePrice = 1 -- Base price, will be multiplied by the player's level.(dont change it)
local exhaustionInSeconds = 60 -- exhusted to stop player broadcasting for 60 seconds (edit it if you want)
local a = math.floor(exhaustionInSeconds/60)
local storage = 73210


function onSay(cid, words, param)
local letterPrice = basePrice + getPlayerLevel(cid) * 1
local broadcastPrice = letterPrice * param:len()
if(getPlayerLevel(cid) < levelReq) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Sorry, you need to be atleast level " .. levelReq .. " to use this command.")
elseif(exhaustion.check(cid, storage) == TRUE) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you need to wait before broadcasting another message.")
elseif(doPlayerRemoveMoney(cid, broadcastPrice) == FALSE) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you have not enough money. This message would have costed you " .. broadcastPrice .. " gold coins.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Broadcast successfully sent. Your message contained " .. param:len() .. " characters and costed you " .. broadcastPrice .. " gold coins. You may broadcast again in " .. a .. " minute.")
broadcastMessage(getCreatureName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_STATUS_WARNING)
exhaustion.set(cid, storage, exhaustionInSeconds)
end
end
 
Lua:
--- Config ---
local levelReq = 100 -- minimum level requirement
local minChars = 3 -- minimum characters in message
local basePrice = 500 -- Base price, will be multiplied by the player's level.
local group_id = 2 -- players with this group_id or higher won't be able to use this command
local exhaustionInSeconds = 60
local a = math.floor(exhaustionInSeconds/60)
local storage = 73210
local words = {'.net','.com','.org','www.','zapto','.zapto','no-','-ip'}

function onSay(cid, words, param)
local letterPrice = basePrice + getPlayerLevel(cid) * 2
local broadcastPrice = letterPrice * param:len()
if(getPlayerLevel(cid) < levelReq) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Sorry, you need to be atleast level " .. levelReq .. " to use this command.")
elseif(exhaustion.check(cid, storage) == TRUE) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you need to wait before broadcasting another message.")
elseif(param:len() < minChars) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you need to enter atleast " .. minChars .. " characters. Each character will cost you " .. letterPrice .. " gold coins.")
elseif(getPlayerGroupId(cid) >= group_id) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, staff members do not need to broadcast messages with this command.")
elseif(doPlayerRemoveMoney(cid, broadcastPrice) == FALSE) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you have not enough money. This message would have costed you " .. broadcastPrice .. " gold coins.")
else
for i = 1, #words do
	local check = string.find('param', words[i])
	if check ~= nil then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your message contains blocked letters.")
	end
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Broadcast successfully sent. Your message contained " .. param:len() .. " characters and costed you " .. broadcastPrice .. " gold coins. You may broadcast again in " .. a .. " minute.")
broadcastMessage(getCreatureName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_STATUS_WARNING)
exhaustion.set(cid, storage, exhaustionInSeconds)
end
end
I guess it won't work right off the bat, but try it and report the errors please.

here are the errors:

[13/02/2012 17:56:28] [Error - TalkAction Interface]
[13/02/2012 17:56:28] data/talkactions/scripts/broadcaster.lua:eek:nSay
[13/02/2012 17:56:28] Description:
[13/02/2012 17:56:28] data/talkactions/scripts/broadcaster.lua:26: bad argument #2 to 'find' (string expected, got nil)
[13/02/2012 17:56:28] stack traceback:
[13/02/2012 17:56:28] [C]: in function 'find'
[13/02/2012 17:56:28] data/talkactions/scripts/broadcaster.lua:26: in function <data/talkactions/scripts/broadcaster.lua:11>
 
try this didnt test
Code:
--- Config ---
local levelReq = 100 -- minimum level requirement
local basePrice = 1 -- Base price, will be multiplied by the player's level.
local blocked = {'.net','.com','.org','www.','zapto','.zapto','no-','-ip'}
local exhaustionInSeconds = 1
local a = math.floor(exhaustionInSeconds/1)
local storage = 73210


function onSay(cid, words, param)
	local letterPrice = basePrice + getPlayerLevel(cid) * 1
	local broadcastPrice = letterPrice * param:len()
	if(getPlayerLevel(cid) < levelReq) then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Sorry, you need to be atleast level " .. levelReq .. " to use this command.")
	elseif(exhaustion.check(cid, storage) == TRUE) then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you need to wait before broadcasting another message.")
	elseif(doPlayerRemoveMoney(cid, broadcastPrice) == FALSE) then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you have not enough money. This message would have costed you " .. broadcastPrice .. " gold coins.")
	else
	for i = 1, #blocked do
	local check = string.find(string.lower(param), blocked[i])
	if check ~= nil then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your message contains blocked letters.")
	end
end
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Broadcast successfully sent. Your message contained " .. param:len() .. " characters and costed you " .. broadcastPrice .. " gold coins. You may broadcast again in " .. a .. " minute.")
		broadcastMessage(getCreatureName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_STATUS_WARNING)
		exhaustion.set(cid, storage, exhaustionInSeconds)
	end
end
XML:
<talkaction words="!b" event="script" value="playerbroadcast.lua"/>
 
Last edited:
Last edited by Blorin Mage; Today at 02:50.

Hope you're happy with stealing the work from others, editing your scripts to match the working ones and hunt for whatever attention it is you want.
Just drop dead dude, that's more than sad, it's pitifull...

*Removed working script due to attention hunter ^ *
 
Last edited:
Back
Top