• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Player Broadcast

Status
Not open for further replies.
I tested it on TFS 0.3.4
 
No Problem, glad you like it.
 
Bump :thumbup:
 
Code:
--- Config ---
local levelReq = 100 -- minimum level requirement
local minChars = 3 -- minimum characters in message
local basePrice = 50 -- 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

--- Exhaust Settings ---
local useExhaust = true -- false = Broadcast as often as you want.
local storageValue = 1235 -- storage key for exhaust system
local exhaustTime = 1 -- in minutes
--- End config ---

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(useExhaust and (os.time() - getPlayerStorageValue(cid, storageValue)) >= exhaustTime * 60) 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.")
		broadcastMessage(getCreatureName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_STATUS_WARNING)
		setPlayerStorageValue(cid, storageValue, os.time())
	end
end
:D :eek: without addEvent
 
Cykotitan, thanks for trying to fix my scripts, but this was made long ago...
I am actually surprised that it's still here. :wub:
 
Status
Not open for further replies.
Back
Top