[BUG] samp.ban not creating new line.
#1

Hello,

In my administration systems [/BAN] command i use BanEx(playerid, string); to ban the player. The issue is, it does not create a new line for each banned player, it keeps every banned player on 1 line which is really annoying. I have tried to use the new line code ( \n ) to no avail.

Format Code:
pawn Код:
format(string,sizeof(string),"%s has been banned by %s. Reason: %s /n", pNick(ID), pNick(playerid), reason); BanEx(ID, string);
Thank you for your assistance.
Reply
#2

pawn Код:
/r/n
Atleast I thought. and make sure your using IO_APPEND not IO_WRITE in the FILE native unless your using another system ( likely ) in which case use the proper one. ( search the include for it. )


Here is an example of how I log things on my personal gamemode, don't even care how slow you guys claim it is compared to X method.

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    for(new i=0; i<MAX_PLAYERS; i++)
        {
        new PlayerIP[16];
        GetPlayerIp(i,PlayerIP,16);

        if(!strcmp(ip,PlayerIP,false))
            {
                new ban[100],Player[24];
               
                GetPlayerName(i,Player,24);
                format(ban,sizeof(ban),"{FF0000}[BAN]{FFFFFF}: %s tried to fuck with teh RCONz, They got banned!",Player);
                SendClientMessageToAll(0xffffff,ban);
                Ban(i);
               
                format(ban,sizeof(ban),"%s - %s has been Automatically banned for: RCON Attempt\r\n",Player,ip);
                new File:banlog = fopen("bans.txt", io_append);
                fwrite(banlog,ban);
                fclose(banlog);
                return 1;
            }
        }
    return 1;
}
I actually presume your problem is the fact your using a forward slash not a backslash
Reply
#3

The ban log itself isn't the issue, it is the actual samp.ban file that holds every banned player. And using (\r) was not the issue, and did not resolve my issue, sorry.
Reply
#4

Are they all on the line like this

pawn Код:
%s has been banned by %s. Reason: %s /n%s has been banned by %s. Reason: %s /n%s has been banned by %s. Reason: %s /n
or is it overwriting the first line each time?
Reply
#5

They are all on 1 line as stated by you.

Example:
Код:
***.***.***.*** [19/12/11 | 22:24:18] Name_Here - Reason_Here***.***.***.*** [19/12/11 | 22:24:18] Name_Here - Reason_Here
Reply
#6

New line isn't /n...it's \n

EDIT: scratch that since you tried that

I use dini and it usually creates a line for me...maybe you can try that? Like, create a new ban then read from it when a player connects
Reply
#7

try opening it in another program like notepad++
Reply
#8

Are you closing the file? (No offense, I have had weird things happen with not closing it properly)

If you are I am out of ideas, sorry I couldn't help.


Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
New line isn't /n...it's \n
Thanks for repeating what I said at the end of my first post......


EDIT: Two more ideas, try the \n at the start of the string, and is the original new string big enough?
Reply
#9

But adding \n to the string, wouldn't that still leave the timestamp on the same line?

EDIT: Example:
Код:
***.***.***.*** [19/12/11 | 22:24:18] Name_Here - Reason_Here***.***.***.*** [19/12/11 | 22:24:18] Name_Here - 
Reason_Here
Reply
#10

God dammit I've done it again... I'm not reading posts properly (MSN?)
Reply
#11

Quote:
Originally Posted by cessil
Посмотреть сообщение
try opening it in another program like notepad++
I second this. If you're using regular Notepad, it could very well be the issue.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)