[HELP]Server sends a client message and won't continue to login dialog
#1

When I try to login to my server now it will send me a message and then nothing will happen after that, it will just stay that way. I've concluded that the problem is under OnPlayerConnect but the problem is I'm not sure what to do to fix it. Here's the code that I believe is responsible for this strange error.

pawn Code:
public OnPlayerConnect(playerid)
{
    new banfile[64], ipstring[32], string[128];
    SendClientMessage(playerid, COLOR_DEADCONNECT, "|_Ban Check Started_|");
    SendClientMessage(playerid, COLOR_YELLOW, "Checking for bans...");
    GetPlayerIp(playerid, ipstring, sizeof(ipstring));
    format(banfile, sizeof(banfile),"SArcr/Users/Bans/%s.ban", ipstring);
    if(DOF2_FileExists(banfile)) {
        new banmsg[128];
        if(!strcmp(DOF2_GetString(banfile, "BanName"), PlayerName(playerid), true)) {
            SendClientMessage(playerid, COLOR_YELLOW, "====================================BANNED=====================================");
            SendClientMessage(playerid, COLOR_YELLOW, "This player name has been banned from [Sarcr]");
            format(banmsg, sizeof(banmsg), "Date of Ban: %s", dUser(PlayerName(playerid)).("BanDate"));
            SendClientMessage(playerid, COLOR_YELLOW, banmsg);
            format(banmsg, sizeof(banmsg), "Time of Ban: %s", dUser(PlayerName(playerid)).("BanTime"));
            SendClientMessage(playerid, COLOR_YELLOW, banmsg);
            format(banmsg, sizeof(banmsg), "Banned By: %s", dUser(PlayerName(playerid)).("BannedBy"));
            SendClientMessage(playerid, COLOR_YELLOW, banmsg);
            format(banmsg, sizeof(banmsg), "Banned For: %s", dUser(PlayerName(playerid)).("BanReason"));
            SendClientMessage(playerid, COLOR_YELLOW, banmsg);
            SendClientMessage(playerid, COLOR_YELLOW, "If you feel that this ban is a mistake, please make an appeal at www.sa-rcr.com");
            SendClientMessage(playerid, COLOR_YELLOW, "===============================================================================");
            Kick(playerid);
        }
        else {
            SendClientMessage(playerid, COLOR_YELLOW, "====================================BANNED=====================================");
            SendClientMessage(playerid, COLOR_YELLOW, "This IP Address has been banned from [Sarcr]");
            format(banmsg, sizeof(banmsg), "Date of Ban: %s", dUser(PlayerName(playerid)).("BanDate"));
            SendClientMessage(playerid, COLOR_YELLOW, banmsg);
            format(banmsg, sizeof(banmsg), "Time of Ban: %s", dUser(PlayerName(playerid)).("BanTime"));
            SendClientMessage(playerid, COLOR_YELLOW, banmsg);
            format(banmsg, sizeof(banmsg), "Banned By: %s", dUser(PlayerName(playerid)).("BannedBy"));
            SendClientMessage(playerid, COLOR_YELLOW, banmsg);
            format(banmsg, sizeof(banmsg), "Banned For: %s", dUser(PlayerName(playerid)).("BanReason"));
            SendClientMessage(playerid, COLOR_YELLOW, banmsg);
            SendClientMessage(playerid, COLOR_YELLOW, "If you feel that this ban is a mistake, please make an appeal at www.sa-rcr.com");
            SendClientMessage(playerid, COLOR_YELLOW, "===============================================================================");
            Kick(playerid);
        }
        return 1;
    }
    if(udb_Exists(PlayerName(playerid))) {
        if(dUserINT(PlayerName(playerid)).("Banned") == 1) {
            SendClientMessage(playerid, COLOR_YELLOW, "====================================BANNED=====================================");
            SendClientMessage(playerid, COLOR_YELLOW, "This player name has been banned from [Sarcr]");
            SendClientMessage(playerid, COLOR_YELLOW, "The data regarding this ban is unavailable.");
            SendClientMessage(playerid, COLOR_YELLOW, "If you feel that this is a mistake, please write an appeal at www.sa-rcr.com");
            SendClientMessage(playerid, COLOR_YELLOW, "===============================================================================");
            Kick(playerid);
        }
        ShowLoginScreen(playerid);
    }
    else if(!udb_Exists(PlayerName(playerid))) {
        ShowRegisterScreen(playerid);
    }
    SendClientMessage(playerid, COLOR_DEADCONNECT, "|_Ban Check Complete_|");
    SendClientMessage(playerid, COLOR_GREEN, "No Bans were found");
    // other stuff...
}
I will be adding some screens soon...
Reply
#2

When you try to log-in to the server? Do you mean when you type a command or respond to a dialog? If so, show the code that coorelates to it.
Reply
#3

At the stage where it says Connected to <Server Name>. It will say the message "Checking for bans..." and then nothing will happen. What should be happening is that if there were no bans then it would show the login dialog and state that there were no bans found. If a ban was found then it would state the date, time, reason and the admin who banned. The code I posted is what I believe to be the reason behind all of it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)