/ann to players in channels only #14

Closed
opened 2014-05-04 10:38:29 -06:00 by RElesgoe · 4 comments
RElesgoe commented 2014-05-04 10:38:29 -06:00 (Migrated from github.com)

Many players complain that they get spammed with announcements while they're playing a game.

Many players complain that they get spammed with announcements while they're playing a game.
HarpyWar commented 2014-05-04 11:45:22 -06:00 (Migrated from github.com)

I think, this is not bad. Announce should be public for all connected users.
It will be better to make a new command /msgbox text to send a message box to all users in channels only, including red announce message (who closed the message or wants read it again).

I will add feature to send announce in channels as a function in Lua example scripts.

I think, this is not bad. Announce should be public for all connected users. It will be better to make a new command `/msgbox text` to send a message box to all users in channels only, including red announce message (who closed the message or wants read it again). I will add feature to send announce in channels as a function in Lua example scripts.
HarpyWar commented 2014-05-04 11:56:23 -06:00 (Migrated from github.com)

Btw, if admins abuse with announce then it is access rights issue.

Btw, if admins abuse with announce then it is access rights issue.
RElesgoe commented 2014-05-05 21:23:35 -06:00 (Migrated from github.com)

#15

#15
HarpyWar commented 2014-05-26 20:51:40 -06:00 (Migrated from github.com)

Now it is easy to override existing commands in a Lua script. To do this, create a new function with return 1 and add it into the table lua_command_table in handle_command.lua.

I will add this code as an example in documentation on a new site.

function command_announce(account, text)
    args = split_command(text, 1)
    if not args[1] then
        api.describe_command(account.name, args[0])
        return 1
    end
    -- iterate online users
    for i,account_dest in pairs(api.server_get_users()) do
        -- if user is in channel
        if account_dest.channel_id then
            -- send message
            api.message_send_text(account_dest.name, message_type_broadcast, nil, args[1])
            -- show messagebox
            api.messagebox_show(account_dest.name, args[1], "Announce from " .. account.name, MB_OK)
        end
    end
    -- override /announce
    return 1
end
Now it is easy to override existing commands in a Lua script. To do this, create a new function with `return 1` and add it into the table `lua_command_table` in `handle_command.lua`. I will add this code as an example in documentation on a new site. ``` lua function command_announce(account, text) args = split_command(text, 1) if not args[1] then api.describe_command(account.name, args[0]) return 1 end -- iterate online users for i,account_dest in pairs(api.server_get_users()) do -- if user is in channel if account_dest.channel_id then -- send message api.message_send_text(account_dest.name, message_type_broadcast, nil, args[1]) -- show messagebox api.messagebox_show(account_dest.name, args[1], "Announce from " .. account.name, MB_OK) end end -- override /announce return 1 end ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Techwizz/pvpgn-server#14
No description provided.