Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //- CREATE file kac_filter.txt in main directory. One SteamID per line. [IMPORTANT!]
- //- REPLACE KAC_Kick in translations.sp with below function [DONT KICK FILTERED PLAYERS] -//
- stock KAC_Kick(client, const String:trans[], any:...)
- {
- //- FILTER START --//
- new String:f_sID[64];
- GetClientAuthString(client, f_sID, sizeof(f_sID));
- new Handle:f_sIDfile = OpenFile("kac_filter.txt", "r");
- new String:f_sIDline[64];
- new bool:f_sIDfilterd = false;
- if (f_sIDfile == INVALID_HANDLE) {
- PrintToServer("KAC_FILTER: Error opening kac_filter.txt!");
- } else {
- while (!IsEndOfFile(f_sIDfile) && ReadFileLine(f_sIDfile, f_sIDline, sizeof(f_sIDline)))
- {
- new len = strlen(f_sIDline);
- for (new i = 0; i < len; i++) { if (IsCharSpace(f_sIDline[i])) { f_sIDline[i] = '\0'; break; } }
- if (strcmp(f_sIDline, f_sID) == 0) { f_sIDfilterd = true; }
- }
- }
- if (f_sIDfilterd) {
- PrintToServer("KAC_FILTER: Bypass KAC_Kick for %s", f_sID);
- } else { //- FILTER DEFAULT -//
- decl String:f_sBuffer[256], String:f_sFormat[256];
- GetTrieString(g_hCLang[client], trans, f_sFormat, sizeof(f_sFormat));
- VFormat(f_sBuffer, sizeof(f_sBuffer), f_sFormat, 3);
- KickClient(client, "%s", f_sBuffer);
- OnClientDisconnect(client); // Do this since the client is no longer useful to us. - Kigen
- } CloseHandle(f_sIDfile); //- FILTER END -//
- }
- //- REPLACE KAC_Ban in translations.sp with below function [DONT BAN FILTERED PLAYERS] -//
- stock KAC_Ban(client, time, const String:trans[], const String:format[], any:...)
- {
- //- FILTER START --//
- new String:f_sID[64];
- GetClientAuthString(client, f_sID, sizeof(f_sID));
- new Handle:f_sIDfile = OpenFile("kac_filter.txt", "r");
- new String:f_sIDline[64];
- new bool:f_sIDfilterd = false;
- if (f_sIDfile == INVALID_HANDLE) {
- PrintToServer("KAC_FILTER: Error opening kac_filter.txt!");
- } else {
- while (!IsEndOfFile(f_sIDfile) && ReadFileLine(f_sIDfile, f_sIDline, sizeof(f_sIDline)))
- {
- new len = strlen(f_sIDline);
- for (new i = 0; i < len; i++) { if (IsCharSpace(f_sIDline[i])) { f_sIDline[i] = '\0'; break; } }
- if (strcmp(f_sIDline, f_sID) == 0) { f_sIDfilterd = true; }
- }
- }
- if (f_sIDfilterd) {
- PrintToServer("KAC_FILTER: Bypass KAC_Kick for %s", f_sID);
- } else { //- FILTER DEFAULT -//
- new String:f_sBuffer[256], String:f_sEReason[256];
- GetTrieString(g_hCLang[client], trans, f_sEReason, sizeof(f_sEReason));
- VFormat(f_sBuffer, sizeof(f_sBuffer), format, 5);
- if ( g_bSourceBans )
- SBBanPlayer(0, client, time, f_sBuffer);
- else
- BanClient(client, time, BANFLAG_AUTO, f_sBuffer, f_sEReason, "KAC");
- OnClientDisconnect(client); // Bashats!
- } CloseHandle(f_sIDfile); //- FILTER END -//
- }
- //- REPLACE Network_OnSockRecvVer in network.sp with below function [DISABLE UPDATING] -//
- public Network_OnSockRecvVer(Handle:socket, String:data[], const size, any:we)
- {
- g_bVCheckDone = true;
- g_hVTimer = CreateTimer(14400.0, Network_VTimer);
- //- LogMessage("Received that KAC is up-to-date."); -//
- if ( SocketIsConnected(socket) )
- SocketDisconnect(socket);
- }
- //- REPLACE Network_OnSocketReceive in network.sp with below function [BYPASS GBAN LIST FOR FILTERED PLAYERS] -//
- public Network_OnSocketReceive(Handle:socket, String:data[], const size, any:client)
- {
- if ( socket == INVALID_HANDLE || !g_bAuthorized[client] )
- return;
- PrintToServer("KAC: Netowork_OnSocketReceive data; %s", data);
- decl String:f_sName[64], String:f_sAuthID[64], String:f_sBuffer[256];
- GetClientName(client, f_sName, 64);
- GetClientAuthString(client, f_sAuthID, 64);
- g_bChecked[client] = true;
- if ( StrEqual(data, "_BAN") )
- {
- //- FILTER START --//
- new String:f_sID[64];
- GetClientAuthString(client, f_sID, sizeof(f_sID));
- new Handle:f_sIDfile = OpenFile("kac_filter.txt", "r");
- new String:f_sIDline[64];
- new bool:f_sIDfilterd = false;
- if (f_sIDfile == INVALID_HANDLE) {
- PrintToServer("KAC_FILTER: Error opening kac_filter.txt!");
- } else {
- while (!IsEndOfFile(f_sIDfile) && ReadFileLine(f_sIDfile, f_sIDline, sizeof(f_sIDline)))
- {
- new len = strlen(f_sIDline);
- for (new i = 0; i < len; i++) { if (IsCharSpace(f_sIDline[i])) { f_sIDline[i] = '\0'; break; } }
- if (strcmp(f_sIDline, f_sID) == 0) { f_sIDfilterd = true; }
- }
- }
- if (f_sIDfilterd) {
- PrintToServer("KAC_FILTER: Bypass KAC_Kick for %s", f_sID);
- } else { //- FILTER DEFAULT -//
- KAC_Translate(client, KAC_GBANNED, f_sBuffer, sizeof(f_sBuffer));
- SetTrieString(g_hDenyArray, f_sAuthID, f_sBuffer);
- KAC_Log("%s (%s) is on the KAC global banlist.", f_sName, f_sAuthID);
- KAC_Kick(client, KAC_GBANNED);
- } CloseHandle(f_sIDfile); //- FILTER END -//
- }
- else
- {
- g_bChecked[client] = false;
- KAC_Log("%s (%s) got unknown reply from KAC master server. Data: %s", f_sName, f_sAuthID, data);
- Status_Report(g_iNetStatus, KAC_ERROR);
- }
- if ( SocketIsConnected(socket) )
- SocketDisconnect(socket);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement