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