PDA

View Full Version : How to make this work


Super_Panda
09/10/2011, 02:23 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

CMD:kick(playerid, params[])
{
new id, reason[128];
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_WHITE, "Usage: /kick [id/name][reason]");
else if(id==playerid)SendClientMessage(playerid,COLOR_W HITE,"Error: You can not kick yourself!");
else if(IsPlayerAdmin(id))SendClientMessage(playerid,CO LOR_WHITE,"Error: You can not kick another admin!");
else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid, COLOR_WHITE,"Error: Player is not connected!");
{


new Name[MAX_PLAYER_NAME], KickMessage[128];
new Name2[MAX_PLAYER_NAME];
new plrIP[16];
new string[128];
new File:banned=fopen("bannednames.txt", io_append);
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(id, Name2, sizeof(Name2));
format(KickMessage, sizeof(KickMessage), "%s(%d) has kicked player %s(%d). Reason: %s", Name, playerid, Name2, id);
SendClientMessageToAll(COLOR_WHITE, KickMessage);
format(string, 256, "Name: %s Ip: %s.",Name2,plrIP);
fwrite(banned, string);
fclose(banned);
Kick(id);
}
return 1;
}
public OnPlayerConnect(playerid)
{

new KickMessage[128];
format(KickMessage, sizeof(KickMessage), "%s is suspected of ban evading (IP) Banned with Name (%s) on (%d/%d/%d)");
{else}
format(KickMessage, sizeof(KickMessage), "%s is suspected of ban evading (Name) Banned with Name (%s) IP: (%s) on (%d/%d/%d)");
SendClientMessageToAll(COLOR_WHITE, KickMessage);
return 1;
}


Or make my script like this:



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");
}


explode(octet_ban,ip_ban, ".");
explode(octet_player,ip_player, ".");
strcat(octet_player[0],".");
strcat(octet_player[0],octet_player[1]);
strcat(octet_ban[0],".");
strcat(octet_ban[0],octet_ban[1]);

strtr(banline, " ", "");
explode(evader_name, banline, "_]");
explode(evader_name, evader_name[1], "_-");




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(!IsAdmin(i)) continue;

SendClientMessage(i, color, text);

}

return 1;




}

DaRkAnGeL[NBK]
09/10/2011, 02:49 AM
um just an idea but LuxAdmin has an Aka system so when a player connects it checks what other names are registered on that IP address