-- 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 multiplied with 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 * 5) =
1000 + 500 = 1500
1500 * 45 = 67500
The message of 45 characters, broadcasted by a level 100 with the base price as 1000 would cost the player 67500 gold (67.5k),.
]]--
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
So you still waiting
I found script Talkaction made by Colandus
Code:-- 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 multiplied with 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 * 5) = 1000 + 500 = 1500 1500 * 45 = 67500 The message of 45 characters, broadcasted by a level 100 with the base price as 1000 would cost the player 67500 gold (67.5k),. ]]-- 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
Including these functions:
Code: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
To use it, just write !broadcast "message.
14:57 Test [155]: !broadcast "Testing
14:57 Test [155]: "Testing
14:59 Test [155]: !broadcast Testing
14:59 Test [155]: Testing
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/paybroadcast.lua:onSay
data/talkactions/scripts/paybroadcast.lua:24 attempt to call global 'isExhausted' <a nil value>
stack traceback:
data talkactions/scripts/paybroadcast.lua:24: in function <data/talkactions/scripts/paybroadcast.lua:19>