Register System Problem (Simple Click here).
#1

Alright hey guys!

I just did what Lorenc wrote in his tutorial..

And for there is no errors/warnings.

When i just connect it shows me the Register dialog.

And when i enter the password in that dialog after that nothing.

And i got everything correct + save file is there.

Here's my code:

pawn Код:
enum pInfo
{
    pAdminLevel,
    pCash,
    pKills,
    pDeaths,
    pPass,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
And after that this:

pawn Код:
#define SERVER_USER_FILE "Users/%s.ini"
OnPlayerConnect:

pawn Код:
gPlayerLogged[playerid] = 0;
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if (!dini_Exists(file))
    {
        ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "{00FF00}Register Account.", "{00FF00}Welcome {F88017}to {FF0000}'FlatronX Gaming Offical [.R.U.] Server'\n\nPlease {00FF00}'Register' {F88017}your {00FF00}'Account' {F88017}to get started.", "Register", "Later");
    }
    if(fexist(file))
    {
        ShowPlayerDialog(playerid, 7407, DIALOG_STYLE_INPUT, "{00FF00}Succes!", "Thank you for regestering an {00FF00}'Account'..\n\n{F88017}Now its your wish to {00FF00}'Login' {F88017}your {00FF00}'Account' {F88017}or {FF0000}NOT.", "Login", "Later");
    }
OnPlayerDisconnect:

pawn Код:
new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "Kills", PlayerInfo[playerid][pKills]);
        dini_IntSet(file, "Deaths", PlayerInfo[playerid][pDeaths]);
        dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
        dini_IntSet(file, "Password", PlayerInfo[playerid][pPass]);
    }
    gPlayerLogged[playerid] = 0;
And OnDialogResponse:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1)
    {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You skiped to register, Please type '/Register' to receive the dialog again.");
        if (!strlen(inputtext)) return
        ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "{00FF00}Register Account.", "{00FF00}Welcome {F88017}to {FF0000}'FlatronX Gaming Offical [.R.U.] Server'\n\nPlease {00FF00}'Register' {F88017}your {00FF00}'Account' {F88017}to get started.", "Register", "Later");
        dini_IntSet(file, "Password", udb_hash(inputtext));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
        dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
        dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills] = 0);
        dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths] = 0);
        format(string, 2134, "Server: You {00FF00}'Succesfully Registered' {F88017}the {FF0000}'Nickname' %s {F88017}with {00FF00}'Password' %s.. You also been autologged in.", name, inputtext);
        SendClientMessage(playerid, 0xF88017FF, string);
        gPlayerLogged[playerid] = 1;
    }
    if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "{00FF00}Register Account.", "{00FF00}Welcome {F88017}to {FF0000}'FlatronX Gaming Offical [.R.U.] Server'\n\nPlease {00FF00}'Register' {F88017}your {00FF00}'Account' {F88017}to get started.", "Register", "Later");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
            SendClientMessage(playerid, 0xFF0000FF, "The password you entered is 'Incorrect'.");
            ShowPlayerDialog(playerid, 7407, DIALOG_STYLE_INPUT, "{00FF00}Succes!", "Thank you for regestering an {00FF00}'Account'..\n\n{F88017}Now its your wish to {00FF00}'Login' {F88017}your {00FF00}'Account' {F88017}or {FF0000}NOT.", "Login", "Later");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            PlayerInfo[playerid][pDeaths] = dini_Int(file, "Deaths");
            SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
            GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
            SendClientMessage(playerid,0x00FF00FF, "[SYSTEM]: Successfully logged in!");
        }
    }
    return 1;
}
You can test it too, and see there is no errors or anything but it just does not work.


So please fix it for me.

I really don't understand this.

Thanks.

Davz~
Reply
#2

What makes you think that it doesn't work?

Did you create the 'Users' folder in scriptfiles?
Reply
#3

Look i already did that

pawn Код:
#define SERVER_USER_FILE "Users/%s.ini"
You think i am wrong? I dont think dude, Come to my server: 94.23.146.149:9100 and see
Reply
#4

you dont create a dini file by register
Reply
#5

