Resource:Sqlbans: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:
==Exported functions/events==
==Exported functions/events==
<section name="Server" class="server" show="true">
<section name="Server" class="server" show="true">
===Functions===
===addBanSQL===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool addBanSQL ( string banValue, string/element banisher, string reason, int duration )
bool addBanSQL ( string banValue, string/element banisher, string reason, int duration )
</syntaxhighlight>
</syntaxhighlight>
===Required Arguments===
*'''banValue:''' A string for a players serial or IP address.
*'''banValue:''' A string for a players serial or IP address.
*'''banisher:''' Either a string, player pointer, or element pointer.
*'''banisher:''' Either a string, player pointer, or element pointer.
*'''reason:''' The reason for the ban.
*'''reason:''' The reason for the ban.
*'''duration:''' Integer in minutes for the ban.
*'''duration:''' Integer in minutes for the ban.
===Returns===
Returns ''true'' if the ban was successfully added. If the ban was not successfully added then ''false'' will be returned


===getBansSQL===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
table getBansSQL ()
table getBansSQL ()
</syntaxhighlight>
</syntaxhighlight>
Returns a table with 4 columns:
===Returns===
*'''banValue:''' A string for a players serial or IP address.
*'''banValue:''' A string for a players serial or IP address.
*'''banisher:''' A string for either a custom banisher, player name or resource name
*'''banisher:''' A string for either a custom banisher, player name or resource name

Revision as of 17:10, 1 February 2011

The SQLbans resource gives servers 100% flexibility with their ban system as it can be edited to meet their needs. The bans are stored using the inbult SQL functions into the database "bans" rather than XML which is used by the inbuilt MTA ban system.

Download can be found: On the MTA community.

Exported functions/events

Click to collapse [-]
Server

addBanSQL

bool addBanSQL ( string banValue, string/element banisher, string reason, int duration )

Required Arguments

  • banValue: A string for a players serial or IP address.
  • banisher: Either a string, player pointer, or element pointer.
  • reason: The reason for the ban.
  • duration: Integer in minutes for the ban.

Returns

Returns true if the ban was successfully added. If the ban was not successfully added then false will be returned

getBansSQL

table getBansSQL ()

Returns

  • banValue: A string for a players serial or IP address.
  • banisher: A string for either a custom banisher, player name or resource name
  • reason: The reason for the ban.
  • duration: The minutes left in the ban time.
string banValue string banisher string reason int duration getBanDetailsSQL ( string banValue )

Returns three strings and an integer:

  • banValue: A string for a players serial or IP address.
  • banisher: Either a string, player pointer, or element pointer.
  • reason: The reason for the ban.
  • duration: The minutes left in the ban time.
bool banPlayerSQL ( player thePlayer, bool serial, bool ipAddress, string/player/resource banisher, string reason, int duration )
  • thePlayer: The player to ban
  • serial: Ban their serial?
  • ipAddress: Ban their IP address? (Can't ban both)
  • banisher: A string, player, or resource that is banning the player
  • reason: The ban reason
  • duration: Time in minutes the ban should last for
bool removeBanSQL ( string banValue, string/player/resource unbanisher )
  • banValue: An IP address or serial to unban
  • serial: A string, player or resource that is causing the unban.