Maybe you can help out, Alot of shit.
#1

So I'm starting that login and register system..
Here we go
pawn Код:
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define PATH "/Administration/Users/%s.ini"
//======================================
new PlayerInfo[MAX_PLAYERS][pInfo];
//======================================
enum pInfo
{
    pPass,
    pScore,
    pCash,
    pKills,
    pDeaths,
}
//=======================================
public OnPlayerConnect(playerid)
{
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    SendClientMessage(playerid,COLOR_GREEN,"Welcome to *************");
    return 1;
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Welcome to ****","Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Welcome to *****","Type your password below to register a new account.","Register","Quit");
    }
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s has Joined the server.", pname);
    SendClientMessageToAll(COLOR_CYAN, string);
    return 1;
}
//=====================================================
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"Player Saved Data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);

                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Register Menu","You have been registered","Ok","");
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COLOR_WHITE"Login Menu","You have been logged in to your account","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login Menu","Wrong Password\nType your password below to login into your account","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}
//====================================================
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}
stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}

stock udb_hash(buf[]) {
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}
//===================================================
Compiling error:
Код:
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(40) : error 017: undefined symbol "pInfo"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(40) : error 009: invalid array size (negative, zero or out of bounds)
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(61) : error 029: invalid expression, assumed zero
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(61 -- 62) : warning 215: expression has no effect
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(64) : warning 225: unreachable code
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : error 001: expected token: "-string end-", but found "-identifier-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : warning 215: expression has no effect
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : error 001: expected token: ";", but found "-string-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : warning 215: expression has no effect
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : error 001: expected token: "-string end-", but found "-identifier-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


7 Errors.
Reply
#2

Instead of this:

pawn Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
//======================================
enum pInfo
{
    pPass,
    pScore,
    pCash,
    pKills,
    pDeaths,
}
Use this:

pawn Код:
enum pInfo
{
    pPass,
    pScore,
    pCash,
    pKills,
    pDeaths,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
That should fix these errors:
Код:
[D:\SAMP\Server\SARP\gamemodes\SARP.pwn(40) : error 017: undefined symbol "pInfo"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(40) : error 009: invalid array size (negative, zero or out of bounds)
Reply
#3

Thank You, they're these errors now.
Код:
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(61) : error 029: invalid expression, assumed zero
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(61 -- 62) : warning 215: expression has no effect
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(64) : warning 225: unreachable code
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : error 001: expected token: "-string end-", but found "-identifier-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : warning 215: expression has no effect
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : error 001: expected token: ";", but found "-string-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : warning 215: expression has no effect
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : error 001: expected token: "-string end-", but found "-identifier-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Any help?
Reply
#4

Quote:
Originally Posted by _Khaled_
Посмотреть сообщение
Thank You, they're these errors now.
Код:
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(61) : error 029: invalid expression, assumed zero
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(61 -- 62) : warning 215: expression has no effect
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(64) : warning 225: unreachable code
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : error 001: expected token: "-string end-", but found "-identifier-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : warning 215: expression has no effect
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : error 001: expected token: ";", but found "-string-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : warning 215: expression has no effect
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : error 001: expected token: "-string end-", but found "-identifier-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Any help?
Can you please show me lines 61, 62, 87, and 88.

EDIT:
I would also recommend changing this:

pawn Код:
INI_SetTag(File,"Player Saved Data");
To this:

pawn Код:
INI_SetTag(File,"data");
Reply
#5

pawn Код:
61:     new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];*/
62:  SendClientMessage(playerid,COLOR_GREEN,"Welcome to ***********");

85:            if (!response) return Kick(playerid);
86:            if(response)
87:            {
88:                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COLOR_WHITE"Registering...",""COL_RED"You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
Reply
#6

Nevermind line 61.
Код:
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(64) : warning 225: unreachable code
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : error 001: expected token: "-string end-", but found "-identifier-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : warning 215: expression has no effect
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : error 001: expected token: ";", but found "-string-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : warning 215: expression has no effect
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : error 001: expected token: "-string end-", but found "-identifier-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(88) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#7

Okay, for line 64, try removing "return 1;" from this:

pawn Код:
SendClientMessage(playerid,COLOR_GREEN,"Welcome to *************");
return 1;
if(fexist(UserPath(playerid)))
Reply
#8

Quote:
Originally Posted by _Khaled_
Посмотреть сообщение
pawn Код:
61:     new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];*/
62:  SendClientMessage(playerid,COLOR_GREEN,"Welcome to ***********");

85:            if (!response) return Kick(playerid);
86:            if(response)
87:            {
88:                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COLOR_WHITE"Registering...",""COL_RED"You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
While reading it I noticed you have " */" at line 61.

That could be your error for 61-62.
Reply
#9

Cool
What about line 87?
Код:
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(87) : error 001: expected token: "-string end-", but found "-identifier-"
D:\SAMP\Server\gamemodes\****.pwn(87) : warning 215: expression has no effect
D:\SAMP\Server\gamemodes\****.pwn(87) : error 001: expected token: ";", but found "-string-"
D:\SAMP\Server\gamemodes\****.pwn(87) : warning 215: expression has no effect
D:\SAMP\Server\gamemodes\****.pwn(87) : error 001: expected token: "-string end-", but found "-identifier-"
D:\SAMP\Server\SARP\gamemodes\SARP.pwn(87) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#10

Quote:
Originally Posted by Akira297
Посмотреть сообщение
While reading it I noticed you have " */" at line 61.

That could be your error for 61-62.
I think that was a typo, look at his original code...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)