UnbanIP without rcon scipt help
#1

dsadasdasdasdasd
Reply
#2

You're wasting a lot of memory by the way.

Try this:

pawn Код:
CMD:unbanip(playerid, params[])
{
    new
        IP[ 22 ]
    ;
    if(sscanf(params, "s[22]", IP))
        return SendClientMessage(playerid, -1, "Usage: /unbanip [IP]");

    strins( IP, "unban ", 0 );
    SendRconCommand( IP );
    SendRconCommand( "reloadbans" );
   
    return true;
}
Not that I actually changed much.
Reply
#3

LarzI, you have to account for the null terminator. An IP address can be 16 cells, so then you add "unban" which is 21, the space between unban and the IP, then an additional cell for the null terminator.

So, the cell size should be 23.
Reply
#4

255.255.255.255 = 15, not 16. The 16 cells is including the null terminator. unban + space = 6 letters, 16 + 6 = 22.

http://www.lettercount.com/ - input "unban 255.255.255.2550" for proof.
Reply
#5

Quote:
Originally Posted by LarzI
Посмотреть сообщение
255.255.255.255 = 15, not 16. The 16 cells is including the null terminator. unban + space = 6 letters, 16 + 16 = 22.
LarzI, I just wanna know...

Who's your math teacher?
Reply
#6

Oh spare me, you know as well as everyone else that it was a typ0. 16 + 6 = 22, obviously.
Reply
#7

I thought the rcon command was 'unbanip'... not 'unban'...
Therefore 24 cells?
Reply
#8

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
I thought the rcon command was 'unbanip'... not 'unban'...
Therefore 24 cells?
Haha, true that. My calculations were correct nevertheless!
Reply
#9

255.255.255.255 = 15 so that means an ip can be max 15 characters or less, so if you make max ip + the space + /unbanip = 7 letters + space = 8 letters, so string must be 15 + 8 = 23
Reply
#10

And all strings are zero-terminated, which means they all end with an additional character: '\0' (Null) thus making it 24.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)