OnUnban: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(9 intermediate revisions by 4 users not shown)
Line 2: Line 2:
{{Server event}}
{{Server event}}
This event is triggered when a ban is removed from the server.
This event is triggered when a ban is removed from the server.
if the ban was removed using function [[removeBan]], and the responsibleElement was not specifying, the event will return nil.


==Parameters==
==Parameters==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ban theBan
ban theBan, player responsibleElement
</syntaxhighlight>  
</syntaxhighlight>  


*'''theBan ''': The [[ban]] that will be removed.
*'''theBan ''': the [[ban]] that will be removed.
*'''responsibleElement''': the [[player]] who removed the ban, otherwise returns ''nil''.


==Source==
==Source==
Line 23: Line 26:
root = getRootElement()
root = getRootElement()


function announceUnban( theBan )
function announceUnban( theBan, responsibleElement )
if getElementType( source ) then --Check if a player unbanned the IP/Serial
if getElementType( responsibleElement ) then --Check if a player unbanned the IP/Serial
outputChatBox( getPlayerName( source ) .. " unbanned " .. ( getBanSerial(theBan) or getBanIP(theBan) ) ) --Output to the chatbox saying the player has unbanned the IP/Serial
outputChatBox( getPlayerName( responsibleElement ) .. " unbanned " .. ( getBanSerial(theBan) or getBanIP(theBan) ) ) --Output to the chatbox saying the player has unbanned the IP/Serial
end
end
end
end
Line 31: Line 34:
addEventHandler( "onUnban", root, announceUnban ) --Adds the event handler for 'onUnban'
addEventHandler( "onUnban", root, announceUnban ) --Adds the event handler for 'onUnban'
</syntaxhighlight>
</syntaxhighlight>
==Changelog==
{{ChangelogHeader}}
{{ChangelogItem|1.3.0-9.03908|Fixed/added responsible element parameter}}


{{See also/Server event|Server events}}
{{See also/Server event|Server events}}

Latest revision as of 03:05, 27 September 2018

This event is triggered when a ban is removed from the server.

if the ban was removed using function removeBan, and the responsibleElement was not specifying, the event will return nil.

Parameters

ban theBan, player responsibleElement
  • theBan : the ban that will be removed.
  • responsibleElement: the player who removed the ban, otherwise returns nil.

Source

The source is always the global root element.

Cancel effect

If this event is canceled, the requested unban is not performed.

Example

This example does...

root = getRootElement()

function announceUnban( theBan, responsibleElement )
	if getElementType( responsibleElement ) then --Check if a player unbanned the IP/Serial
		outputChatBox( getPlayerName( responsibleElement ) .. " unbanned " .. ( getBanSerial(theBan) or getBanIP(theBan) ) ) --Output to the chatbox saying the player has unbanned the IP/Serial
	end
end

addEventHandler( "onUnban", root, announceUnban ) --Adds the event handler for 'onUnban'

Changelog

Version Description
1.3.0-9.03908 Fixed/added responsible element parameter

See Also

Server events


Event functions