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

TFS 1.X+ Broadcast message is not workiing

johnsamir

Active Member
Joined
Oct 13, 2009
Messages
232
Solutions
1
Reaction score
35
Location
Nowhere
Hello I'm using nekiro tfs 1.3 and brodcast message is not working.My account gm is type 5 and the player has group id 3, others commands like give level works, but brodcast doesn't, the message does not appears at all in default channel nor in the game window either. i have tested with otcv8, mehah otclient, and edubart otclient in none on them is being displayed the message and i don't have errors in console when using it
this is the function
Lua:
function onSay(player, words, param)
    if not player:hasFlag(PlayerFlag_CanBroadcast) then
        return true
    end

    print("> " .. player:getName() .. " broadcasted: \"" .. param .. "\".")
    for _, targetPlayer in ipairs(Game.getPlayers()) do
        targetPlayer:sendPrivateMessage(player, param, TALKTYPE_BROADCAST)
    end
    return false
end
 
Solution
Normal (red) broadcast message:

Lua:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    print("> " .. player:getName() .. " broadcasted: \"" .. param .. "\".")
    for _, targetPlayer in ipairs(Game.getPlayers()) do
        targetPlayer:sendPrivateMessage(player, param, TALKTYPE_BROADCAST)
    end
    return false
end

White broadcast text without name showing:

Lua:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    print("> " ...

Loney

🇲🇽
Senator
Premium User
Joined
Jul 23, 2012
Messages
1,975
Solutions
20
Reaction score
194
Location
MX
Normal (red) broadcast message:

Lua:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    print("> " .. player:getName() .. " broadcasted: \"" .. param .. "\".")
    for _, targetPlayer in ipairs(Game.getPlayers()) do
        targetPlayer:sendPrivateMessage(player, param, TALKTYPE_BROADCAST)
    end
    return false
end

White broadcast text without name showing:

Lua:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    print("> " .. player:getName() .. " broadcasted: \"" .. param .. "\".")
    for _, targetPlayer in ipairs(Game.getPlayers()) do
        targetPlayer:sendTextMessage(MESSAGE_EVENT_ADVANCE, param)
    end
    return false
end
 
Solution

Loney

🇲🇽
Senator
Premium User
Joined
Jul 23, 2012
Messages
1,975
Solutions
20
Reaction score
194
Location
MX
working as inteded.what's happened. Why the original code it was screwed up, in the main repo?
Could be something with flags. Original script checks player flags while second one just checks if player is God.
 
Top