printf("my name is %s", fName(playerid)); if(TempBanCheck(playerid)){ Kick(playerid); return 1; } else{ printf("then my name is %s", fName(playerid)); }
stock TempBanCheck(playerid) { if(!test){ MySQLCheck(); return false; } new ip[15]; new str[128]; new tmp[256]; new query[512]; new ban_second, ban_minute, ban_hour, ban_day, ban_month, ban_year; GetPlayerIp(playerid, ip, sizeof(ip)); format(query,sizeof(query),"SELECT * FROM `"TEMPBANTABLENAME"` WHERE tempban_ip = '%s'",ip); mysql_query(query,-1,playerid,connection); mysql_store_result(connection); new nrows = mysql_num_rows(connection); if(nrows == 1) { mysql_fetch_field("tempban_second",tmp,connection); ban_second = strval(tmp); mysql_fetch_field("tempban_minute",tmp,connection); ban_minute = strval(tmp); mysql_fetch_field("tempban_hour",tmp,connection); ban_hour = strval(tmp); mysql_fetch_field("tempban_day",tmp,connection); ban_day = strval(tmp); mysql_fetch_field("tempban_month",tmp,connection); ban_month = strval(tmp); mysql_fetch_field("tempban_year",tmp,connection); ban_year = strval(tmp); mysql_free_result(connection); }else{ mysql_free_result(connection); printf("beore return false my name is %s", fName(playerid)); return false; } new year, month, day, hour, minute, second; getdate(year, month, day); gettime(hour, minute, second); new bool:kban=false; if(year >= ban_year && month > ban_month){ kban = false; }else{ if(ban_year > year){ kban = true; } if(ban_month > month && ban_year >= year){ kban = true; } if(ban_day > day && ban_month >= month && ban_year >= year){ kban = true; } if(ban_day == day && ban_month == month && ban_year == year) { if(ban_hour > hour) { kban = true; }else{ if(ban_minute >= minute && ban_second >= second) { kban = true; } } } } if(kban == true) { if(ban_minute<=9 && ban_minute>=0){ if(ban_second<=9 && ban_second>=0){ format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:0%d:0%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second); }else{ format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:0%d:%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second); } }else{ if(ban_second<=9 && ban_second>=0){ format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:%d:0%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second); }else{ format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:%d:%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second); } } SendClientMessage(playerid, RED, str); return true; }else{ format(query,sizeof(query),"DELETE FROM `"TEMPBANTABLENAME"` WHERE `tempban_ip` = '%s'", ip); mysql_query(query,-1,playerid,connection); } return false; }
[05:03:49] Incoming connection: *.*.*.*:51603 [05:03:50] [join] [ABK]Necro has joined the server (0:*.*.*.*) [05:03:50] my name is [ABK]Necro [05:03:50] beore return false my name is [ABK]Necro [05:03:50] then my name is |
stock fName(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); return name; }
`"TEMPBANTABLENAME"` |
#define TEMPBANTABLENAME "something" |
#define TEMPBANTABLENAME something |
// definition:
#define fName(%0) Player_Name[%0]
// global:
new
Player_Name[MAX_PLAYERS][21];
// OnPlayerConnect:
GetPlayerName(playerid, Player_Name[playerid], 21);
[05:41:39] [debug] Server crashed while executing FR_Admin.amx [05:41:39] [debug] AMX backtrace: [05:41:39] [debug] #0 native format () [00471450] from Fatal_Rivalry.exe [05:41:39] [debug] #1 000216dc in public OnPlayerConnect () from FR_Admin.amx [05:41:40] [debug] Native backtrace: [05:41:40] [debug] #0 00403334 in ?? () from Fatal_Rivalry.exe [05:41:40] [debug] #1 716358ca in AmxCallback () from plugins\crashdetect.DLL [05:41:40] [debug] #2 7163774f in amx_Exec () from plugins\crashdetect.DLL [05:41:40] [debug] #3 71630834 in CrashDetect:: DoAmxExec () from plugins\crashdetect.DLL [05:41:40] [debug] #4 7163591a in AmxExec () from plugins\crashdetect.DLL [05:41:40] [debug] #5 0046a41f in ?? () from Fatal_Rivalry.exe [05:41:40] [debug] #6 00465f2d in ?? () from Fatal_Rivalry.exe |
format(query,sizeof(query),"SELECT * FROM `"TEMPBANTABLENAME"` WHERE tempban_ip = '%s'",ip); |
print("SELECT * FROM `"TEMPBANTABLENAME"` WHERE tempban_ip = '%s'");
print(ip);
stock TempBanCheck(playerid)
{
if(!test)
{
MySQLCheck();
return false;
}
new ip[15];
new str[128];
new tmp[256];
new query[512];
new ban_second, ban_minute, ban_hour, ban_day, ban_month, ban_year;
GetPlayerIp(playerid, ip, sizeof(ip));
print("DEBUG: TempBanCheck -> 1");
format(query,sizeof(query),"SELECT * FROM `"TEMPBANTABLENAME"` WHERE tempban_ip = '%s'",ip);
mysql_query(query,-1,playerid,connection);
mysql_store_result(connection);
new nrows = mysql_num_rows(connection);
if(nrows == 1)
{
mysql_fetch_field("tempban_second",tmp,connection);
ban_second = strval(tmp);
mysql_fetch_field("tempban_minute",tmp,connection);
ban_minute = strval(tmp);
mysql_fetch_field("tempban_hour",tmp,connection);
ban_hour = strval(tmp);
mysql_fetch_field("tempban_day",tmp,connection);
ban_day = strval(tmp);
mysql_fetch_field("tempban_month",tmp,connection);
ban_month = strval(tmp);
mysql_fetch_field("tempban_year",tmp,connection);
ban_year = strval(tmp);
mysql_free_result(connection);
}
else
{
mysql_free_result(connection);
printf("beore return false my name is %s", fName(playerid));
return false;
}
new year, month, day, hour, minute, second;
getdate(year, month, day);
gettime(hour, minute, second);
new bool:kban=false;
if(year >= ban_year && month > ban_month) kban = false;
else
{
if(ban_year > year) kban = true;
else if(ban_month > month && ban_year >= year) kban = true;
else if(ban_day > day && ban_month >= month && ban_year >= year) kban = true;
else if(ban_day == day && ban_month == month && ban_year == year)
{
if(ban_hour > hour) kban = true;
else
{
if(ban_minute >= minute && ban_second >= second) kban = true;
}
}
}
if(kban == true)
{
if(ban_minute<=9 && ban_minute>=0)
{
if(ban_second<=9 && ban_second>=0)
{
print("DEBUG: TempBanCheck -> 2");
format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:0%d:0%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second);
}
else
{
print("DEBUG: TempBanCheck -> 3");
format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:0%d:%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second);
}
}
else
{
if(ban_second<=9 && ban_second>=0)
{
print("DEBUG: TempBanCheck -> 4");
format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:%d:0%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second);
}
else
{
print("DEBUG: TempBanCheck -> 5");
format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:%d:%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second);
}
}
SendClientMessage(playerid, RED, str);
return true;
}
else
{
print("DEBUG: TempBanCheck -> 6");
format(query,sizeof(query),"DELETE FROM `"TEMPBANTABLENAME"` WHERE `tempban_ip` = '%s'", ip);
mysql_query(query,-1,playerid,connection);
}
return false;
}