PDA

View Full Version : [QUESTION] Will this work?


Super_Panda
10/10/2011, 01:43 AM
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#define FILTERSCRIPT
#include sscanf2
#include zcmd
#pragma tabsize 0
#define COLOR_WHITE -1

public OnPlayerConnect(playerid)
{

CheckBanEvade(playerid);

}

stock CheckBanEvade(playerid)
{
new found;
new string[256];
new banline[180]; // Create the string to store the read text in
new File:sampban = fopen("bans.txt", io_read); // Open the file
if(!IsPlayerConnected(playerid)) return 1;
while(fread(sampban, banline)) //reads the file line-by-line
{
if(strlen(banline) < 10){
continue;
}
new ip_ban[16];
new ip_player[16];
new evader_name[10][128];
GetPlayerIp(playerid, ip_player, sizeof(ip_player));
new octet_ban[3][10];
new octet_player[3][10];
if(sscanf(banline, "s[16] ", ip_ban)){
printf("Error reading the IP");
}
if(strcmp(GetName(playerid),evader_name[0], true) == 0){
format(string, sizeof string, "%s (ID: %i) is suspected of ban evading (%s) [NAME]", GetName(playerid), playerid, evader_name[0]);
SendClientMessageToAdmins(0x33ff33ff,string);
print(string);
found = 1;
}
if(strfind(octet_player[0],octet_ban[0], true) != -1){
format(string, sizeof string, "%s (ID: %i) is suspected of ban evading (%s) [IP RANGE]", GetName(playerid), playerid, evader_name[0]);
SendClientMessageToAdmins(0x33ff33ff,string);
print(string);
found = 1;
}
if(found) break;
}
fclose(sampban);
return 1;
}



stock SendClientMessageToAdmins(color, text[])
{
for(new i; i < MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(!IsPlayerAdmin(i)) continue;

SendClientMessage(i, color, text);

}

return 1;
}
stock GetName(playerid) {
new name[24];
GetPlayerName(playerid, name, sizeof(name));
return name;
}


Will this work? Yes? Why? No? Why, How to make it work??

TheLazySloth
10/10/2011, 03:00 AM
Why dont you test it?