Jump to content
  • 0

R>edit this EA @banip


Question

Posted


/*

Author Goddameit

Version 2013/02/06

Web http://bit.ly/MDuQ9F

Special thanks for :

Euphy >>

New 'reason' and command input type

QQfoolsorellina >>

IP range check concept

AnnieRuru >>

command protection and Bug report

*/

- script ban_ip_atcommand -1,{

OnInit:

bindatcmd "banip",strnpcinfo(3)+"::OnBan";

bindatcmd "unbanip",strnpcinfo(3)+"::OnUnBan";

end;

OnBan:

if ( !.@atcmd_numparameters )

{

message strcharinfo(0), "usage: @banip <ip> <reason>";

end;

}

set .@atcmd_parameters$[0],escape_sql(.@atcmd_parameters$[0]);

set .@atcmd_parameters$[1],escape_sql(.@atcmd_parameters$[1]);

set .@tmp$, implode(.@atcmd_parameters$," ");

set .@reason$, substr(.@tmp$,getstrlen(.@atcmd_parameters$[0]),getstrlen(.@tmp$)-1);

set .@oaid, getcharid(3);

set .@ip$, replacestr(.@atcmd_parameters$[0], "*", "%");

for(set .@j,0;;set .@j,.@j+1)

{

deletearray .@aid[0],128;

query_sql "SELECT `account_id` FROM `login` WHERE `last_ip` LIKE '"+.@ip$+"' LIMIT "+(.@j*127)+",127",.@aid;

set .@num, getarraysize(.@aid);

for( set .@i,0; .@i<.@num; set .@i,.@i+1 )

{

if( attachrid(.@aid[.@i]) )

{

Announce "You have been banned because GM reject IP ["+.@atcmd_parameters$[0]+"]. Reason : "+.@reason$,bc_self;

addtimer 1000,strnpcinfo(0)+"::OnKick";

detachrid;

}

}

if( .@num < 127 )

break;

}

attachrid .@oaid;

query_sql "SELECT `ban_id` FROM `ipbanlist2` WHERE `list` = '"+.@atcmd_parameters$[0]+"'",.@c;

if( .@c )

{

query_sql "UPDATE `ipbanlist2` SET `status` = 1 WHERE `list` = '"+.@atcmd_parameters$[0]+"'";

query_sql "UPDATE `ipbanlist2` SET `ban_id` = "+getcharid(3)+" WHERE `list` = '"+.@atcmd_parameters$[0]+"'";

query_sql "UPDATE `ipbanlist2` SET `ban_reason` = '"+.@reason$+"' WHERE `list` = '"+.@atcmd_parameters$[0]+"'";

}

else

query_sql "INSERT `ipbanlist2` VALUES('"+.@atcmd_parameters$[0]+"','"+.@reason$+"','',1,"+.@oaid+",0)";

message strcharinfo(0),"Ban IP:"+.@atcmd_parameters$[0];

end;

OnUnBan:

if ( !.@atcmd_numparameters )

{

message strcharinfo(0), "usage: @unbanip <ip> <reason>";

end;

}

set .@atcmd_parameters$[0],escape_sql(.@atcmd_parameters$[0]);

set .@atcmd_parameters$[1],escape_sql(.@atcmd_parameters$[1]);

query_sql "UPDATE `ipbanlist2` SET `status` = 0 WHERE `list` = '"+.@atcmd_parameters$[0]+"'";

query_sql "UPDATE `ipbanlist2` SET `unban_id` = "+getcharid(3)+" WHERE `list` = '"+.@atcmd_parameters$[0]+"'";

query_sql "UPDATE `ipbanlist2` SET `unban_reason` = '"+.@atcmd_parameters$[1]+"' WHERE `list` = '"+.@atcmd_parameters$[0]+"'";

message strcharinfo(0),"Unban IP:"+.@atcmd_parameters$[0];

end;

OnPCLoginEvent:

query_sql "SELECT `last_ip` FROM `login` WHERE `account_id` = "+getcharid(3),.@ip$;

set .@ip$, .@ip$[0];

deletearray .@my_array$[0],128;

explode(.@my_array$, .@ip$, ".");

setarray .@my_array1$[0],.@my_array$[0],.@my_array$[1],.@my_array$[2],"*";

setarray .@my_array2$[0],.@my_array$[0],.@my_array$[1],"*","*";

setarray .@my_array3$[0],.@my_array$[0],"*","*","*";

setarray .@my_array4$[0],"*","*","*","*";

set .@my_array1$,implode(.@my_array1$, ".");

set .@my_array2$,implode(.@my_array2$, ".");

set .@my_array3$,implode(.@my_array3$, ".");

set .@my_array4$,implode(.@my_array4$, ".");

query_sql "SELECT `list`,`ban_reason` FROM `ipbanlist2` WHERE `list` = '"+.@ip$+"' OR `list` = '"+.@my_array1$+"' OR `list` = '"+.@my_array2$+"' OR `list` = '"+.@my_array3$+"' OR `list` = '"+.@my_array4$+"' ",.@list$,.@ban_reason$;

set .@num, getarraysize(.@list$);

if( .@num )

{

Announce "You have been banned because GM reject IP ["+.@list$[0]+"]. Reason : "+.@ban_reason$[0],bc_self;

addtimer 5000,strnpcinfo(0)+"::OnKick";

}

end;

OnKick:

atcommand "@kick "+strcharinfo(0);

end;

}

please help me this im use EA

post-18119-0-80142800-1375242643_thumb.png

3 answers to this question

Recommended Posts

Posted

You probably will have to add it manually. I don't know if they have a .diff for eA. I don't think they do anyways.

It will be a long process though I believe if you want to add it manually. I can't really tell you exactly you how you're going to add it lol.

 

I am also unsure if it will be compatible with eA considering they may have used some elements that eA does not have / support.

  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...