Reading EVERYTHING from a file
#7

pawn Code:
new File:FName = fopen("Forbidden/ForbiddenNames.txt", io_read);
new ForbiddenNames[100];
while(fread(FName, ForbiddenNames)) //Reads the file line-by-line -> https://sampwiki.blast.hk/wiki/Fread
{
        //printf(ForbiddenNames);
        strdel(ForbiddenNames, strfind(ForbiddenNames, "\r\n", false), strfind(ForbiddenNames, "\r\n", false)+4)); //Deletes the "New line" (\r\n) from the string
        if(strfind(GetName(playerid), ForbiddenNames, true) != -1) //Searchs the forbidden word
        {
                SendClientMessage(playerid, COLOR_ORANGE, " ** We found a forbidden word in your name! Please remove it and re-connect. ");
                Kick(playerid); //Kick xD
        }
}
fclose(FName);
Try using that code
Reply


Messages In This Thread
Reading EVERYTHING from a file - by Wesley221 - 10.09.2011, 13:59
Re: Reading EVERYTHING from a file - by Darnell - 10.09.2011, 14:12
Re: Reading EVERYTHING from a file - by Wesley221 - 10.09.2011, 14:16
Re: Reading EVERYTHING from a file - by Basicz - 10.09.2011, 14:18
Re: Reading EVERYTHING from a file - by Wesley221 - 10.09.2011, 14:21
Re: Reading EVERYTHING from a file - by Wesley221 - 10.09.2011, 16:36
Respuesta: Re: Reading EVERYTHING from a file - by OPremium - 10.09.2011, 17:39
Re: Reading EVERYTHING from a file - by Wesley221 - 10.09.2011, 17:44
Re: Reading EVERYTHING from a file - by [M]onsieur - 10.09.2011, 18:00
Re: Reading EVERYTHING from a file - by Sasino97 - 10.09.2011, 19:28

Forum Jump:


Users browsing this thread: 1 Guest(s)