[HELP]Problem in Register Dialog System.[+REP]
#1

Hello everyone,
I have a serious problem today. When I made registery system and then made DS(DealerShip) sytem with dialog, it caused bugs cause when u press ESC in the DS Dialog, you get auto kicked from the server. After checking it for 2 days. I saw that the problem was because from the login/register system. Because in the end after long time editing, I got a dialog to enter my account password to login while i was already logged on. I need you to help me with fixing it cause i don't know how. And What I want to is to edit that when I press ESC or NO in the DS System, it doesn't cause me auto kicked from the server. Also, I want that when someone press ESC While register/login, the dialog shows about 10 times and then, he get auto kicked. + If he stay for more than 30 seconds = Kick.
Here is my Register/Login :
pawn Код:
if (gPlayerAccount[playerid] != 0)
        {
            new loginstring[256];
            new loginname[64];
            GetPlayerName(playerid,loginname,sizeof(loginname));
            format(loginstring,sizeof(loginstring),"{FFFFFF}Welcome, {6EF83C}%s {FFFFFF}!\n{FFFFFF}That nick is registered !\n{FFFFFF}Your last login time was to: {00C0FF}%s {FFFFFF}!\n{FFFFFF}You can now login:",loginname,dini_Get(LFile(playerid),"LoginDate"));
            ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
        }
        else
        {
            gPlayerAccount[playerid] = 0;
            new regstring[256];
            new regname[64];
            GetPlayerName(playerid,regname,sizeof(regname));
            format(regstring,sizeof(regstring),"{FFFFFF}Welcome, {F81414}%s {FFFFFF}!\n{FFFFFF}That nick is not registered !\nPlease register:",regname);
            ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
        }
And as I always do, I give +REP to all the people who helped me, and their help was useful !
Reply
#2

show ondialogresponse for registration/login and dealership
+ changing dialog ids for dialogs will fix kicking problem
Reply
#3

Quote:
Originally Posted by PMH
Посмотреть сообщение
show ondialogresponse for registration/login and dealership
+ changing dialog ids for dialogs will fix kicking problem
Here it is:
pawn Код:
if(dialogid == 12346 || dialogid == 12347)
        {
            if(strlen(inputtext))
            {
                new tmppass[64];
                strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
                OnPlayerLogin(playerid,tmppass);
            }
            else
            {
                new loginstring[256];
                new loginname[64];
                GetPlayerName(playerid,loginname,sizeof(loginname));
                format(loginstring,sizeof(loginstring),"Wrong Password\nPlease insert the correct password:",loginname);
                ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
                gPlayerLogTries[playerid] += 1;
                if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
            }
        }
        if(dialogid == 12345)
        {
            if(strlen(inputtext))
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "Users/%s.ini", sendername);
                new File: hFile = fopen(string, io_read);
                if (hFile)
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "That Username is already taken, please choose a different one");
                    fclose(hFile);
                    return 1;
                }
                new tmppass[64];
                strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
                OnPlayerRegister(playerid,tmppass);
            }
            else
            {
                new regstring[256];
                new regname[64];
                GetPlayerName(playerid,regname,sizeof(regname));
                format(regstring,sizeof(regstring),"{FFFFFF}Welcome, {FFFF00}%s\n{FFFFFF}You are not registred\n{FFFFFF}Please enter you registration password:",regname);
                ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
            }
Reply
#4

**BUMP**
Reply
#5

Show the whole code, some part of last dialog is missing
Reply
#6

