Jump to content

Recommended Posts

Posted (edited)

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
Posted

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
Posted (edited)

.@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
Posted

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.

Posted (edited)

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
  • 2 weeks later...
Posted

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
Posted

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

Posted

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
Posted

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.

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.

  • Recently Browsing   0 members

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