My 'OnPlayerLogin' doesn't execute ?
#1

It just doesn't execute on my host(Volt-Host), but does on my homehost.
Here's the code where is needs to be executed :
pawn Код:
if(dialogid == DIALOG_LOGIN) {
        if(response) {
            if(!strlen(inputtext)) {
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Welcome Back!\nEnter your password below.", "This account is registered.\n\nEnter your password below to login.", "Login", "Cancel");
                return 1;
            }
            else {
                new string[258];
                new name[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                format(string, sizeof(string), "users/%s.ini", name);
                new File: hFile = fopen(string, io_read);
                if (hFile) {
                    fclose(hFile);
                    OnPlayerLogin(playerid,inputtext);
                }
            }
        }
        else {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You chose not to login! (kicked).");
            Kick(playerid);
        }
    }
And here's the function:
pawn Код:
public OnPlayerLogin(playerid,password[])
{
    new string2[128], keystring[256], string[256];
    format(string2, sizeof(string2), "users/%s.ini", PlayerName(playerid));
    keystring = dini_Get(string2, "Key");
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    if(strcmp(keystring, password, true) == 0)
    {
....
I debugged the function and it stopped here
pawn Код:
keystring = dini_Get(string2, "Key");
Reply
#2

Oh comon, so much views and nothing ?
Reply
#3

Do you have the 'users' folder in your scriptfiles folder in your host?

Does the dialog respond when you press "Cancel" ?
Reply
#4

I have the 'users' folder, and it does respond when I press 'cancel'.
Reply
#5

Try just using fexist instead of open-check-close.
Reply
#6

What do you mean use fexist ? where excatly, if I'm checking if he wrote the password correctly ?
Reply
#7

No, I mean this:
pawn Код:
new File: hFile = fopen(string, io_read);
if (hFile) {
    fclose(hFile);
    OnPlayerLogin(playerid,inputtext);
}
pawn Код:
if(fexist(string))
    OnPlayerLogin(playerid, inputtext);
Sidenote: Your string size is much too big, considering that a player's name can only be 24 characters. A string size of 36 is more than enough.
Reply
#8

Fixed this.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)