Y_INI or Pawn
#1

Hi,

What's the better use Y_INI or original pawn for this check ban? (Call when the player connect in the server.)
Bans.txt is a file with many names, no key = val. so... original pawn is the best?
Код:
stock Ban(playerid)
{

    GetPlayerName(playerid,player,sizeof(player));
    file = fopen("Bans.txt",io_read);
    if (file)
    {
        while(fread(file,open,sizeof(open)))
        {
            if (strfind(open, player, true) != -1)
 	        {
	            SendClientMessage(playerid, ADMIN_RED, "You'r ban");
	            fclose(open);
                    Kick(playerid);
	            return 1;
	        }
    	}
    }
    fclose(file);
    return true;
}
thanks
Reply
#2

There is little difference, but you are more comfort using the native file functions, because you open the file, read everything in one hit, and close it. That is what y_INI does, but I can't tell if there is something faster than the /original/ function.
The file format is a point up.

So yes, you might want to use it. Also, I recommend replacing "strfind" with "strcmp"; if the player "John" is banned, for example, "John2" will be banned too.
Reply
#3

MySQL Ftw.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)