Auto Kick Issue
#1

Basically, I've made 3 Dialogs
Dialog ID 1 - Login,
Dialog ID 2 - Register,
Dialog ID 111 - Terms and Roles
When I press on the 'case 1' button of the Dialog 1111 It kicks me out of the server as in the stated picture.
I want to know why do I prolly get kicked without anything related.



pawn Код:
if(dialogid == 1111) // Terms and Roles
    {
        if(response) //BUTTON 1
        {
        if(gPlayerAccount[playerid] == 1)
        {
        DisplayDialogForPlayer(playerid, 1);
        SendClientMessage(playerid, COLOR_YELLOW, "{248B10}Database: {FFFFFF}This player-file is loading, please login.");
        }
        else
        {
        DisplayDialogForPlayer(playerid, 2);
        SendClientMessage(playerid, COLOR_YELLOW, "{248B10}Database: {FFFFFF}We do not have an account by this name to be loaded, please register to proceed to our Tutorial.");
        }

    }
        else
        {
        SendClientMessage(playerid, 0xFF0000FF, "You rejected our Terms and Roles and have been kicked as a result.");
        Kick(playerid);
        }
    }
pawn Код:
if(dialogid == 2) //REGISTER
    {
        if(gPlayerLogged[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
            return 1;
        }
        if(response)
        {
            if(strlen(inputtext) >= 50)
            {
                DisplayDialogForPlayer(playerid, 2); //register
                SendClientMessage(playerid, COLOR_WHITE, "SERVER: Password is too long.");
                return 0;
            }
            new sendername[MAX_PLAYER_NAME];
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new namestring = strfind(sendername, " ", true);
            if(namestring == -1)
            {
                SendClientMessage(playerid, COLOR_YELLOW, "Your name must be in the Firstname_Lastname format.");
                Kick(playerid);
                return 1;
            }
            else
            {
                if(!strlen(inputtext))
                {
                    DisplayDialogForPlayer(playerid, 2); //register
                    SendClientMessage(playerid, COLOR_WHITE, "SERVER: You must enter a password.");
                    return 1;
                }
                new string[MAX_STRING];
                format(string, sizeof(string), SAVE_USERS, sendername);
                if(dini_Exists(string))
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "That name is already taken, please choose a different one.");
                    return 1;
                }
                new tmppass[64];
                strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
                Encrypt(tmppass);
                OnPlayerRegister(playerid,tmppass);
                OnPlayerLogin(playerid,tmppass);
                gPlayerAccount[playerid] = 1;
                gPlayerSpawned[playerid] = 1;
                new stringno2[256];
                for (new i = 0; i < sizeof(CounterInfo); i++)
                {
                    CounterInfo[i][Registers] = CounterInfo[i][Registers]+1;
                    format(stringno2,sizeof(stringno2),"{248B10}Database: {FFFFFF}This account has been registered and saved to our database player-files.");
                    SendClientMessage(playerid, COLOR_YELLOW, stringno2);
                }
                OnCounterUpdate();
            }
        }
        else
        {
            DisplayDialogForPlayer(playerid, 2); //register
        }
    }
pawn Код:
if(dialogid == 1) //LOGIN
    {
        if(gPlayerLogged[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
            return 1;
        }
        if(response)
        {
            if(!strlen(inputtext))
            {
                DisplayDialogForPlayer(playerid, 1); //login
                SendClientMessage(playerid, COLOR_WHITE, "SERVER: You must enter a password.");
                return 1;
            }
            if(strlen(inputtext) >= 50)
            {
                DisplayDialogForPlayer(playerid, 1); //login
                SendClientMessage(playerid, COLOR_WHITE, "SERVER: Password is too long.");
                return 0;
            }
            new tmppass[64];
            //Store Player ID & TMP pass in echo to find string used to crash server
            new playername[MAX_PLAYER_NAME];
            strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
            GetPlayerName(playerid, playername, sizeof(playername));
            Encrypt(tmppass);
            OnPlayerLogin(playerid,tmppass);
        }
        else
        {
            DisplayDialogForPlayer(playerid, 1); //login
        }
    }
Reply
#2

try to indent it correctly
pawn Код:
if(dialogid == 1111) // Terms and Roles
{
    if(response) //BUTTON 1
    {
        if(gPlayerAccount[playerid] == 1)
        {
            DisplayDialogForPlayer(playerid, 1);
            SendClientMessage(playerid, COLOR_YELLOW, "{248B10}Database: {FFFFFF}This player-file is loading, please login.");
        }
        else
        {
            DisplayDialogForPlayer(playerid, 2);
            SendClientMessage(playerid, COLOR_YELLOW, "{248B10}Database: {FFFFFF}We do not have an account by this name to be loaded, please register to proceed to our Tutorial.");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000FF, "You rejected our Terms and Roles and have been kicked as a result.");
        Kick(playerid);
    }
}

if you hit the second button the youll be kicked
just indenting your code will make it more clear to you.
Reply
#3

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
try to indent it correctly
pawn Код:
if(dialogid == 1111) // Terms and Roles
{
    if(response) //BUTTON 1
    {
        if(gPlayerAccount[playerid] == 1)
        {
            DisplayDialogForPlayer(playerid, 1);
            SendClientMessage(playerid, COLOR_YELLOW, "{248B10}Database: {FFFFFF}This player-file is loading, please login.");
        }
        else
        {
            DisplayDialogForPlayer(playerid, 2);
            SendClientMessage(playerid, COLOR_YELLOW, "{248B10}Database: {FFFFFF}We do not have an account by this name to be loaded, please register to proceed to our Tutorial.");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000FF, "You rejected our Terms and Roles and have been kicked as a result.");
        Kick(playerid);
    }
}

if you hit the second button the youll be kicked
just indenting your code will make it more clear to you.
This probably didn't help AT ALL, and I know that if I hit the second button I'll be kicked
I am saying when I hit the 'FIRST' button, I get kicked.
Reply
#4

This is what happens when you try to edit the SA-RP script.

If this mode is on 0.3e, and if you'd have ******d "kicked on spawn samp".

You would've discovered that there was a bug in 0.3d that kicked players on spawn without SetSpawnInfo being called.

Use it.
Reply
#5

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
This is what happens when you try to edit the SA-RP script.

If this mode is on 0.3e, and if you'd have ******d "kicked on spawn samp".

You would've discovered that there was a bug in 0.3d that kicked players on spawn without SetSpawnInfo being called.

Use it.
so how am I supposed to fix?
Reply
#6

Read my post, somewhere in your script, you are calling SpawnPlayer before SetSpawnInfo.

Either that, or one of the variables is allowing the code that kicks you to run.

Use SetSpawnInfo before calling SpawnPlayer.
Reply
#7

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
Read my post, somewhere in your script, you are calling SpawnPlayer before SetSpawnInfo.

Either that, or one of the variables is allowing the code that kicks you to run.

Use SetSpawnInfo before calling SpawnPlayer.
Nevermind just used SafeSpawn in an enum. Thanks btw.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)