try
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1)
    {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You skiped to register, Please type '/Register' to receive the dialog again.");
        if (!strlen(inputtext)) return
        ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "{00FF00}Register Account.", "{00FF00}Welcome {F88017}to {FF0000}'FlatronX Gaming Offical [.R.U.] Server'\n\nPlease {00FF00}'Register' {F88017}your {00FF00}'Account' {F88017}to get started.", "Register", "Later");
        dini_Create(file);
        dini_IntSet(file, "Password", udb_hash(inputtext));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
        dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
        dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills] = 0);
        dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths] = 0);
        format(string, 2134, "Server: You {00FF00}'Succesfully Registered' {F88017}the {FF0000}'Nickname' %s {F88017}with {00FF00}'Password' %s.. You also been autologged in.", name, inputtext);
        SendClientMessage(playerid, 0xF88017FF, string);
        gPlayerLogged[playerid] = 1;
    }
    if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "{00FF00}Register Account.", "{00FF00}Welcome {F88017}to {FF0000}'FlatronX Gaming Offical [.R.U.] Server'\n\nPlease {00FF00}'Register' {F88017}your {00FF00}'Account' {F88017}to get started.", "Register", "Later");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
            SendClientMessage(playerid, 0xFF0000FF, "The password you entered is 'Incorrect'.");
            ShowPlayerDialog(playerid, 7407, DIALOG_STYLE_INPUT, "{00FF00}Succes!", "Thank you for regestering an {00FF00}'Account'..\n\n{F88017}Now its your wish to {00FF00}'Login' {F88017}your {00FF00}'Account' {F88017}or {FF0000}NOT.", "Login", "Later");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            PlayerInfo[playerid][pDeaths] = dini_Int(file, "Deaths");
            SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
            GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
            SendClientMessage(playerid,0x00FF00FF, "[SYSTEM]: Successfully logged in!");
        }
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by Tigerkiller
Посмотреть сообщение
you dont create a dini file by register
You don't create a script with Dini PERIOD. This is what GF is for (but I'm not assuming it is an RP). Upgrade to a newer system.
Reply
#7

Ah dude, that tutorial is really old. Try with a newer one. Also did you made a folder called USERS in the scriptfiles ?
Reply
#8

You had wrong dialogid's here.
Correct:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 2196)
    {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You skiped to register, Please type '/Register' to receive the dialog again.");
        if (!strlen(inputtext)) return
        ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "{00FF00}Register Account.", "{00FF00}Welcome {F88017}to {FF0000}'FlatronX Gaming Offical [.R.U.] Server'\n\nPlease {00FF00}'Register' {F88017}your {00FF00}'Account' {F88017}to get started.", "Register", "Later");
        dini_Create(file);
        dini_IntSet(file, "Password", udb_hash(inputtext));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
        dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
        dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills] = 0);
        dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths] = 0);
        format(string, 2134, "Server: You {00FF00}'Succesfully Registered' {F88017}the {FF0000}'Nickname' %s {F88017}with {00FF00}'Password' %s.. You also been autologged in.", name, inputtext);
        SendClientMessage(playerid, 0xF88017FF, string);
        gPlayerLogged[playerid] = 1;
    }
    if (dialogid == 7407)
    {
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "{00FF00}Register Account.", "{00FF00}Welcome {F88017}to {FF0000}'FlatronX Gaming Offical [.R.U.] Server'\n\nPlease {00FF00}'Register' {F88017}your {00FF00}'Account' {F88017}to get started.", "Register", "Later");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
            SendClientMessage(playerid, 0xFF0000FF, "The password you entered is 'Incorrect'.");
            ShowPlayerDialog(playerid, 7407, DIALOG_STYLE_INPUT, "{00FF00}Succes!", "Thank you for regestering an {00FF00}'Account'..\n\n{F88017}Now its your wish to {00FF00}'Login' {F88017}your {00FF00}'Account' {F88017}or {FF0000}NOT.", "Login", "Later");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            PlayerInfo[playerid][pDeaths] = dini_Int(file, "Deaths");
            SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
            GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
            SendClientMessage(playerid,0x00FF00FF, "[SYSTEM]: Successfully logged in!");
        }
    }
    return 1;
}
Reply
#9

HE DONT CREATE THE USERFILE ON REGISTER! SO ALL THE TIMES COMES REGISTER DIALOG!
Reply
#10

Quote:
Originally Posted by Tigerkiller
Посмотреть сообщение
HE DONT CREATE THE USERFILE ON REGISTER! SO ALL THE TIMES COMES REGISTER DIALOG!
Yes, also that, but this is not the only problem in the code.

Also: caps off, you are not in a rock band performing a screamo.
Reply
#11

I recommend you to use a newer version of reading and writing files, which is faster and better.
https://sampforum.blast.hk/showthread.php?pid=1320092#pid1320092

If you read this tutorial and download the requirements, you'll have the best command processer system.
And also, don't forget to create the folder itself, and thank to kush for this awesome tutorial.
Reply
#12

Thanks very much guys for your help i am really happy of your help.

Eliran i am not enough good scripter to switch to that lol

Davz~
Reply
#13

switch to MySQL
i can help you to create a login/registet script with MySQL if you are interested send me a pm
Reply
#14

Quote:
Originally Posted by Davz*|*Criss
Посмотреть сообщение
Thanks very much guys for your help i am really happy of your help.

Eliran i am not enough good scripter to switch to that lol

Davz~
You don't need to be. It's actually easier than Dini to me. People are just used to dini and it doesn't seem like they want to switch. But reality is, it's performance is slow. File management system simply reads and writes the files, nothing more, nothing less. Some make it easier, some make it harder.
Reply
#15

i can only say switch to MySQL it very easy a great features like /setofflineplayerint ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)