SA-MP Forums Archive
Register System Problem (Simple Click here). - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Register System Problem (Simple Click here). (/showthread.php?tid=273871)



Register System Problem (Simple Click here). - Davz*|*Criss - 03.08.2011

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~


Re: Register System Problem (Simple Click here). - GangsTa_ - 03.08.2011

What makes you think that it doesn't work?

Did you create the 'Users' folder in scriptfiles?


Re: Register System Problem (Simple Click here). - Davz*|*Criss - 03.08.2011

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


AW: Register System Problem (Simple Click here). - Tigerkiller - 03.08.2011

you dont create a dini file by register


AW: Register System Problem (Simple Click here). - Tigerkiller - 03.08.2011

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;
}



Re: AW: Register System Problem (Simple Click here). - Kush - 03.08.2011

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.


Re: Register System Problem (Simple Click here). - sleepysnowflake - 03.08.2011

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


Re: Register System Problem (Simple Click here). - Mean - 03.08.2011

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;
}



AW: Register System Problem (Simple Click here). - Tigerkiller - 03.08.2011

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


Re: AW: Register System Problem (Simple Click here). - Mean - 03.08.2011

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.


Re: Register System Problem (Simple Click here). - Toreno - 03.08.2011

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.


Re: Register System Problem (Simple Click here). - Davz*|*Criss - 03.08.2011

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~


Re: Register System Problem (Simple Click here). - Tigerkiller - 03.08.2011

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


Re: Register System Problem (Simple Click here). - Kush - 03.08.2011

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.


Re: Register System Problem (Simple Click here). - Tigerkiller - 04.08.2011

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