[Include] Army Ban System (MySQL)
#1

Army Ban System


Description: Is a timing ban system, with MySQL database.
Author: Army,Armyww,Armyw0w (same person).
Version: v1.0

What do i need to use the system?
To use the system you need:

Sscanf - Click
MySQL - Click (recommended)
Wamp Server / Xampp

How to install the system ?

Add

Код:
#include <A_BanSys> // Army Ban System

#define BAN_LIST " " // The tabel with the ban list

// WARNING: If you have it already defined, please redefine them with SQL_

#define SQL_HOST " " // Servers ip
#define SQL_USER " " // Servers user.
#define SQL_PASS "" // Servers password
#define SQL_DB " " // Servers table
Import this .sql into the database.

Functions

A_DeleteBanIP()
Код:
A_DeleteBanIP( ip[] )  - select "IP" from the banlist and delete that ban.
A_DeteleBan()
Код:
A_DeteleBan( name[] ) - select an "name" from the banlist and delete that ban
A_OfflineBan
Код:
A_OfflineBan( name[], ip[], year, month, day, hour, min, sec, reason[], author[]) - add in the banlist, "name" and "ip" with the date of expiration.
A_Ban()
Код:
A_Ban(playerid, year, month, day, hour, min, sec, reason[], author[]) - that will add the player on the banlist with the expiration date.
A_CheckIPIsBanned()
Код:
A_CheckIPIsBanned( ip[] ) - Verify if "ip" exists in the banlist and return with an number
A_CheckNameIsBanned()
Код:
A_CheckNameIsBanned( name[] ) - Verify if "name" exists in the banlist and return with an number.
A_BanExpired()
Код:
A_BanExpired( playerid ) - it will verify if the palyer exists on the banlist and also if the ban expired returning with an number.
A_BanIPExpired()
Код:
A_BanIPExpired( ip[] ) - t will verify if "ip" exists in banlist and also if the ban expired returning with an number.
How do i use the system?

1. DeleteBanIP + CheckIPIsBanned

Код:
YCMD:unbanip(playerid, params[], help)
{
    new
        giveip            [ 16 ];

    if ( sscanf ( params, "s[16]", giveip) ) return SendClientMessage(playerid, 0xFFFFFFAA, "{C8C8C8}Please write an IP.");
    if ( A_CheckIPIsBanned( giveip ) == 0 ) { // It will check if the player is banned.

        A_DeleteBanIP( giveip ); //  If he is the ban will be deleted.
        return 1;

    } else { SendClientMessage(playerid, 0xFFFFFFAA, "{C8C8C8}Sorry, but the player isn't banned."); } // In case he's not banned.
    return 1;
}
2. DeleteBan + CheckNameIsBanned

Код:
YCMD:unban(playerid, params[], help)
{
    new
        givename            [ 20 ];

    if ( sscanf ( params, "s[20]", givename) ) return SendClientMessage(playerid, 0xFFFFFFAA, "{C8C8C8}Please write a name.");
    if ( A_CheckNameIsBanned( givename ) == 0 ) { // Verifica daca este banat

        A_DeteleBan( givename ); // Check if he's banned.
        return 1;

    } else { SendClientMessage(playerid, 0xFFFFFFAA, "{C8C8C8}Sorry, but the player isn't banned."); } // In case he's not banned.
    return 1;
}
3. A_CheckNameIsBanned + A_Ban

Код:
YCMD:banoneyear(playerid, params[], help)
{
	new
	    giveplayerid,
	    reason[ 30 ];
	    
	if ( sscanf(params, "us[30]", giveplayerid, reason) ) return SendClientMessage(playerid, 0xFFFFFFAA, "{C8C8C8}Sorry, you have not wrote well the command.");
	if (A_CheckNameIsBanned(GetName(giveplayerid) ) == 1) { //   It is checking if the player is banned.

		A_Ban(giveplayerid, 2013, 4, 10, 12, 17, 30, reason, GetName(playerid) ); // If he doesn't have ban, he will get banned.
		Kick(giveplayerid);
	
	
	} else { SendClientMessage(playerid, 0xFFFFFFAA, "{C8C8C8}Scuze, dar jucatorul are deja ban."); } // In case he have ban
	return 1;
}
4. A_CheckNameIsBanned + A_OfflineBan

