Y_INI Save
#1

Registration/login system from this link: https://sampforum.blast.hk/showthread.php?tid=376424
When I click the "Quit" button in DIALOG_REGISTER, the file is saved and kick. How to make it not write down?

Код:
[PlayerData]
Deaths = 0
Kills = 0
Admin = 0
Cash = 0
Reply
#2

if (!response) return Kick(playerid);

Do you have this?

Код:
       case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid); // THIS IS WHAT HAPPEND WHEN PLAYER QUIT REGISTER DIALOG! (NOTHING SAVED - JUST KICK THE HELLBOY OUT OF YOUR HOOD)
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, 
                 ""COL_WHITE"Making your account ..",""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,"PlayerData");
                new HashPass[129];
                WP_Hash(HashPass, sizeof(HashPass), inputtext);
                INI_WriteString(File, "Password", HashPass);
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",-1);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);
                
                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Account 
                created!",""COL_GREEN"You've created an account successfuly. Relogging is recommended.","Ok","");
            }
        }
Reply
#3

Quote:
Originally Posted by ThomasEvil
Посмотреть сообщение
if (!response) return Kick(playerid);

Do you have this?

Код:
       case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid); // THIS IS WHAT HAPPEND WHEN PLAYER QUIT REGISTER DIALOG! (NOTHING SAVED - JUST KICK THE HELLBOY OUT OF YOUR HOOD)
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, 
                 ""COL_WHITE"Making your account ..",""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,"PlayerData");
                new HashPass[129];
                WP_Hash(HashPass, sizeof(HashPass), inputtext);
                INI_WriteString(File, "Password", HashPass);
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",-1);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);
                
                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Account 
                created!",""COL_GREEN"You've created an account successfuly. Relogging is recommended.","Ok","");
            }
        }
As u can see he clearly said that "the file is save and KICKED", hence he probably have this line already.

Anyways i know this problem with Y_ini n this is how i bypass it. I made a variable called Dontsave and set it to 1/true, and run a check under the save, something like this:
PHP код:
if(Dontsave[playerid] == 0)
{
//Go ahead and save the players information.

Reply
#4

Quote:
Originally Posted by Leaky
Посмотреть сообщение
As u can see he clearly said that "the file is save and KICKED", hence he probably have this line already.
Cool, now tell me where is any saving function in this line:

Код:
if (!response) return Kick(playerid);
The only possible issue may be if he make user file and save player data under OnPlayerDisconnect.
Reply
#5

Quote:
Originally Posted by ThomasEvil
Посмотреть сообщение
Cool, now tell me where is any saving function in this line:

Код:
if (!response) return Kick(playerid);
The only possible issue may be if he make user file and save player data under OnPlayerDisconnect.
Yes bro that's the point i'm trying to make, he should place the variable check in where he save the player data. So you telling him to check for this line "if (!response) return Kick(playerid);" wont even resolve anything, because if he added that line if it was missing the player data would have gotten saved anyways.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)