Quote:
Originally Posted by PMH
Посмотреть сообщение
Show the whole code, some part of last dialog is missing
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new sendername[MAX_PLAYER_NAME];
    new string[256];
    if(dialogid == 8899)
    {
        if(response)
        {
            if(listitem == 0)
            {
                // Blue
                SetPVarInt(playerid, "Status", 1);
                SetPVarInt(playerid, "neon1", CreateObject(18648,0,0,0,0,0,0));
                SetPVarInt(playerid, "neon2", CreateObject(18648,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "neon1"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(GetPVarInt(playerid, "neon2"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                SendClientMessage(playerid, 0xFFFFFFAA, "Neon Shop: Neon Blue installed");
                GivePlayerMoney(playerid, - 1000);
                GameTextForPlayer(playerid, "~w~-~r~1.000~g~$", 5000, 1);
            }
            if(listitem == 1)
            {
                // Red
                SetPVarInt(playerid, "Status", 1);
                SetPVarInt(playerid, "neon3", CreateObject(18647,0,0,0,0,0,0));
                SetPVarInt(playerid, "neon4", CreateObject(18647,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "neon3"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(GetPVarInt(playerid, "neon4"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                SendClientMessage(playerid, 0xFFFFFFAA, "Neon Shop: Neon Red installed");
                GivePlayerMoney(playerid, - 1000);
                GameTextForPlayer(playerid, "~w~-~r~1.000~g~$", 5000, 1);
            }
            if(listitem == 2)
            {
                // Green
                SetPVarInt(playerid, "Status", 1);
                SetPVarInt(playerid, "neon5", CreateObject(18649,0,0,0,0,0,0));
                SetPVarInt(playerid, "neon6", CreateObject(18649,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "neon5"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(GetPVarInt(playerid, "neon6"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                SendClientMessage(playerid, 0xFFFFFFAA, "Neon Shop: Neon Green installed");
                GivePlayerMoney(playerid, - 1000);
                GameTextForPlayer(playerid, "~w~-~r~1.000~g~$", 5000, 1);
            }
            if(listitem == 3)
            {
                // White
                SetPVarInt(playerid, "Status", 1);
                SetPVarInt(playerid, "neon7", CreateObject(18652,0,0,0,0,0,0));
                SetPVarInt(playerid, "neon8", CreateObject(18652,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "neon7"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(GetPVarInt(playerid, "neon8"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                SendClientMessage(playerid, 0xFFFFFFAA, "Neon Shop: Neon White installed");
                GivePlayerMoney(playerid, - 1000);
                GameTextForPlayer(playerid, "~w~-~r~1.000~g~$", 5000, 1);
            }
            if(listitem == 4)
            {
                // Pink
                SetPVarInt(playerid, "Status", 1);
                SetPVarInt(playerid, "neon9", CreateObject(18651,0,0,0,0,0,0));
                SetPVarInt(playerid, "neon10", CreateObject(18651,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "neon9"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(GetPVarInt(playerid, "neon10"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                SendClientMessage(playerid, 0xFFFFFFAA, "Neon Shop: Neon Pink installed");
                GivePlayerMoney(playerid, - 1000);
                GameTextForPlayer(playerid, "~w~-~r~1.000~g~$", 5000, 1);
            }
            if(listitem == 5)
            {
                // Yellow
                SetPVarInt(playerid, "Status", 1);
                SetPVarInt(playerid, "neon11", CreateObject(18650,0,0,0,0,0,0));
                SetPVarInt(playerid, "neon12", CreateObject(18650,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "neon11"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(GetPVarInt(playerid, "neon12"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                SendClientMessage(playerid, 0xFFFFFFAA, "Neon Shop: Neon Yellow installed");
                GivePlayerMoney(playerid, - 1000);
                GameTextForPlayer(playerid, "~w~-~r~1.000~g~$", 5000, 1);
            }
            if(listitem == 6)
            {
                // Removed Neon
                DestroyObject(GetPVarInt(playerid, "neon1"));
                DeletePVar(playerid, "Status");
                DestroyObject(GetPVarInt(playerid, "neon2"));
                DeletePVar(playerid, "Status");
                DestroyObject(GetPVarInt(playerid, "neon3"));
                DeletePVar(playerid, "Status");
                DestroyObject(GetPVarInt(playerid, "neon4"));
                DeletePVar(playerid, "Status");
                DestroyObject(GetPVarInt(playerid, "neon5"));
                DeletePVar(playerid, "Status");
                DestroyObject(GetPVarInt(playerid, "neon6"));
                DeletePVar(playerid, "Status");
                DestroyObject(GetPVarInt(playerid, "neon7"));
                DeletePVar(playerid, "Status");
                DestroyObject(GetPVarInt(playerid, "neon8"));
                DeletePVar(playerid, "Status");
                DestroyObject(GetPVarInt(playerid, "neon9"));
                DeletePVar(playerid, "Status");
                DestroyObject(GetPVarInt(playerid, "neon10"));
                DeletePVar(playerid, "Status");
                DestroyObject(GetPVarInt(playerid, "neon11"));
                DeletePVar(playerid, "Status");
                DestroyObject(GetPVarInt(playerid, "neon12"));
                DeletePVar(playerid, "Status");
                SendClientMessage(playerid, 0xFFFFFFAA, "Neon Shop: All neon removed");
                GivePlayerMoney(playerid, - 5000);
                GameTextForPlayer(playerid, "~w~-~r~5.000~g~$", 5000, 1);
            }
        }
    }
    if(response)
    {
        if(dialogid == 12346 || dialogid == 12347)
        {
            if(strlen(inputtext))
            {
                new tmppass[64];
                strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
                OnPlayerLogin(playerid,tmppass);
            }
            else
            {
                new loginstring[256];
                new loginname[64];
                GetPlayerName(playerid,loginname,sizeof(loginname));
                format(loginstring,sizeof(loginstring),"Wrong Password\nPlease insert the correct password:",loginname);
                ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
                gPlayerLogTries[playerid] += 1;
                if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
            }
        }
        if(dialogid == 12345)
        {
            if(strlen(inputtext))
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "Users/%s.ini", sendername);
                new File: hFile = fopen(string, io_read);
                if (hFile)
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "That Username is already taken, please choose a different one");
                    fclose(hFile);
                    return 1;
                }
                new tmppass[64];
                strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
                OnPlayerRegister(playerid,tmppass);
            }
            else
            {
                new regstring[256];
                new regname[64];
                GetPlayerName(playerid,regname,sizeof(regname));
                format(regstring,sizeof(regstring),"{FFFFFF}Welcome, {FFFF00}%s\n{FFFFFF}You are not registred\n{FFFFFF}Please enter you registration password:",regname);
                ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
            }
        }
    }
    else
    {
        Kick(playerid);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)