| 1 | --[[ |
| 2 | Copyright (C) 2014 HarpyWar ([email protected]) |
| 3 | |
| 4 | This file is a part of the PvPGN Project http://pvpgn.pro |
| 5 | Licensed under the same terms as Lua itself. |
| 6 | ]]-- |
| 7 | |
| 8 | |
| 9 | -- |
| 10 | -- Read file w3motd.txt line by line and send text to user |
| 11 | -- |
| 12 | |
| 13 | local username = nil |
| 14 | |
| 15 | function command_w3motd(account, text) |
| 16 | -- allow warcraft 3 client only |
| 17 | if not (account.clienttag == CLIENTTAG_WAR3XP or account.clienttag == CLIENTTAG_WARCRAFT3) then |
| 18 | return 1 |
| 19 | end |
| 20 | |
| 21 | username = account.name |
| 22 | local data = file_load(config.motdw3file, w3motd_sendline_callback) |
| 23 | |
| 24 | return 0 |
| 25 | end |
| 26 | |
| 27 | function w3motd_sendline_callback(line) |
| 28 | api.message_send_text(username, message_type_info, nil, line) |
| 29 | end |