Loop problems
#1

Guys my command instantly open 50 lines of "reason" I wrote in command, how can I make that it will write only 1 line for 1 crime?

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);
        format(string, sizeof(string), "Crime%d", i);  
        INI_WriteString(File,string,CrimeReasons[id][i]);
    }
    INI_Close(File);//Closing yini file
    return 1;
}
Reply
#2

Don't loop then, you're obviously looping 50 times! Why would you loop? You only need one insert to add a crime
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)