SetBanAdmin

From Multi Theft Auto: Wiki
Revision as of 15:17, 6 August 2016 by Walid (talk | contribs) (Added oop syntax)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function sets a new admin for a ban.

Syntax

bool setBanAdmin ( ban theBan, string theAdmin )


OOP Syntax Help! I don't understand this!

Method: ban:setAdmin(...)
Variable: .admin
Counterpart: getBanAdmin


Required Arguments

  • theBan: The ban you want to change the admin of.
  • theAdmin: The new admin.

Returns

Returns true if changed, false otherwise.

Example

This example changes the ban admin to the admin's IP (If it's a player), when someone gets banned.

function banHappened(theBan)
    if getElementType(source) == "player" then
        local adminIP = getPlayerIP(source)
        setBanAdmin(theBan,adminIP)
    end
end

addEventHandler( "onBan", getRootElement(), banHappened )

See Also