Y_INI Problem
#1

So, I tried since long time to work with y_ini but everytime I had the same problem, and now I decide to ask you guys,
tried even Kush tutorial, still doesn't work, so here's the problem:When I join, I register and /quit but it doesn't save any file in scriptfiles/Users/...Reinstalled the whole SAMP package, and I still have the problem, tho I can't see anything wrong with this:
pawn Код:
//============================[Includes]========================================
#include <a_samp> // Credits to SAMP team.
#include <YSI\y_ini> // Credits to ******
#include <sscanf2> // Credits to ******
#include <zcmd> // Credits to ZeeX
//============================[Login/Register]==================================
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3                      // Credits to Kush
#define DIALOG_SUCCESS_2 4
#define PATH "Users/%s.ini"
//============================[Another Defines]=================================
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
//=============================[MAIN]===========================================
main()
{
    print("\n----------------------------------");
    print(" Roleplay");
    print("----------------------------------\n");
}
//============================[Enums]===========================================
enum pInfo
{
    pPass,
    pAdmin,
    pLevel
}
new PlayerInfo[MAX_PLAYERS][pInfo];
//=============================[Login/Register]=================================
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Level",PlayerInfo[playerid][pLevel]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    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[]) { // Credits to DracoBlue.
    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;
}
//=========================[Callbacks]===========================================
public OnGameModeInit()
{
    SetGameModeText("Gamemode");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

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,"data");
    INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_Close(File);
    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.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Level",1);
                INI_WriteInt(File,"Admin",0);
                INI_Close(File);
                SetSpawnInfo(playerid, 0, 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"Great! Your Y_INI system works perfectly. Relog to save your stats!","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);
                    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;
}
Any ideas?
Reply
#2

Next time, post in the topic in which you got it from (it'd be easier for me to check).

Try downloading the 'Full Package'.

http://www.sendspace.com/file/ca1jvf
Reply
#3

Did that too, and I still have the same problem, it doesn't create any file in Users.
Reply
#4

Quote:
Originally Posted by Jafet_Macario
Посмотреть сообщение
Did that too, and I still have the same problem, it doesn't create any file in Users.
Are you including this into another script, or are you attempting to create a new one?

It works, I've just re-downloaded the file.
Reply
#5

Nope, I just try to start a new gamemode using y_ini instead dini .Tried even change the PATH, still it don't create the file.
Reply
#6

Quote:
Originally Posted by Jafet_Macario
Посмотреть сообщение
Nope, I just try to start a new gamemode using y_ini instead dini .Tried even change the PATH, still it don't create the file.
Have you altered any code? Re-named anything? Just download the file, place it to your desktop, and run the dedicated server.
Reply
#7

Nope made, didn't change nothing.Downloaded the file and opened samp-server.exe.Tried that again, it still don't create the file.Any idea what can cause this?
Reply
#8

Quote:
Originally Posted by Jafet_Macario
Посмотреть сообщение
Nope made, didn't change nothing.Downloaded the file and opened samp-server.exe.Tried that again, it still don't create the file.Any idea what can cause this?
No sorry. It works for me, and everyone else that uses it.
Reply
#9

Oh damn , ok thanks.Waiting for other's opinion.
Reply
#10

same thing happens for me. Lol.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)