GetUnbanTime: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 17: Line 17:
==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--TODO
function listBans ()
local bansList = getBans() -- Return a table of all the bans.
for banID, ban in ipairs ( banList ) do -- For every ban do the following...
local nick = getBanNick ( ban ) -- Get the IP of the ban
                local timetounban = getUnbanTime ( ban )
if nick then
outputChatBox ( "Ban #" .. banID .. ": " .. nick.." || Time to unban: "..timetounban , source, 255, 0, 0 ) -- Output the baninfo
end
end
end
addCommandHandler ( "bans", listBans ) -- Add "/bans" as the trigger for the function.
</syntaxhighlight>
</syntaxhighlight>



Revision as of 09:06, 6 September 2011

This function will return the unbanning time of the specified ban in seconds.

Syntax

int getUnbanTime ( ban theBan )

Required Arguments

  • theBan: The ban in which you wish to retrieve the unban time of.

Returns

  • Returns an integer of the unbanning time in the format of seconds from the year 1970. Use in conjunction with getRealTime in order to retrieve detailed information.
  • Returns false if invalid arguments are specified or if there was no unbanning time specified for the ban.

Example

function listBans ()
	local bansList = getBans() -- Return a table of all the bans.
 
	for banID, ban in ipairs ( banList ) do -- For every ban do the following...
		local nick = getBanNick ( ban ) -- Get the IP of the ban
                local timetounban = getUnbanTime ( ban ) 
		if nick then
			outputChatBox ( "Ban #" .. banID .. ": " .. nick.." || Time to unban: "..timetounban , source, 255, 0, 0 ) -- Output the baninfo
		end
	end
end
addCommandHandler ( "bans", listBans ) -- Add "/bans" as the trigger for the function.

See Also