Register sYS Error
#1

hEY, i have register login sys, and when i getting IG.
i do some pass, after when i am reconecting and trying put the pass is not work
game mode code; http://pastebin.com/NLi51Qkh
INI Save file;
PHP код:
[Account-Stats]
Password 125
P_Logged 
0
UserMail 
0
AdmLevel 
0
Donaotr 
0
D_Money 
0
Money 
0
Level 
0
Score 
0
Kills 
0
Deaths 
0
Sucide 
0
Donator 
0
[Account-Active]
Days 0
Hurse 
0
Minuts 
0
Seconds 

Reply
#2

pawn Код:
enum pInfo
{
    Password[50],
    P_Logged,
    UserMail,
    AdmLevel,
    Donator,
    D_Money,
    Money,
    Level,
    Score,
    Kills,
    Deaths,
    Sucide,
    Days,
    Hurse,
    Minuts,
    Seconds
}
new PlayerInfo[MAX_PLAYERS][pInfo];
 
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_String("Password",PlayerInfo[playerid][Password], 50);
    INI_Int("P_Logged",PlayerInfo[playerid][P_Logged]);
    INI_Int("UserMail",PlayerInfo[playerid][UserMail]);
    INI_Int("AdmLevel",PlayerInfo[playerid][AdmLevel]);
    INI_Int("Donator",PlayerInfo[playerid][Donator]);
    INI_Int("D_Money",PlayerInfo[playerid][D_Money]);
    INI_Int("Money",PlayerInfo[playerid][Money]);
    INI_Int("Level",PlayerInfo[playerid][Level]);
    INI_Int("Score",PlayerInfo[playerid][Score]);
    INI_Int("Kills",PlayerInfo[playerid][Kills]);
    INI_Int("Deaths",PlayerInfo[playerid][Deaths]);
    INI_Int("Sucide",PlayerInfo[playerid][Sucide]);
    INI_Int("Days",PlayerInfo[playerid][Days]);
    INI_Int("Hurse",PlayerInfo[playerid][Hurse]);
    INI_Int("Minuts",PlayerInfo[playerid][Minuts]);
    INI_Int("Seconds",PlayerInfo[playerid][Seconds]);
    return 1;
}
The player variable is a 'string' not an 'integer'. So therefore you use INI_String, INI_WriteString rather than INI_Int etc.

I would recommend you hash your passwords using Whirlpool or udb_hash, so your players can be secure with their passwords... I wouldn't recommend it, I would insist it.

EDIT:
I have edited your script so it won't give any errors, or unwanted bugs.

pawn Код:
#include <a_samp>
#include <YSI\y_ini>

#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4

#define PATH "/Users/%s.ini"

#define COL_WHITE "{FFFFFF}"
#define COL_GOLD "{BCB818}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"

enum pInfo
{
    Password[50],
    P_Logged,
    UserMail,
    AdmLevel,
    Donator,
    D_Money,
    Money,
    Level,
    Score,
    Kills,
    Deaths,
    Sucide,
    Days,
    Hurse,
    Minuts,
    Seconds
}
new PlayerInfo[MAX_PLAYERS][pInfo];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_String("Password",PlayerInfo[playerid][Password], 50);
    INI_Int("P_Logged",PlayerInfo[playerid][P_Logged]);
    INI_Int("UserMail",PlayerInfo[playerid][UserMail]);
    INI_Int("AdmLevel",PlayerInfo[playerid][AdmLevel]);
    INI_Int("Donator",PlayerInfo[playerid][Donator]);
    INI_Int("D_Money",PlayerInfo[playerid][D_Money]);
    INI_Int("Money",PlayerInfo[playerid][Money]);
    INI_Int("Level",PlayerInfo[playerid][Level]);
    INI_Int("Score",PlayerInfo[playerid][Score]);
    INI_Int("Kills",PlayerInfo[playerid][Kills]);
    INI_Int("Deaths",PlayerInfo[playerid][Deaths]);
    INI_Int("Sucide",PlayerInfo[playerid][Sucide]);
    INI_Int("Days",PlayerInfo[playerid][Days]);
    INI_Int("Hurse",PlayerInfo[playerid][Hurse]);
    INI_Int("Minuts",PlayerInfo[playerid][Minuts]);
    INI_Int("Seconds",PlayerInfo[playerid][Seconds]);
    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 GetName(playerid)
{
    new name[50];
    GetPlayerName(playerid,name,sizeof(name));
    return name;
}

