-- Script 100% by Colandus
local levelReq = 150 -- Level needed to use the command.
local minChars = 5 -- How many characters may you write as minumum?
local basePrice = 1000 -- Base price, will be added to the price made by a formula in the script.
-- Exhaustion Settings
local useExhaust = true
local storageValue = 3435
local exhaustTime = 1 * 60 -- 1 minute
--[[ Example:
You are level 100 and you are going to write a sentence of 45 characters with base price 1000.
1000 + (100 * 2) =
1000 + 200 = 1200
1500 * 45 = 54000
The message of 45 characters, broadcasted by a level 100 with the base price as 1000 would cost the player 54000 gold (54k),.
]]--
function onSay(cid, words, param)...
-- Script 100% by Colandus
local levelReq = 150 -- Level needed to use the command.
local minChars = 5 -- How many characters may you write as minumum?
local basePrice = 1000 -- Base price, will be added to the price made by a formula in the script.
-- Exhaustion Settings
local useExhaust = true
local storageValue = 3435
local exhaustTime = 1 * 60 -- 1 minute
--[[ Example:
You are level 100 and you are going to write a sentence of 45 characters with base price 1000.
1000 + (100 * 2) =
1000 + 200 = 1200
1500 * 45 = 54000
The message of 45 characters, broadcasted by a level 100 with the base price as 1000 would cost the player 54000 gold (54k),.
]]--
function onSay(cid, words, param)
local letterPrice = basePrice + getPlayerLevel(cid) * 2
local broadcastPrice = letterPrice * param:len()
if getPlayerLevel(cid) < levelReq then
doPlayerSendCancel(cid,"Sorry, you need to be atleast level " .. levelReq .. " to use this command.")
elseif (useExhaust and isExhausted(cid, storageValue, exhaustTime) == TRUE) then
doPlayerSendCancel(cid, "Sorry, you need to wait before broadcasting another message.")
elseif param:len() < minChars then
doPlayerSendCancel(cid,"Sorry, you need to enter atleast " .. minChars .. " characters. Each character will cost you " .. letterPrice .. " gold coins.")
elseif doPlayerRemoveMoney(cid, broadcastPrice) == FALSE then
doPlayerSendCancel(cid, "Sorry, you have not enough money. This message would have costed you " .. broadcastPrice .. " gold coins.")
else
doPlayerSendTextMessage(cid, 24, "Broadcast successfully sent. Your message contained " .. string.len(param) .. " characters and costed you " .. broadcastPrice .. " gold coins.")
broadcastMessage(getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_STATUS_WARNING)
doPlayerSendTextMessage(cid, 25, "!broadcast \"" .. param)
setExhaust(cid, storageValue)
end
end
function setExhaust(cid, storage)
setPlayerStorageValue(cid, storage, os.time())
end
function isExhausted(cid, storage, exhaust)
local exhaustTime = getPlayerStorageValue(cid, storage)
if exhaustTime == -1 then
return FALSE
end
local isExhausted = os.time() - exhaustTime < exhaust
return isExhausted and TRUE or FALSE
end
You didn't add the last piece of code to global.lua as he showed you in the post above.10/02/2017 05:35:14] [Error - TalkAction Interface]
[10/02/2017 05:35:14] data/talkactions/scripts/broadcast22.luanSay
[10/02/2017 05:35:14] Description:
[10/02/2017 05:35:14] data/talkactions/scripts/broadcast22.lua:24: attempt to call global 'isExhausted' (a nil value)
[10/02/2017 05:35:14] stack traceback:
[10/02/2017 05:35:14] data/talkactions/scripts/broadcast22.lua:24: in function <data/talkactions/scripts/broadcast22.lua:19>
You didn't add the last piece of code to global.lua as he showed you in the post above.
Did you restart the server?yeah, i did gives me the error
Did you restart the server?
You can't do that. Broadcast will always be sent both in screen and in default channel.Yeah thanks, i just closed it and restarted it. Works Perfect! Hey how can i make it so it doesn't appear default channel where everyone can see it just on pop up bc