Jump to content

Ban IP (ver.3)


goddameit

Recommended Posts


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

Preview :
[media=]

[/media]

This script will create a new GM command to ban or unban specify IP

and also record who ban it and who unban it.

After you ban some IP, those user will be kicked out server and will not be able to use it for login server.


@banip <IP> <reason reason reason>...
@unbanip <IP> <reason reason reason>...

Preview : http://bit.ly/VqCVY1


New SQL Table :
CREATE TABLE IF NOT EXISTS `ipbanlist2` (
`list` varchar(255) NOT NULL default '',
`ban_reason` varchar(255) NOT NULL default '',
`unban_reason` varchar(255) NOT NULL default '',
`status` tinyint(1) NOT NULL default '0',
`ban_id` int(11) unsigned NOT NULL default '0',
`unban_id` int(11) unsigned NOT NULL default '0',
KEY (`list`)
) ENGINE=MyISAM;


Script :
ban_ip_atcommand_3.txt
ban_ip_atcommand_2.txt
ban_ip_atcommand.txt

Version
Edited by goddameit
  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Nice work, as always. :>

I suggest you use the format:

<IP> <reason>

Currently the reason can only be one word, but you have set the SQL columns to varchar(255) and no words I know of are that long. xP You can then build a multi-word reason by either:

  • Using string commands.
    set .@tmp$, implode(.@atcmd_parameters$," ");
    set .@reason$, substr(.@tmp$,getstrlen(.@atcmd_parameters$[0]),getstrlen(.@tmp$)-1);


  • Looping.
    for(set .@i,1; .@i<.@atcmd_numparameters; set .@i,.@i+1)
       set .@reason$, .@reason$ + " " + .@atcmd_parameters$[.@i]


.@atcmd_numparameters is fixed in r17106.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

Thanks, will try it.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

.@atcmd_numparameters is fixed in r17106.

/bo

This fix still doesn't exist !

@goddameit

100 milliseconds for reading the reason... kick too fast lol

Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  90
  • Reputation:   12
  • Joined:  08/22/12
  • Last Seen:  

This pretty much is a copy of my code, the only difference is, mine is source and you can use more than just a word as reason but great job, appreciate your work.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

If system work as I think, it will show message on your client, and if it doesn't close your client,

you can read reason as video shown >> http://bit.ly/120XQ5F

Edited by goddameit
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

If system work as I think, it will show message on your client, and if it doesn't close your client,

you can read reason as video shown >> http://bit.ly/120XQ5F

True. But mine doesn't show anything (yes I have tried on my character, I'm a little masochist I guess). It depends on diff patch on launcher. Just a setting I guess

Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   104
  • Joined:  11/19/11
  • Last Seen:  

Suggestion:

@banip <reason> <IP> {<IP range>}

ragne value:

  1. d.d.d.*
  2. d.d.*.*
  3. d.*.*.*

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

Nice one, I will do it. /no1

-

Update to ver.2

Version 2 :

Add define range IP

Sample :
aaa.bbb.ccc.*
aaa.*.*.*
*.*.*.* // ban all of people

Change input type

@banip <IP> <reason>
@unbanip <IP> <reason>

Edited by goddameit
Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

your script doesn't really work

I tried to ban myself (127.0.0.1) without *,

it kicks me off, but I can login back like nothing happens

and your script doesn't have enough command protection ...

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

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

your script doesn't really work

I tried to ban myself (127.0.0.1) without *,

it kicks me off, but I can login back like nothing happens

and your script doesn't have enough command protection ...

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

fixed, thanks for report

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

OnInit:
   bindatcmd "banip",strnpcinfo(3)+"::OnBan";
   bindatcmd "unbanip",strnpcinfo(3)+"::OnUnBan";
   end;

Wouldn't this make the commands usable by anyone, since you didn't set an atcommand_level or charcommand_level? and there are no GM level/group checks within the script.

*bindatcmd "command","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

OnInit:
bindatcmd "banip",strnpcinfo(3)+"::OnBan";
bindatcmd "unbanip",strnpcinfo(3)+"::OnUnBan";
end;

Wouldn't this make the commands usable by anyone, since you didn't set an atcommand_level or charcommand_level?

*bindatcmd "command","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};

I don't know is that need to set, so I didn't set it.

Link to comment
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   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.

×
×
  • Create New...