Need help with this.
#1

Hello. I got a problem. At OnPlayerConnect, the server gets the player's name and stores the string in the variable 'Gpd', It now opens the file 'PK_List.txt' and searches for the string line-by-line. If the player's name exists in the file, it kicks the player. The problem I am having is that the server too kicks players which are not in the list. What to do?

pawn Код:
public OnPlayerConnect(playerid)
{
    new Gpd[MAX_PLAYER_NAME], str[64];
    GetPlayerName(playerid, Gpd, sizeof Gpd);
    new File:wtf = fopen("PK_List.txt", io_read);
    while(fread(wtf, Gpd))
    {
        if(strcmp(str, Gpd, true) == 0)
        {
            SendClientMessage(playerid, -1, "This player is killed in the war. This player cant be playable. Chage your name to something else.");
            SetTimer("__Kick", 80, false);
        }
    }
    fclose(wtf);
    return 1;
}
Reply
#2

Hmm try to use strfind..

Код:
 if(strfind(str,Gpd) != -1)
or just change your to this

Код:
 if(strcmp(str, Gpd, false) == 0)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)