Kicks Player For No Reason
#1

Hello,

I got my server working again which I downloaded from SAMP. It allows new players to register and then the screen fades black, About 2 seconds in, Right before the screen is supposed to fade back out I get the "Server Closed The Connection" Message.

It is really bugging me. I checked the public OnPlayerRegister etc and there is nothing to do with KickEx or Kick(playerid);.

There was one where if the the Hacked=1 or something it would kick but I commented it out but still no luck.

This is the function that is called when a player connects and registers:

pawn Код:
public OnPlayerRegister(playerid, password[])
{
    if(IsPlayerConnected(playerid))
    {
        new string[128], passwordex[128];
        format(string, sizeof(string), "users/%s.ini", PlayerName(playerid));
        if(!DOF2_FileExists(string))
        {
            DOF2_CreateFile(string);
            format(passwordex, 128, "%s", password);
            Hash(passwordex);
            DOF2_SetString(string, "Key", passwordex);
            DOF2_SetInt(string, "Convert", 5);
            DOF2_SetInt(string, "Hashed", 1);
            DOF2_SetFloat(string, "PosX", 1642.7285);
            DOF2_SetFloat(string, "PosY", -2240.5591);
            DOF2_SetFloat(string, "PosZ", 13.4945);
            DOF2_WriteFile();
            CallRemoteFunction("OnPlayerLogin","is",playerid,password);
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "Unable to register, account exists.");
            KickEx(playerid);
        }
    }
    return 1;
}
This is OnPlayerLogin:

pawn Код:
DeletePVar(playerid,"CameraPos");
        DeletePVar(playerid,"CameraDelay");
        FadeTime[playerid]=0;
        FadeScreen(playerid, 1);
        ClearChatbox(playerid,50);
        SetPVarInt(playerid,"PlayerLogged",2);
        SetPVarInt(playerid, "AfkMark", 0);
        //if(GetPVarInt(playerid, "HouseKey2") > 1000 || GetPVarInt(playerid, "HouseKey2") < 1) SetPVarInt(playerid, "HouseKey2", 1000);
        //if(GetPVarInt(playerid, "SpouseKey") > 1 || GetPVarInt(playerid, "SpouseKey") < 0) SetPVarInt(playerid, "SpouseKey", 0);
        // Admin Login //
        if(DOF2_GetInt(string, "Admin") >= 1 && AdminUser(playerid)) ShowPlayerDialog(playerid,140,DIALOG_STYLE_PASSWORD,"Admin Login","Please login to your admin account.","Login", "");
That is the last snippet of it, The rest are just PlayerInfo[playerid] stuff.

- REP+ for the solution because I'm desprate!

EDIT: All accounts that were made before the bug occurred can still be logged in and it works for them but just for new players who are registering it decides not to.
Reply
#2

Make a debug with printf, to know where in the code is the problem.
Reply
#3

Could you explain, Please. Sorry.
Reply
#4

https://sampwiki.blast.hk/wiki/Debugging
Reply
#5

Remove KickEx(playerid);.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)