Login system fucked!
#1

I was scripting and I went to test, Everything worked fine but after I tested and went back to scripting and re-tested the whole of the login system glitched. When you click login, It sometime's spawns you correctly or it does the bug that's in the screen shot below.



Codes:

pawn Код:
//Request Class
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);

//Onplayerconnect
new string[128];
    format(string, sizeof(string), "Users/%s.ini", PlayerName(playerid));
                if(!DOF2_FileExists(string))
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "{CC0000}Please Register", "Panda Life Roleplay\t\t\t\tIP::~~~~~\nIt seems like you are not registered at are server please register.", "Register", "Cancel");
    }
    if(DOF2_FileExists(string))
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "{CC0000}Please Login", "Panda Life Roleplay\t\t\t\tIP::~~~~~\nYou are registered, type your password to login.", "Login", "Cancel");
    }

//Ondialog
switch( dialogid ) // register
    {
        case 1:
        {
            new string[128];
            new plrIP[16];
            format(string, sizeof(string), "Users/%s.ini", PlayerName(playerid));
            if(!response) return Kick(playerid);
            if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "{CC0000}Please Register", "Panda Life Roleplay\t\t\t\tIP::~~~~~\nIt seems like you are not registered at are server please register.", "Register", "Cancel");
            DOF2_CreateFile(string);
            DOF2_SetInt(string, "Key", udb_hash(inputtext));
            DOF2_SetInt(string, "Cash", 100);
            DOF2_SetInt(string, "Bank", 0);
            DOF2_SetInt(string, "JobID", 501);
            DOF2_SetInt(string, "Admin", 0);
            DOF2_SetFloat(string, "PosX", 674.3223);
            DOF2_SetFloat(string, "PosY", -474.4951);
            DOF2_SetFloat(string, "PosZ", 16.5363);
            GetPlayerIp(playerid,plrIP, sizeof(plrIP));
            DOF2_SetString(string, "IP", plrIP);
            DOF2_WriteFile();
            SetPVarInt(playerid, "PlayerJob", 501);
            SetPVarFloat(playerid, "PosX", DOF2_GetFloat(string, "PosX"));
            SetPVarFloat(playerid, "PosY", DOF2_GetFloat(string, "PosY"));
            SetPVarFloat(playerid, "PosZ", DOF2_GetFloat(string, "PosZ"));
            SetPVarInt(playerid, "PlayerCash", 100);
            SetPVarInt(playerid, "PlayerPayCheck", 1000);
            SetPVarInt(playerid, "PlayerLogged",1);
            OnPlayerSaveData(playerid);
            SetSpawnInfo(playerid, 0, 120, GetPVarFloat(playerid, "PosX"), GetPVarFloat(playerid, "PosY"), GetPVarFloat(playerid, "PosZ"), 0, 0, 0, 0, 0, 0, 0 );
            SpawnPlayer(playerid);
        }
    }
    switch( dialogid ) //login
    {
        case 2: // login
        {
            new string[128];
            format(string, sizeof(string), "Users/%s.ini", PlayerName(playerid));
            if(!response) return Kick(playerid);
            if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "{CC0000}Please Login", "Panda Life Roleplay\t\t\t\tIP::~~~~~\nYou are registered, type your password to login.", "Login", "Cancel");
            new tmp;
            tmp = DOF2_GetInt(string, "Key");
            if(udb_hash(inputtext) != tmp) {
                SendClientMessage(playerid, COLOR_RED, "Wrong Password, try again.");
                ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "{CC0000}Logging......", "Panda Life Roleplay\t\t\t\tIP::~~~~~\n{CC0000}WRONG PASSWORD\n{CC0000}Type in your password correctly to continue.", "Login", "Cancel");
            }
            else {
                OnPlayerLoadData(playerid);
                SendClientMessage(playerid, 0x42F3F198, "Welcome back to Panda Life Roleplay.");
                SetPVarInt(playerid, "PlayerLogged",1);
            }
        }
    }
Reply
#2

try this if it is work

Quote:

SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);

Reply
#3

Quote:
Originally Posted by ScripteRNaBEEL
Посмотреть сообщение
try this if it is work
It's ment to spawn the player at his last cord's when he log's in but instead it spawns him now and then at the request player class spot. If the player get's his password correct the first time, It spawns at the request class spot, But if he get's it wrong then correct it spawn's him properly and I don't get why.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)