stock ShowPlayerStats(playerid)
{
    new
    string[ 103 ];
    new Float:ratio = floatdiv(PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths]);
    format(string, sizeof(string), "%s stats:", GetName(playerid));
    SendClientMessage(playerid,-1,string);
    format(string, sizeof(string), "Password:(%s) Mail:(%i) Level:(%i) AdmLevel:(%i) DonatorLevel:(%i)", PlayerInfo[playerid][Password], PlayerInfo[playerid][UserMail], PlayerInfo[playerid][Level], PlayerInfo[playerid][AdmLevel], PlayerInfo[playerid][Donator]);
    SendClientMessage(playerid,-1,string);
    format(string, sizeof(string), "Money:(%i$) Gold-Money:(%i$)", PlayerInfo[playerid][Money], PlayerInfo[playerid][D_Money]);
    SendClientMessage(playerid,-1,string);
    format(string, sizeof(string), "Score:(%i) Kills:(%i) Deaths:(%i) Sucide(%i) KDR:(%f)", PlayerInfo[playerid][Score], PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], PlayerInfo[playerid][Sucide], ratio);
    SendClientMessage(playerid,-1,string);
    format(string, sizeof(string), "Active; Days:(%i) Hurse:(%i) Minuts:(%i) Seconds:(%i)", PlayerInfo[playerid][Days], PlayerInfo[playerid][Hurse], PlayerInfo[playerid][Minuts], PlayerInfo[playerid][Seconds]);
    SendClientMessage(playerid,-1,string);
    return 1;
}

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"Account-Stats");
    INI_WriteInt(File,"P_Logged",PlayerInfo[playerid][P_Logged]);
    INI_WriteInt(File,"UserMail",PlayerInfo[playerid][UserMail]);
    INI_WriteInt(File,"AdmLevel",PlayerInfo[playerid][AdmLevel]);
    INI_WriteInt(File,"Donator",PlayerInfo[playerid][Donator]);
    INI_WriteInt(File,"D_Money",PlayerInfo[playerid][D_Money]);
    INI_WriteInt(File,"Money",PlayerInfo[playerid][Money]);
    INI_WriteInt(File,"Level",PlayerInfo[playerid][Level]);
    INI_WriteInt(File,"Score",PlayerInfo[playerid][Score]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]);
    INI_WriteInt(File,"Sucide",PlayerInfo[playerid][Sucide]);
    INI_SetTag(File,"Account-Active");
    INI_WriteInt(File,"Days",PlayerInfo[playerid][Days]);
    INI_WriteInt(File,"Hurse",PlayerInfo[playerid][Hurse]);
    INI_WriteInt(File,"Minuts",PlayerInfo[playerid][Minuts]);
    INI_WriteInt(File,"Seconds",PlayerInfo[playerid][Seconds]);
    INI_Close(File);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/stats", cmdtext, true) == 0)
    {
    ShowPlayerStats(playerid);
    return 1;
    }
    if (strcmp("/kill", cmdtext, true) == 0)
    {
    SetPlayerHealth(playerid, 0);
    return 1;
    }
    return SendClientMessage(playerid, -1,"SERVER: unknow command, do [/help] to see all commands.");

}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
            if(!strlen(inputtext) || strlen(inputtext) > 50) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
            new INI:File = INI_Open(UserPath(playerid));
            INI_SetTag(File,"Account-Stats");
            INI_WriteString(File,"Password",inputtext);
            INI_WriteInt(File,"P_Logged",1);
            INI_WriteInt(File,"UserMail",0);
            INI_WriteInt(File,"AdmLevel",0);
            INI_WriteInt(File,"Donaotr",0);
            INI_WriteInt(File,"D_Money",0);
            INI_WriteInt(File,"Money",0);
            INI_WriteInt(File,"Level",0);
            INI_WriteInt(File,"Score",0);
            INI_WriteInt(File,"Kills",0);
            INI_WriteInt(File,"Deaths",0);
            INI_WriteInt(File,"Sucide",0);
            INI_SetTag(File,"Account-Active");
            INI_WriteInt(File,"Days",0);
            INI_WriteInt(File,"Hurse",0);
            INI_WriteInt(File,"Minuts",0);
            INI_WriteInt(File,"Seconds",0);
            INI_Close(File);
            SetSpawnInfo(playerid, 155, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
            SpawnPlayer(playerid);
            ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success",""COL_GREEN"You have eran 2 Score for registing. you can do /help, to see admins /admins","Ok","");
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(strcmp(PlayerInfo[playerid][Password], inputtext, false) == 0)
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
Reply
#3

is not work!!!!!
Reply
#4

You will need to delete your account and register again... your password would still be saved as an integer...
EDIT: Please look at above post for updated code.
Reply
#5

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
You will need to delete your account and register again... your password would still be saved as an integer...
EDIT: Please look at above post for updated code.
I do, and i fink is can be the line - 345, i fink the PROBLEM with line 345 check on the link
Reply
#6

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
You will need to delete your account and register again... your password would still be saved as an integer...
EDIT: Please look at above post for updated code.
Isn't this
pawn Код:
if( PlayerInfo[playerid][Password])
Supposed to be
pawn Код:
if(inputtext == PlayerInfo[playerid][Password])
Or with strcmp
pawn Код:
if(strcmp(PlayerInfo[playerid][Password], inputtext, false) == 0)
Reply
#7

Yes... check the updated code.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)