• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua [0.3.6] Player Broadcast Script

Samaster

Raptorserver.ddns.net
Joined
Jun 9, 2013
Messages
291
Reaction score
23
Location
UK
How can I change my player broadcasting script so it is broadcasted in the default chat and the message appears white?

Here is my script:
Code:
--- Config ---
local levelReq = 500 -- Level needed to use the command.
local minChars = 3 -- How many characters may you write as minumum?
local basePrice = 100 -- Base price, will be multiplied by the players level.
local group_id = 2 -- Group to not use the script.

--- Exhaust Settings ---
local useExhaust = TRUE -- FALSE = Broadcast as fast as they want.
local storageValue = 1235 -- Storage for Exhaust to work.
local exhaustTime = 5 -- Minutes.
--- End config ---

function onSay(cid, words, param)
local letterPrice = basePrice + getPlayerLevel(cid) * 2
local broadcastPrice = letterPrice * string.len(param)
if getPlayerLevel(cid) < levelReq then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Sorry, you need level " .. levelReq .. " to use this command.")
return TRUE
end
if (useExhaust == TRUE) and getPlayerStorageValue(cid, storageValue) == 1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you need to wait before broadcasting another message.")
return TRUE
end
if string.len(param) < minChars then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you need to enter atleast " .. minChars .. " characters.")
return TRUE
end
if getPlayerGroupId(cid) > group_id then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, staff members do not need to broadcast messages with this command.")
return TRUE
end
if doPlayerRemoveMoney(cid, broadcastPrice) == FALSE then
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 cost you " .. broadcastPrice .. " gold")
broadcastMessage(getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_STATUS_WARNING)
setPlayerStorageValue(cid, storageValue, 1)
addEvent(endExhaust, exhaustTime * 60000, cid)
end
end

function endExhaust(cid)
if (useExhaust == TRUE) then
setPlayerStorageValue(cid, storageValue, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You may now broadcast another message.")
end
end
 
Code:
broadcastMessage(getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_STATUS_WARNING)
This line is what determines how the broadcast will do everything.
Message_status_warning = red text
MESSAGE_STATUS_DEFAULT = white.. you can check 000_constant for more.
Change it to this.. and should work.
Code:
broadcastMessage(getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_STATUS_DEFAULT)
 
Code:
broadcastMessage(getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_STATUS_WARNING)
This line is what determines how the broadcast will do everything.
Message_status_warning = red text
MESSAGE_STATUS_DEFAULT = white.. you can check 000_constant for more.
Change it to this.. and should work.
Code:
broadcastMessage(getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_STATUS_DEFAULT)

Yeah that changes the text to white xD TY
But do you know how send it through the default tab and not server log?
 
Hmmm... well we could possibly try working with this..
Code:
doPlayerSendChannelMessage(getPlayerName(cid), message, MessageClasses, channel)
I'm not sure to be honest.
@Limos :P
 
You can't use all message types in all channels, it's a client limit.
The white messages (used in doPlayerSendTextMessage) appear in the Server Log (or as cancel message at the bottom of the screen), it's also possible to send white messages in other channels (doPlayerSendChannelMessage with TALKTYPE_CHANNEL_W), in default you can use orange or blue ones.
 
You can't use all message types in all channels, it's a client limit.
The white messages (used in doPlayerSendTextMessage) appear in the Server Log (or as cancel message at the bottom of the screen), it's also possible to send white messages in other channels (doPlayerSendChannelMessage with TALKTYPE_CHANNEL_W), in default you can use orange or blue ones.

I got it xD
Thank you
 
Back
Top