[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
#2

Nice and clean, i think you spare people allot of time!
Reply
#3

Quote:
Originally Posted by nielsbon1
Посмотреть сообщение
Nice and clean, i think you spare people allot of time!
Thank you :*.
Reply
#4

You do know the SQL structure link is broken, right?
Reply
#5

Quote:
Originally Posted by CoCo™
Посмотреть сообщение
You do know the SQL structure link is broken, right?
For me it works?
Reply
#6

The link navigates to:

"http://import%20this%20.sql%20into%20the%20database./"
Reply
#7

I'm sorry
Updated xD
Reply
#8

We all make mistakes.
Reply
#9

Yes, you are right.
Reply
#10

nice
Reply
#11

Nice man Clean & simple for newbie:P
Reply
#12

nice , good WORK
Reply
#13

MySql ftw
i al ready love mysql based stuff and this one is also rocking
Reply
#14

Good Workd, man!
Maybe I'll use on my server
Reply
#15

Quote:
Originally Posted by Weslley_Script
Посмотреть сообщение
Bom eu Estou Gostando daki nada mal o Forum sa-mp e voce teve um otimo trabalho aki maninw
Huh )?
On english please :-s
Reply
#16

nice work.
Reply
#17

Good!
Reply
#18

Thank you :*
Reply
#19

xD Thank you :*
Reply
#20

I like it , i will use it on my server
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)