function doPlayerBroadcastMessage(cid, text, class, checkFlag, ghost)
local checkFlag, ghost, class = checkFlag or true, ghost or false, class or TALKTYPE_BROADCAST
if(checkFlag and not getPlayerFlagValue(cid, PLAYERFLAG_CANBROADCAST)) then
return false
end
if(type(class) == 'string') then
local className = TALKTYPE_TYPES[class]
if(className == nil) then
return false
end
class = className
elseif(class < TALKTYPE_FIRST or class > TALKTYPE_LAST) then
return false
end
local players = getPlayersOnline()
for _, pid in ipairs(players) do
doCreatureSay(cid, text, class, ghost, pid)
end
print("> " .. getCreatureName(cid) .. " broadcasted message: \"" .. text .. "\".")
return true
end