Raised This Month: $51 Target: $400
 12% 

[Not Solved ] Scripting Help related to ban command


Post New Thread Reply   
 
Thread Tools Display Modes
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 12-10-2012 , 02:05   Re: [Not Solved ] Scripting Help related to ban command
Reply With Quote #11

check out your amx_addban workablility.

and also note: readnng file every time when user connects is really efficienlty, better to use global variable(like a array). and on initilization just once read file and put all variables inside arrays.

and also, I hope you understand that this plugin check only class mask? for example they get only first digits from ip(~9/10symbols} xxx.xxx.xxx=11 ..
i think better to check only substring from all ip. for example:
you get ip
get_user_ip(id,ip,31,1)


/* Checks if two strings equal. If len var is set
* then there are only c chars comapred. */
native equal(const a[],const b[],c=0);

PHP Code:
public mSoftVerificaClasaDeIp(id)
{
 if(
is_user_connected(id) == 1)
 {
  new 
user[32],ip[32];
  
get_user_name(id,user,31)
  
get_user_ip(id,ip,31,1)
  new 
counterIpuri;
  
counterIpuri 0
  
new fopen("/addons/amxmodx/configs/msoft_blacklist.ini","r")
  new 
data[128]
  while( !
feof(f) ) 
  {
   
fgets(fdata127)
   if(
data[0] != ';')
   {
    
counterIpuri++;
   }
  }
  
fclose(f)
  new 
fisierBlackList[128],clasaIpB[32];
  
format(fisierBlackList127"/addons/amxmodx/configs/msoft_blacklist.ini")
  for (new 
i=0i<counterIpurii++)
  {
   
read_file(fisierBlackListiclasaIpB31t)
   
//replace_all(clasaIpA, 9, ".", "")
   //replace_all(clasaIpB, 9, ".", "")
   
if (equal(ipclasaIpA,11))
   {
      
//remove server_print when tested.
    
server_print("11symbols of %s is equal to %s, so banning");
    
set_task(5.0,"mSoftAdaugaBanPermanent",id)
    
client_print(id,print_chat,"[info] Ops.. %s se pare ca ai fost pedepsit de catre conducerea acestui server. BAN PERMANENT pe CLASA de IP!",user)
    
client_print(id,print_chat,"[info] In cazul in care consideri ca aceasta pedeapsa este un abuz, asteptam reclamatia pe forum: http://counterstrike.master-software.ro")
   }
  }
 }

and also add server_print to banning, to check what server send with amx_addban.

PHP Code:
public mSoftAdaugaBanPermanent(id

if(
is_user_connected(id) == 1

new 
szName[32],ip[32]; 
get_user_name(id,szName,31
get_user_ip(id,ip,31,1
server_cmd("amx_addban ^"%s^" ^"%s^" 0 ^"Your Ip Has Been Blacklisted Headshooter^"",szName,ip
server_print("trying to amx_addban ^"%s^" ^"%s^" 0 ^"Your Ip Has Been Blacklisted Headshooter^"",szName,ip
client_print(0,print_chat," %s has been banned from server - Headshooter Bans! ",szName
 } 

__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT
AngeIII is offline
Send a message via Skype™ to AngeIII
shubhamgulati12
Senior Member
Join Date: Oct 2010
Location: Inida The Holy Place!!
Old 12-10-2012 , 03:07   Re: [Not Solved ] Scripting Help related to ban command
Reply With Quote #12

@angel bro please can you directly gimme a brand new edited/modified plugin which will serve the function that i require ... that is blacklisting of ips (the ips which i add in a .ini or .cfg file) and autommatically ban the player if any player of blacklisted ip connects to my server (all it's subnet too .... ) with compatibility of amx advanced bans .... please .... I am very new to scripting ....
__________________

Join Free File hosting - http://db.tt/VvebKSSW
[Free 2 GB cloud storage]
shubhamgulati12 is offline
shubhamgulati12
Senior Member
Join Date: Oct 2010
Location: Inida The Holy Place!!
Old 12-10-2012 , 23:20   Re: [Not Solved ] Scripting Help related to ban command
Reply With Quote #13

here's the scripting plus error :
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <file>

new t;

enum INFO NAMEAUTHORVERSION }

new const 
PLUGIN[INFO:3][] = { "mSoft BlackList Players","MaSTeR","1.0" }

public 
plugin_init()
{
 
register_plugin(PLUGIN[NAME],PLUGIN[VERSION],PLUGIN[AUTHOR])
}

public 
client_putinserver(id)
{
 new 
user[32];
 
get_user_name(id,user,31)
 
set_task(15.0,"mSoftVerificaClasaDeIp",id)
 
server_cmd("amx_chat IP class %s is checked automatically by the system.",user)
 
server_cmd("amx_chat If you get banned, it means that your IP is blacklisted!")
}

public 
mSoftVerificaClasaDeIp(id

 if(
is_user_connected(id) == 1
 { 
  new 
user[32],ip[32]; 
  
get_user_name(id,user,31
  
get_user_ip(id,ip,31,1
  new 
counterIpuri
  
counterIpuri 
  
new fopen("/addons/amxmodx/configs/msoft_blacklist.ini","r"
  new 
data[128
  while( !
feof(f) )  
  { 
   
fgets(fdata127
   if(
data[0] != ';'
   { 
    
counterIpuri++; 
   } 
  } 
  
fclose(f
  new 
fisierBlackList[128],clasaIpB[32]; 
  
format(fisierBlackList127"/addons/amxmodx/configs/msoft_blacklist.ini"
  for (new 
i=0i<counterIpurii++) 
  { 
   
read_file(fisierBlackListiclasaIpB31t
   
//replace_all(clasaIpA, 9, ".", "") 
   //replace_all(clasaIpB, 9, ".", "") 
   
if (equal(ipclasaIpA,11)) 
   { 
      
//remove server_print when tested. 
    
server_print("11symbols of %s is equal to %s, so banning"); 
    
set_task(5.0,"mSoftAdaugaBanPermanent",id
    
client_print(id,print_chat,"[info] Ops.. %s se pare ca ai fost pedepsit de catre conducerea acestui server. BAN PERMANENT pe CLASA de IP!",user
    
client_print(id,print_chat,"[info] In cazul in care consideri ca aceasta pedeapsa este un abuz, asteptam reclamatia pe forum: http://counterstrike.master-software.ro"
   } 
  } 
 } 
}


public 
mSoftAdaugaBanPermanent(id)  
{  
if(
is_user_connected(id) == 1)  
{  
new 
szName[32],ip[32];  
get_user_name(id,szName,31)  
get_user_ip(id,ip,31,1)  
server_cmd("amx_addban ^"%s^" ^"%s^" 0 ^"Your Ip Has Been Blacklisted Headshooter^"",szName,ip)  
server_print("trying to amx_addban ^"%s^" ^"%s^" 0 ^"Your Ip Has Been Blacklisted Headshooter^"",szName,ip)  
client_print(0,print_chat," %s has been banned from server - Headshooter Bans! ",szName)  
 }  

btw please dont mind anything i am very new to scripting..
Attached Thumbnails
Click image for larger version

Name:	Picture1.png
Views:	75
Size:	48.9 KB
ID:	113101  
__________________

Join Free File hosting - http://db.tt/VvebKSSW
[Free 2 GB cloud storage]
shubhamgulati12 is offline
Mrki_Drakula
Senior Member
Join Date: Jun 2011
Location: Serbia
Old 12-11-2012 , 06:15   Re: [Not Solved ] Scripting Help related to ban command
Reply With Quote #14

Add
Quote:
new clasaIpA[32];
__________________
-----------------------------------------------
Best regards,
David Snajder (aka Crysis)
Mrki_Drakula is offline
Send a message via MSN to Mrki_Drakula Send a message via Skype™ to Mrki_Drakula
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:36.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode