27.03.2013, 07:03
#include <a_samp>
#include <a_mysql>
#include <sscanf2>
#if !defined BAN_LIST
#define BAN_LIST "banlist"
#if !defined SQL_HOST
#define SQL_HOST "localhost"
#if !defined SQL_USER
#define SQL_USER "root"
#if !defined SQL_PASS
#define SQL_PASS ""
#if !defined SQL_DB
#define SQL_DB "samp"
#endif
#define STRING_MAX 128
#define IP_MAX 16
public OnGameModeInit()
{
mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
return CallLocalFunction("ABan_OnGameModeInit", "");
}
stock A_DeleteBanIP(playerip[])
{
new
string [ STRING_MAX ];
format ( string , STRING_MAX ,"DELETE FROM `"#BAN_LIST"` WHERE `ip` = '%s'" , playerip );
mysql_query( string );
return 1;
}
stock A_DeteleBan(playername[])
{
new
string [ STRING_MAX ];
format ( string , STRING_MAX ,"DELETE FROM `"#BAN_LIST"` WHERE `username` = '%s'" , playername );
mysql_query ( string );
return 1;
}
stock A_OfflineBan(playername[], ipn[], year, month, day, hour, min, sec, reason[], author[])
{
new
nY, nM, nD,
nH, nMin, nS,
str [ STRING_MAX ];
format ( str , STRING_MAX , "INSERT INTO `"#BAN_LIST"`(`username`, `ip`) VALUES ('%s','%s')" , playername , ipn );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `actyear` = '%d', `actmonth` = '%d', `actday` = '%d' WHERE `username` ='%s' AND `ip` ='%s'" , nY , nM , nD , playername , ipn );
mysql_query ( str ) ;
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `acthour` = '%d', `actmin` = '%d', `actsec` = '%d' WHERE `username` ='%s' AND `ip` ='%s'" , nH , nMin , nS , playername , ipn );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `year` = '%d', `month` = '%d', `day` = '%d' WHERE `username` ='%s' AND `ip` ='%s'" , year , month , day , playername , ipn );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `hour` = '%d', `min` = '%d', `sec` = '%d' WHERE `username` ='%s' AND `ip` ='%s'" , hour , min , sec , playername , ipn );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `reason` = '%s', `autor` = '%s' WHERE `username` ='%s' AND `ip` ='%s'" , reason , author , playername , ipn );
mysql_query ( str );
return 1;
}
stock A_Ban(playerid, year, month, day, hour, min, sec, reason[], author[])
{
new
nY, nM, nD,
nH, nMin, nS,
str [ STRING_MAX ],
ip [ IP_MAX ];
GetPlayerIp ( playerid , ip , IP_MAX ),getdate ( nY , nM , nD ), gettime ( nH , nMin , nS );
format ( str , STRING_MAX, "INSERT INTO `"#BAN_LIST"`(`username`, `ip`) VALUES ('%s','%s')", GetName(playerid), ip);
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `actyear` = '%d', `actmonth` = '%d', `actday` = '%d' WHERE `username` ='%s' AND `ip` ='%s'", nY , nM , nD , GetName(playerid) , ip );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `acthour` = '%d', `actmin` = '%d', `actsec` = '%d' WHERE `username` ='%s' AND `ip` ='%s'", nH , nMin , nS , GetName(playerid) , ip );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `year` = '%d', `month` = '%d', `day` = '%d' WHERE `username` ='%s' AND `ip` ='%s'" , year , month , day , GetName(playerid) , ip );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `hour` = '%d', `min` = '%d', `sec` = '%d' WHERE `username` ='%s' AND `ip` ='%s'", hour , min , sec , GetName(playerid) , ip );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `reason` = '%s', `autor` = '%s' WHERE `username` ='%s' AND `ip` ='%s'" , reason , author , GetName(playerid) , ip );
mysql_query ( str );
return 1;
}
stock A_CheckIPIsBanned(playerip[])
{
new
string [ STRING_MAX ];
format ( string , STRING_MAX , "SELECT * FROM `"#BAN_LIST"` WHERE `ip` = '%s'" , playerip );
mysql_query ( string );
mysql_store_result ( );
if(mysql_num_rows ( ) != 0)
{
return 0;
} else return 1;
}
stock A_CheckNameIsBanned(playername[])
{
new
string [ STRING_MAX ];
format ( string , STRING_MAX , "SELECT * FROM `"#BAN_LIST"` WHERE `username` = '%s'" , playername );
mysql_query ( string );
mysql_store_result ( );
if(mysql_num_rows ( ) != 0)
{
return 0;
} else return 1;
}
stock A_BanExpired(playerid)
{
new
nY, nM, nD,
nH, nM2, nS,
eY, eM, eD,
eH, eM2, eS,
aY, aM, aD,
aH, aM2, aS,
string [ STRING_MAX ],
un [ 20 ],
ip [ IP_MAX ],
r [ 30 ],
a [ 20 ];
getdate ( nY , nM , nD ), gettime ( nH , nM2 , nS);
format ( string , STRING_MAX ,"SELECT * FROM `"#BAN_LIST"` WHERE `username` = '%s'" , GetName( playerid ) );
mysql_query ( string );
mysql_store_result ( );
if(mysql_num_rows ( ) != 0)
{
mysql_fetch_row_format ( string , "|" );
sscanf(string, "p<|>s[20]s[16]iiiiiiiiiiiis[30]s[20]", un, ip, aY, aM, aD, aH, aM2, aS, eY, eM, eD, eH, eM2, eS, r, a);
if ( (nY > eY || nY == eY) && (nM > eM || nM == eM || (nM < eM && nY > eY)) && (nD > eD || nD == eD || (nD > eD && nM > eM)) && (nH > eH || nH == eH) && (nM2 > eM2 || nM2 == eM2 || (nM2 < eM2 && nH > eH)) && (nS > eS || nS == eS || (nS < eS && nM2 > eM2)) )
{
return 0;
} else return 1;
} else return 1;
}
stock A_BanIPExpired(ipn[])
{
new
nY, nM, nD,
nH, nM2, nS,
eY, eM, eD,
eH, eM2, eS,
aY, aM, aD,
aH, aM2, aS,
string [ STRING_MAX ],
un [ 20 ],
ip [ IP_MAX ],
r [ 30 ],
a [ 20 ];
getdate ( nY , nM , nD ), gettime ( nH , nM2 , nS );
format ( string, STRING_MAX , "SELECT * FROM `"#BAN_LIST"` WHERE `ip` = '%s'" , ipn );
mysql_query ( string );
mysql_store_result ( );
if(mysql_num_rows ( ) != 0)
{
mysql_fetch_row_format ( string , "|" );
sscanf(string, "p<|>s[20]s[16]iiiiiiiiiiiis[30]s[20]", un, ip, aY, aM, aD, aH, aM2, aS, eY, eM, eD, eH, eM2, eS, r, a);
if ( (nY > eY || nY == eY) && (nM > eM || nM == eM) && (nD > eD || nD == eD) && (nH > eH || nH == eH) && (nM2 > eM2 || nM2 == eM2) && (nS > eS || nS == eS) ) {
return 0;
}
else
{
return 1;
}
}
return 1;
}
GetName(playerid)
{
new
name[ 20 ];
GetPlayerName ( playerid , name , 20 );
return name;
}
forward ABan_OnGameModeInit();
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit ABan_OnGameModeInit
//==================
i get this error, i ******d it but i cant get any help, can anyone fix it, thanks in advance
#include <a_mysql>
#include <sscanf2>
#if !defined BAN_LIST
#define BAN_LIST "banlist"
#if !defined SQL_HOST
#define SQL_HOST "localhost"
#if !defined SQL_USER
#define SQL_USER "root"
#if !defined SQL_PASS
#define SQL_PASS ""
#if !defined SQL_DB
#define SQL_DB "samp"
#endif
#define STRING_MAX 128
#define IP_MAX 16
public OnGameModeInit()
{
mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
return CallLocalFunction("ABan_OnGameModeInit", "");
}
stock A_DeleteBanIP(playerip[])
{
new
string [ STRING_MAX ];
format ( string , STRING_MAX ,"DELETE FROM `"#BAN_LIST"` WHERE `ip` = '%s'" , playerip );
mysql_query( string );
return 1;
}
stock A_DeteleBan(playername[])
{
new
string [ STRING_MAX ];
format ( string , STRING_MAX ,"DELETE FROM `"#BAN_LIST"` WHERE `username` = '%s'" , playername );
mysql_query ( string );
return 1;
}
stock A_OfflineBan(playername[], ipn[], year, month, day, hour, min, sec, reason[], author[])
{
new
nY, nM, nD,
nH, nMin, nS,
str [ STRING_MAX ];
format ( str , STRING_MAX , "INSERT INTO `"#BAN_LIST"`(`username`, `ip`) VALUES ('%s','%s')" , playername , ipn );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `actyear` = '%d', `actmonth` = '%d', `actday` = '%d' WHERE `username` ='%s' AND `ip` ='%s'" , nY , nM , nD , playername , ipn );
mysql_query ( str ) ;
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `acthour` = '%d', `actmin` = '%d', `actsec` = '%d' WHERE `username` ='%s' AND `ip` ='%s'" , nH , nMin , nS , playername , ipn );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `year` = '%d', `month` = '%d', `day` = '%d' WHERE `username` ='%s' AND `ip` ='%s'" , year , month , day , playername , ipn );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `hour` = '%d', `min` = '%d', `sec` = '%d' WHERE `username` ='%s' AND `ip` ='%s'" , hour , min , sec , playername , ipn );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `reason` = '%s', `autor` = '%s' WHERE `username` ='%s' AND `ip` ='%s'" , reason , author , playername , ipn );
mysql_query ( str );
return 1;
}
stock A_Ban(playerid, year, month, day, hour, min, sec, reason[], author[])
{
new
nY, nM, nD,
nH, nMin, nS,
str [ STRING_MAX ],
ip [ IP_MAX ];
GetPlayerIp ( playerid , ip , IP_MAX ),getdate ( nY , nM , nD ), gettime ( nH , nMin , nS );
format ( str , STRING_MAX, "INSERT INTO `"#BAN_LIST"`(`username`, `ip`) VALUES ('%s','%s')", GetName(playerid), ip);
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `actyear` = '%d', `actmonth` = '%d', `actday` = '%d' WHERE `username` ='%s' AND `ip` ='%s'", nY , nM , nD , GetName(playerid) , ip );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `acthour` = '%d', `actmin` = '%d', `actsec` = '%d' WHERE `username` ='%s' AND `ip` ='%s'", nH , nMin , nS , GetName(playerid) , ip );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `year` = '%d', `month` = '%d', `day` = '%d' WHERE `username` ='%s' AND `ip` ='%s'" , year , month , day , GetName(playerid) , ip );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `hour` = '%d', `min` = '%d', `sec` = '%d' WHERE `username` ='%s' AND `ip` ='%s'", hour , min , sec , GetName(playerid) , ip );
mysql_query ( str );
format ( str , STRING_MAX , "UPDATE `"#BAN_LIST"` SET `reason` = '%s', `autor` = '%s' WHERE `username` ='%s' AND `ip` ='%s'" , reason , author , GetName(playerid) , ip );
mysql_query ( str );
return 1;
}
stock A_CheckIPIsBanned(playerip[])
{
new
string [ STRING_MAX ];
format ( string , STRING_MAX , "SELECT * FROM `"#BAN_LIST"` WHERE `ip` = '%s'" , playerip );
mysql_query ( string );
mysql_store_result ( );
if(mysql_num_rows ( ) != 0)
{
return 0;
} else return 1;
}
stock A_CheckNameIsBanned(playername[])
{
new
string [ STRING_MAX ];
format ( string , STRING_MAX , "SELECT * FROM `"#BAN_LIST"` WHERE `username` = '%s'" , playername );
mysql_query ( string );
mysql_store_result ( );
if(mysql_num_rows ( ) != 0)
{
return 0;
} else return 1;
}
stock A_BanExpired(playerid)
{
new
nY, nM, nD,
nH, nM2, nS,
eY, eM, eD,
eH, eM2, eS,
aY, aM, aD,
aH, aM2, aS,
string [ STRING_MAX ],
un [ 20 ],
ip [ IP_MAX ],
r [ 30 ],
a [ 20 ];
getdate ( nY , nM , nD ), gettime ( nH , nM2 , nS);
format ( string , STRING_MAX ,"SELECT * FROM `"#BAN_LIST"` WHERE `username` = '%s'" , GetName( playerid ) );
mysql_query ( string );
mysql_store_result ( );
if(mysql_num_rows ( ) != 0)
{
mysql_fetch_row_format ( string , "|" );
sscanf(string, "p<|>s[20]s[16]iiiiiiiiiiiis[30]s[20]", un, ip, aY, aM, aD, aH, aM2, aS, eY, eM, eD, eH, eM2, eS, r, a);
if ( (nY > eY || nY == eY) && (nM > eM || nM == eM || (nM < eM && nY > eY)) && (nD > eD || nD == eD || (nD > eD && nM > eM)) && (nH > eH || nH == eH) && (nM2 > eM2 || nM2 == eM2 || (nM2 < eM2 && nH > eH)) && (nS > eS || nS == eS || (nS < eS && nM2 > eM2)) )
{
return 0;
} else return 1;
} else return 1;
}
stock A_BanIPExpired(ipn[])
{
new
nY, nM, nD,
nH, nM2, nS,
eY, eM, eD,
eH, eM2, eS,
aY, aM, aD,
aH, aM2, aS,
string [ STRING_MAX ],
un [ 20 ],
ip [ IP_MAX ],
r [ 30 ],
a [ 20 ];
getdate ( nY , nM , nD ), gettime ( nH , nM2 , nS );
format ( string, STRING_MAX , "SELECT * FROM `"#BAN_LIST"` WHERE `ip` = '%s'" , ipn );
mysql_query ( string );
mysql_store_result ( );
if(mysql_num_rows ( ) != 0)
{
mysql_fetch_row_format ( string , "|" );
sscanf(string, "p<|>s[20]s[16]iiiiiiiiiiiis[30]s[20]", un, ip, aY, aM, aD, aH, aM2, aS, eY, eM, eD, eH, eM2, eS, r, a);
if ( (nY > eY || nY == eY) && (nM > eM || nM == eM) && (nD > eD || nD == eD) && (nH > eH || nH == eH) && (nM2 > eM2 || nM2 == eM2) && (nS > eS || nS == eS) ) {
return 0;
}
else
{
return 1;
}
}
return 1;
}
GetName(playerid)
{
new
name[ 20 ];
GetPlayerName ( playerid , name , 20 );
return name;
}
forward ABan_OnGameModeInit();
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit ABan_OnGameModeInit
//==================
i get this error, i ******d it but i cant get any help, can anyone fix it, thanks in advance