getBanSerial | Multi Theft Auto: Wiki Skip to content

getBanSerial

Client-side
Server-side
Shared

This function will return the serial of the specified ban.

OOP Syntax Help! I don't understand this!

  • Method:ban:getSerial(...)
  • Variable: .serial

Syntax

string|false getBanSerial ( ​ban theBan )
Required arguments
  • theBan: The ban you want to retrieve the serial of.

Returns

Returns a string of the serial if everything was successful, false if invalid arguments are specified or if there was no serial specified for the ban.

  • string|false: serial

Code Examples

server

This example will show the user who banned a player the serial of that banned player.

local function banPlayerCommand(thisPlayer, commandName, bannedName, reason)
if (hasObjectPermissionTo(thisPlayer, "function.banPlayer")) then -- If the command user has the rights
local bannedPlayer = getPlayerFromName(bannedName) -- Get player by name
if (bannedPlayer) then
local theBan = banPlayer(bannedPlayer, true, false, true, thisPlayer, reason) -- Ban the player
outputChatBox("ban: " .. bannedName .. " successfully banned", thisPlayer) -- Send the banner a succes message
outputChatBox("At Serial: "..getBanSerial(theBan), thisPlayer) -- And send him the serial of the banned player
else
outputChatBox("Player "..bannedName.." not found", thisPlayer)
end
else
outputChatBox("ban: You don't have enough permissions", thisPlayer) -- If the command user doesn't have the permissions
end
end
addCommandHandler("ban", banPlayerCommand)