loop break
#1

Guys with this command it instantly saves me 50 (I have set limit to 50) lines of same reason I insert in command
So the question is how can I make that it will save it to only 1 line when I execute the command?

pawn Код:
#define LIMIT 50
new CrimeReasons[MAX_PLAYERS][LIMIT];
pawn Код:
CMD:makewanted(playerid,params[])
{
    new id, reason[80], string[50];
    if(sscanf(params, "us[80]",id ,reason)) return SendClientMessage(playerid,-1,"USAGE: REPORT <PlayerID/Part of Name> <Reason>");
    new INI:File = INI_Open(UserPath(id));
    for(new i;i<LIMIT;i++)
    {
        format(CrimeReasons[id][i],128,reason); // Params is the crime reason maybe you already have it formated then use the name of formated string
        format(string, sizeof(string), "Crime%d", i);  //To save in yini Crime1=50
        INI_WriteString(File,string,CrimeReasons[id][i]); // string and the crime reason being written
    }
    INI_Close(File);//Closing yini file
    return 1;
}
Reply
#2

Just add a "break;" under INI_WriteString(File,string,CrimeReasons[id][i]);
Reply
#3

With this it doesn't make new line in player's file it keeps re-writing only 1 Crime that was saved in file, I want to make each crime = new line in player's saving file.
Reply
#4

Maybe that's because you only have one crime ? even though it should write the crimeX, what's in the INI file and are you sure it's the right one ?

also how much is "LIMIT" ?
Reply
#5

I'm using this:

pawn Код:
#define LIMIT 50
new CrimeReasons[MAX_PLAYERS][LIMIT];
Reply
#6

Quote:
Originally Posted by Lajko1
Посмотреть сообщение
So the question is how can I make that it will save it to only 1 line when I execute the command?
Wait what are you trying to do ? Save them all in one line, I think that's impossible (or hard to do) using files
Reply
#7

I told this many times, all I want to do is command /makewanted (id) (reason) which will save the crime to new line when I will use the command... so in my saving file it would look like this:

Crime0: Test1
Crime1: Test2
Crime2: Test3
Reply
#8

Still need help with that..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)