Resource:Sqlbans: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 29: Line 29:
*'''duration:''' The minutes left in the ban time.
*'''duration:''' The minutes left in the ban time.


===getBanDetailsSQL===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string banValue string banisher string reason int duration getBanDetailsSQL ( string banValue )
string banValue string banisher string reason int duration getBanDetailsSQL ( string banValue )
</syntaxhighlight>
</syntaxhighlight>
Returns three strings and an integer:
===Required Arguements===
*'''banValue:''' A string for a players serial or IP address.
 
===Returns===
*'''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.
Line 38: Line 42:
*'''duration:''' The minutes left in the ban time.
*'''duration:''' The minutes left in the ban time.


===banPlayerSQL===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool banPlayerSQL ( player thePlayer, bool serial, bool ipAddress, string/player/resource banisher, string reason, int duration )
bool banPlayerSQL ( player thePlayer, bool serial, bool ipAddress, string/player/resource banisher, string reason, int duration )
</syntaxhighlight>
</syntaxhighlight>
*'''thePlayer:''' The player to ban
===Required Arguements===
*'''thePlayer:''' The player to ban.
*'''serial:''' Ban their serial?
*'''serial:''' Ban their serial?
*'''ipAddress:''' Ban their IP address? (Can't ban both)
*'''ipAddress:''' Ban their IP address? (Can't ban both.)
*'''banisher:''' A string, player, or resource that is banning the player
*'''banisher:''' A string, player, or resource that is banning the player.
*'''reason:''' The ban reason
*'''reason:''' The ban reason.
*'''duration:''' Time in minutes the ban should last for
*'''duration:''' Time in minutes the ban should last for.
 
===Returns===
This function will return ''true'' if the player was successfully banned. If they weren't successfully banned ''false'' will be returned.


===removeBanSQL===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool removeBanSQL ( string banValue, string/player/resource unbanisher )
bool removeBanSQL ( string banValue, string/player/resource unbanisher )
</syntaxhighlight>
</syntaxhighlight>
===Required Arguements===
*'''banValue:''' An IP address or serial to unban
*'''banValue:''' An IP address or serial to unban
*'''serial:''' A string, player or resource that is causing the unban.
*'''serial:''' A string, player or resource that is causing the unban.
===Returns===
This function will return ''true'' if the ban was successfully removed. If the ban wasn't successfully removed or the ban didn't even exist ''false'' will be returned.


</section>
</section>

Revision as of 17:15, 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.

getBanDetailsSQL

string banValue string banisher string reason int duration getBanDetailsSQL ( string banValue )

Required Arguements

  • banValue: A string for a players serial or IP address.

Returns

  • 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.

banPlayerSQL

bool banPlayerSQL ( player thePlayer, bool serial, bool ipAddress, string/player/resource banisher, string reason, int duration )

Required Arguements

  • 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.

Returns

This function will return true if the player was successfully banned. If they weren't successfully banned false will be returned.

removeBanSQL

bool removeBanSQL ( string banValue, string/player/resource unbanisher )

Required Arguements

  • banValue: An IP address or serial to unban
  • serial: A string, player or resource that is causing the unban.

Returns

This function will return true if the ban was successfully removed. If the ban wasn't successfully removed or the ban didn't even exist false will be returned.