10.04.2012, 17:51 
	(
 Последний раз редактировалось Armyw0w; 12.04.2012 в 11:01.
)
	
	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
Functions
A_DeleteBanIP()
Код:
A_DeleteBanIP( ip[] ) - select "IP" from the banlist and delete that ban.
Код:
A_DeteleBan( name[] ) - select an "name" from the banlist and delete that ban
Код:
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(playerid, year, month, day, hour, min, sec, reason[], author[]) - that will add the player on the banlist with the expiration date.
Код:
A_CheckIPIsBanned( ip[] ) - Verify if "ip" exists in the banlist and return with an number
Код:
A_CheckNameIsBanned( name[] ) - Verify if "name" exists in the banlist and return with an number.
Код:
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( ip[] ) - t will verify if "ip" exists in banlist and also if the ban expired returning with an number.
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;
}
Код:
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;
}
Код:
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;
}
Код:
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;
}
Код:
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;
}
Код:
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;
}
Pastebin: Click
Bugs:
Код:
i have not find Please post imediatly if you find any bug, thanks.
WizzeY - Testing
SpeeDy - Testing
Opptur - Testing
****** - For the sscanf plugin
BlueG - For the MySQL Plugin
Please comment and post for bugs.




	
 Clean & simple for newbie:P