Quantcast
Channel: SA-MP Forums - Filterscripts
Viewing all articles
Browse latest Browse all 595

[FilterScript] TAdmin - A MySQL administration system

$
0
0
TAdmin

A MySQL administration system because we don’t have enough of those!



This is my first ever release so go easy on me D: Hopefully the system is gonna be useful to some people because I spent a lot of time working on it and I’m super proud of the final product.

If you have suggestions, improvements, found bugs or just need some help, please make an issue, PM me on forum or post in the SA:MP forum topic.

The system current features:
  • A basic login and registration system.
  • +25 admin commands.
  • Advanced player and world management commands. (/set, /give, /all)
  • Simple ban system that stores the bans in a MySQL table.
  • Admin logging saved in MySQL table.
  • Easy configuration.
  • Basic spectating system.
  • RCON login attempts logging, query errors logging and more.
  • Discord intergration.

Requirements

Installation

1. Clone this repository locally and download the required plugins/includes.
2. Put the tadmin_tools.inc file in the pawno/include folder.
3. Open the pwn file and edit the following lines with your details:

Code:

#define SYSTEMNAME “TAdmin” // Feel free to change it to “Admin System”, “Admin” etc etc.


#define ADMIN_MAX_LEVELS    4

#define COLOR_ADMINMSG          0xCC0000FF // Color used in the ‘Admin Message:’ messages.
#define ADMIN_LEVEL_1_COLOR  0xFF9900AA
#define ADMIN_LEVEL_2_COLOR  0x33AA33AA
#define ADMIN_LEVEL_3_COLOR  0x006699AA
#define ADMIN_LEVEL_4_COLOR  0xFF0000FF

#define ADMIN_LEVEL_1_NAME  “Trial Admin”
#define ADMIN_LEVEL_2_NAME  “Admin”
#define ADMIN_LEVEL_3_NAME  “Lead Admin”
#define ADMIN_LEVEL_4_NAME  “Management”

new bool:TAdmin_Debug = false;
new bool:SendQueryErrorsToAdmins = true;
new bool:AdminMapTeleport = true;
new bool:RCONFailedNotification = true;
new bool:UseDiscord = true;

/* TAdmin_Debug: Setting this to true will show debug messages in the server log, useful for debugging issues with TAdmin.
SendQueryErrorsToAdmins: Setting this to true will send Query errors to in-game admins. Query errors are always shown in the console regardless of this setting.
AdminMapTeleport: Setting this to true will allow admins to teleport by clicking on the map. RCONFailedNotification: Setting this to true will send failed rcon login messages to all online admins. Failed login attempts are saved to Logs/FailedRCONLogins.txt regardless of this setting.
UseDiscord:  Setting this to true will enable all Discord related features. Discord settings can be found below. */

#define MAX_MUTE_TIME          120 // The max amount of time an admin can mute a player (in minutes)

#define MYSQL_HOSTNAME      “localhost”
#define MYSQL_USERNAME      “root”
#define MYSQL_PASSWORD      “”
#define MYSQL_DATABASE      “main”

// – Discord Settings
#define ChannelAdminLogs “”
#define ChannelAdminChat “”
// Both AdminLogs and AdminChat require a Discord channel ID. Info here: http://toni.pw/l/discorddevmode

4. Inside the Scriptfiles folder, create another folder titled Logs.

5. Open PHPMyAdmin [localhost/phpmyadmin](http://localhost/phpmyadmin) and create a new database corresponding to the value MYSQL_DATABASE in tadmin.pwn file.

6. Once you have created the database, import the main.sql file and you should have 3 tables titled accounts, adminlogs and bans.

7. Finally, compile the filterscript, include it in server.cfg file filterscripts tadmin and run the server.

FAQ

Quote:

Q: How do I check if the player is an admin?

A: if(PlayerInfo[playerid][pAdmin] < 1) return 0; This is gonna check if the player's admin level is less than 1 and if it is, it returns 0, else it executes the command.
Quote:

Q: How do I add another admin level?

A: This is a bit more complicated so bear with me:

1. Firstly, increase the ADMIN_MAX_LEVELS value to whatever you want (I'll use 5 in this case).

2. Add the level's name and color:
#define ADMIN_LEVEL_5_COLOR 0xFF00FFFF` `#define ADMIN_LEVEL_5_NAME "Owner"

3. Edit GetAdminRank:
Code:

GetAdminRank(playerid)
{
    new arank[64];
    switch(PlayerInfo[playerid][pAdmin])
    {
        case 5: arank = ADMIN_LEVEL_5_NAME;
                    case 4: arank = ADMIN_LEVEL_4_NAME;
        case 3: arank = ADMIN_LEVEL_3_NAME;
        case 2: arank = ADMIN_LEVEL_2_NAME;
        case 1: arank = ADMIN_LEVEL_1_NAME;
        default: arank = "Unknown";
    }
    return arank;
}

4. Then, you can add the new admin level to /ahelp.
Code:

        else if(strcmp("5", params, true) == 0)
        {
                if(PlayerInfo[playerid][pAdmin] >= 5)
                {
                          format(string, sizeof(string), "> %!s(MISSING) commands", ADMIN_LEVEL_5_NAME);
                    SendClientMessage(playerid, COLOR_ADMINMSG, string);
                    SendClientMessage(playerid, COLOR_WHITE, "*your level 5 commands go here*");
                }
        }

5. Finally, modify the /admins command so it can show level 5 admins as well:
case 5: format(string, sizeof(string), "%s (%d) - Level %d (%s)", GetName(i), i, PlayerInfo[i][pAdmin], ADMIN_LEVEL_5_NAME);
Quote:

Q: I don’t care about the Discord stuff, can I remove them?

A: You can however you will have to spend some time removing them. I might release a seperate version without the Discord stuffs but for now, simply remove anything that says Discord.
Credits
  • SA:MP team
  • Y_Less - SSCANF2 and Whirlpool
  • Zeex - ZCMD
  • BlueG - MySQL
  • Emmet_ - easyDialog
  • Southclaws - Chrono
  • willbedie - Registration and Login system Link as well as his ban system Link
  • maddinat0r - Discord Connector
  • Luka.P - PlayerZone include
  • Twixxx - Player_Geolocation include

Viewing all articles
Browse latest Browse all 595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>