I got 2 scripts that check for bans, 1 using GUID and the other using IP
My problem is, that the GUID script works without lag, while when I thread the ban on IP, it gives everybody a ping 999 for a second.
Scripts are almost identical and it doesnt show any errors with dev 1 and logfile 2
Code:checkipbanlist(ip) { ipresult = readipbanfile(); if(!isdefined(ipresult)) ipresult[0]= 999999999999; //iprintlnbold("ipsize:" +ipresult.size); if(ipresult.size>0) { for(i = 0; i < ipresult.size; i++) { if(IsSubStr( ip, ipresult[i] )) { //iprintlnbold("Match IP!"); f = openfile("bans/ip/bans.txt", "read"); if(f == -1) return; name=fgetarg(f,i+1); reden=fgetarg(f,i+2); admin=fgetarg(f,i+3); //banip=fgetarg(f,i+4); closefile(f); admin = GetSubStr( admin, 0, admin.size-5); self iprintlnbold("Reden: "+reden); self iprintlnbold("name: "+name); self iprintlnbold("admin: "+admin); id = self getEntityNumber(); /*self setClientCvar("com_errorTitle", "BANNED"); self setClientCvar("com_errorMessage", "You are banned by: " +admin +"\n" + "^7Reason: "+reden +"\n" + "^7IP: "+ip +"\n" + "^7Website: www.myevilclan.tk");*/ iprintln("Banned player: "+self.name + "^7tried to join. Reason: "+reden); wait 1; message = "\nYou are banned by: " +admin +"\n" + "^7Reason: "+reden +"\n" + "^7IP: "+ip +"\n" + "^7Website: www.myevilclan.tk"; kick2(id, message); } } } } readipbanfile() { f = openfile("bans/ip/bans.txt", "read"); if(f == -1) return; argcount = freadln(f); if(argcount == -1) //end of file return; //iprintlnbold("Argcount:"+argcount); ipresult = []; for(i = 0; i < argcount; i++) { ipresult[i] = fgetarg(f, i); //iprintlnbold("ipresult"+i+ ":" +ipresult[i]); } closefile(f); return ipresult; } checkguidbanlist(guid) { banresult = readguidbanfile(); if(!isdefined(banresult)) banresult[0]= 999999999999; //iprintlnbold("guidsize:" +banresult.size); if(banresult.size>0) { for(i = 0; i < banresult.size; i++) { if(guid == banresult[i] ) { //iprintlnbold("Match GUID!"); f = openfile("bans/guid/bans.txt", "read"); if(f == -1) return; name=fgetarg(f,i+1); reden=fgetarg(f,i+2); admin=fgetarg(f,i+3); //banip=fgetarg(f,i+4); closefile(f); admin = GetSubStr( admin, 0, admin.size-5); self iprintlnbold("Reden: "+reden); self iprintlnbold("name: "+name); self iprintlnbold("admin: "+admin); id = self getEntityNumber(); /*self setClientCvar("com_errorTitle", "BANNED"); self setClientCvar("com_errorMessage", "You are banned by: " +admin +"\n" + "^7Reason: "+reden +"\n" + "^7GUID: "+guid +"\n" + "^7Website: www.myevilclan.tk");*/ iprintln("Banned player: "+self.name + "^7tried to join. Reason: "+reden); wait 1; message = "\nYou are banned by: " +admin +"\n" + "^7Reason: "+reden +"\n" + "^7GUID: "+guid +"\n" + "^7Website: www.myevilclan.tk"; kick2(id, message); /*self setClientCvar ("clientcmd", "disconnect"); self openMenu ("clientcmd"); self closeMenu ("clientcmd");*/ } } } } readguidbanfile() { f = openfile("bans/guid/bans.txt", "read"); if(f == -1) return; argcount = freadln(f); if(argcount == -1) //end of file return; //iprintlnbold("Argcount:"+argcount); banresult = []; for(i = 0; i < argcount; i++) { banresult[i] = int(fgetarg(f, i)); //iprintlnbold("banresult"+i+ ":" +banresult[i]); } closefile(f); return banresult; }

Reply With Quote

