Template:RU/Example/viewBanParameters

From Multi Theft Auto: Wiki
Revision as of 12:19, 10 September 2014 by Fabervox (talk | contribs) (Created page with "Этот пример выводит в чат ник забаненного игрока, админа, который дал бан, и причину. <syntaxhighlight lang="lua"> function ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Этот пример выводит в чат ник забаненного игрока, админа, который дал бан, и причину.

function outputBan(ban)
    local plr = getBanNick(ban) -- the player who got banned
    local admin = getBanAdmin(ban) -- admin who banned the player
    local reason = getBanReason(ban) -- reason for banning
    if (plr and admin and reason) then
        outputChatBox(plr.." has been banned by "..admin.." for "..reason, getRootElement(), 255, 0, 0) -- Outputs name of the player, admin and the reason for banning
    end
end
addEventHandler("onBan", getRootElement(), outputBan) -- When a player is banned trigger the outputBan function