Код:
YCMD:banoffponeyear(playerid, params[], help)
{
	new
	    givename[ 16 ],
	    reason	[ 30 ];

	if ( sscanf(params, "s[16]s[30]", givename, reason) ) return SendClientMessage(playerid, 0xFFFFFFAA, "{C8C8C8}Sorry, you have not wrote well the command.");
	if (A_CheckNameIsBanned( givename ) == 1) { //  It is checking if the player is banned.

		A_OfflineBan(givename, "NO-IP", 2013, 4, 10, 12, 21, 30, reason, GetName(playerid)); //  If he doesn't have ban, he will get banned.


	} else { SendClientMessage(playerid, 0xFFFFFFAA, "{C8C8C8}Scuze, dar jucatorul are deja ban."); } // In case he have ban
	return 1;
}
5. A_BanExpired

Код:
public OnPlayerConnect(playerid)
{
    if( A_BanExpired ( playerid ) == 0 ) // It will verify if the ban expired.
    {
		SendClientMessage(playerid, 0xFFFFFFAA, "{C8C8C8}Welcome}"); // In case that the ban expired.
	}
	else
	{
		Kick(playerid); // In case that the ban didn't expire
	}
	return 1;
}
6. A_BanIPExpired

Код:
public OnPlayerConnect(playerid)
{
	new
		pIP     [ 16 ];
		
	GetPlayerIp(playerid, pIP, 16);
	if( A_BanIPExpired ( pIP ) == 0 ) // It will verify if the ban expired.
    {
		SendClientMessage(playerid, 0xFFFFFFAA, "{C8C8C8}Welcome}"); // In case that the ban expired.
	}
	else
	{
		Kick(playerid); // In case that the ban didn't expire
	}
	return 1;
}
Download: Click
Pastebin: Click

Bugs:

Код:
i have not find
Please post imediatly if you find any bug, thanks.
Thank you:

WizzeY - Testing
SpeeDy - Testing
Opptur - Testing
****** - For the sscanf plugin
BlueG - For the MySQL Plugin

Please comment and post for bugs.
Reply


Messages In This Thread
Army Ban System (MySQL) - by Armyw0w - 10.04.2012, 17:51
Re: Army Ban System (MySQL) - by nielsbon1 - 10.04.2012, 17:52
Re: Army Ban System (MySQL) - by Armyw0w - 10.04.2012, 17:57
Re: Army Ban System (MySQL) - by CoCo™ - 10.04.2012, 20:32
Re: Army Ban System (MySQL) - by nielsbon1 - 10.04.2012, 20:33
Re: Army Ban System (MySQL) - by CoCo™ - 10.04.2012, 20:34
Re: Army Ban System (MySQL) - by Armyw0w - 10.04.2012, 20:42
Re: Army Ban System (MySQL) - by CoCo™ - 10.04.2012, 21:08
Re: Army Ban System (MySQL) - by Armyw0w - 10.04.2012, 21:17
Re: Army Ban System (MySQL) - by Deanx - 10.04.2012, 22:05
Re: Army Ban System (MySQL) - by WaLLy.SAMP - 11.04.2012, 11:46
Re: Army Ban System (MySQL) - by emp7y - 11.04.2012, 11:51
Re: Army Ban System (MySQL) - by Niko_boy - 11.04.2012, 12:00
Re: Army Ban System (MySQL) - by .PlaYer. - 11.04.2012, 13:29
Re: Army Ban System (MySQL) - by Armyw0w - 11.04.2012, 15:24
Re: Army Ban System (MySQL) - by -Sam_hero- - 11.04.2012, 16:32
Re: Army Ban System (MySQL) - by gabyk - 11.04.2012, 20:49
Re: Army Ban System (MySQL) - by Armyw0w - 11.04.2012, 20:52
Re: Army Ban System (MySQL) - by Armyw0w - 11.04.2012, 21:26
Re: Army Ban System (MySQL) - by razvanX - 30.04.2012, 09:36
Re: Army Ban System (MySQL) - by czerwony03 - 07.06.2013, 13:16
Re: Army Ban System (MySQL) - by Rock - 07.06.2013, 14:50
Re: Army Ban System (MySQL) - by Scriptery - 01.05.2017, 23:16

Forum Jump:


Users browsing this thread: 3 Guest(s)