Creates .ini but it's blank
#1

I have a problem with my admin system, so basically it creates the players ini fiel in the scriptfiles, but unfortunately it's blank so anytime you go back into the game it does recognize your username (because of the playername.ini) but it doesn't load his password or money or anything because it's blank. SO whats the problem? Is it some plugin,or missing folder? or what? Let me sohw you the code.

ALL PLUGINS
Код:
#include <a_samp>
#include <ZCMD>
#include <YSI\y_ini>
#include <sscanf2>
#include <dini>
#include <streamer>
#include <a_angles>
#include <sscanf2>
#include <foreach>
Код:
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define PATH "/Users/%s.ini"
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"Registeration",""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,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
    INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
    INI_WriteInt(File,"FightStyle",PlayerInfo[playerid][pFightStyle]);
    INI_WriteInt(File,"Warnings",PlayerInfo[playerid][pWarnings]);
    INI_WriteInt(File,"Hours", PlayerInfo[playerid][pPlayingTime]);
    INI_WriteInt(File,"Kicks", PlayerInfo[playerid][pKicks]);
    INI_Close(File);
    return 1;
}
OnDialogResponse
Код:
    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,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Level",0);
                INI_WriteInt(File,"VIP",0);
                INI_WriteInt(File,"FightStyle",0);
                INI_WriteInt(File,"Warnings",0);
                INI_WriteInt(File,"Hours",0);
                INI_WriteInt(File,"Kicks",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"You're account was converted, please relog","Ok","");
                TogglePlayerControllable(playerid, false);
            }
        }

        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]);
                    if(PlayerInfo[playerid][pAdmin] == 1 || PlayerInfo[playerid][pAdmin] == 2 || PlayerInfo[playerid][pAdmin] == 3 || PlayerInfo[playerid][pAdmin] == 4 || PlayerInfo[playerid][pAdmin] == 5)
				    {
        				SendClientMessage(playerid, COLOR_GREEN, "AdminMOTD: Stay connected and use your commands wisely");
				    }
                }
                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;
            }
        }
I guess the code looks alright, I've created the empty folder in the scriptfiles with the name " Users" as it's codded,so basically it does save the palyer , Playername.ini" but it's empty.
Reply
#2

Okay anybody?
Reply
#3

Where can I check it?
Reply
#4

Show me your UserPath
Reply
#5

Код:
 
stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
Reply
#6

I have the same problem, but no with the admin system. Is my user login/register system. When the player register in the server , the .ini file it create but when I check this .ini of the user is in blank and after that when re-log and login, it say that I put the wrong password (It's obvious 'cause this .ini file is on blank). I need help please, I have a similar code like in this post.
*Sorry for my English*
Reply
#7

wtf SERIOUSLY?
WHY YOU BUMPING THREAD WHICH WAS CREATED 1 YEAR AGO.
Reply
#8

Quote:
Originally Posted by SpikY_
Посмотреть сообщение
wtf SERIOUSLY?
WHY YOU BUMPING THREAD WHICH WAS CREATED 1 YEAR AGO.

їHello? Because I have the same problem, and I see that actually the plroblem don't resolve...So I ask some help їAny problem?

*I see this post on ******' putting my problem, and i "bump it" because I need help and if the people help on this post, the first user who has post on this' can resolve his problem to.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)