Client "loses connection" and has to reconnect 3 or 4 times
#1

Hello,

When i join my server, the client will lose connection 3 or 4 times before actually doing the part of the script its supposed to (banned check).
After some debugging i found the problem, but i'm not quite sure how i would go about fixing this.

Cause:
pawn Code:
if(mysql_retrieve_row())
{
    mysql_fetch_field_row(date, "Date");
    mysql_fetch_field_row(time, "Time");
    mysql_fetch_field_row(reason, "Reason");
}
Reply
#2

I seemed to have this issue once when using a certain MySQL plugin causing client connections to drop out presumably causing the thread that the network layer is running on to become unstable since the scripting aspects of the server still appeared operational. Have you tried using other MySQL plugins?
Reply
#3

I would use StrickenKid's but I feel it to be a little outdated.
Reply
#4

Try threading your queries, so that other things can be processed at the same time as the query is .
Reply
#5

How do i do that?
Reply
#6

After some debugging and fixing. The problem appears to have moved, and i cant work out whats wrong.

pawn Code:
if(strcmp(GetName(playerid), username, true) == 0)
{
    format(message, 128, "%s %s at %s", GetName(playerid), date, time);
    SendClientMessage(playerid, COLOR_DARKRED, message);
    format(message, 128, "%s", reason);
    SendClientMessage(playerid, COLOR_DARKRED, message);
    Kick(playerid);
}
else if(strcmp(Address, ipaddress, true) == 0)
{
    format(message, 128, "%s at %s", date, time);
    SendClientMessage(playerid, COLOR_DARKRED, message);
    format(message, 128, "%s", reason);
    SendClientMessage(playerid, COLOR_DARKRED, message);
    Kick(playerid);
}
else
{
    SendClientMessage(playerid, COLOR_DARKRED, "I am an error! Please report me on the forums.");
}
I don't get any messages when i connect.
Then the client will "lose connection" and continue to do so 3 or 4 times before maintaining a stable connection and sending me the messages..

EDIT: Sorry for double post
EDIT 2: If i include ANY SendClientMessage. The client will lose connection
EDIT 3: Since couldnt find a fix, and if i commented ANYTHING out, the problem went away, I have just added everything that would normally go in OnPlayerConnect to a timer and now everything is fine (for now)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)