It doesn't write on theINI File..
#1

Hi guys I created a register system but apparently it doesn't write anything on the .INI File..
Please help
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
   switch( 
dialogid )
   {
        case 
DIALOG_REGISTER:
        {
            if(!
response) return Kick(playerid);
            if(
response)
            {
                  if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,""S_GREEN"Registering..",""S_RED"Invalid length.\n"S_LIGHTBLUE"Type your password below to register an account","Register","Quit");
                  new 
INI:File INI_Open(UserPath(playerid));
                  
INI_SetTag(File,"data");
                  
INI_WriteInt(File,"Pass",udb_hash(inputtext));
                  
INI_WriteInt(File,"Money",50000);
                  
INI_WriteInt(File,"AdminLevel",0);
                  
INI_WriteInt(File,"Donor",0);
                  
INI_WriteInt(File,"Deaths",0);
                  
INI_WriteInt(File,"Kills",0);
                  
INI_WriteInt(File,"Score",0);
                  
                  
ShowPlayerDialog(playerid,DIALOG_SUCCESS_1,DIALOG_STYLE_MSGBOX,""S_BLUE"Registered!",""S_GREEN"You have now registered here!Hope you enjoy the stay!","Ok","");
            }
        }
        
        case 
DIALOG_LOGIN:
        {
           if( !
response ) return Kick(playerid);
           if(
response)
           {
                if(
udb_hash(inputtext) == pInfo[playerid][Pass])
                {
                    
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                    
GivePlayerMoney(playerid,pInfo[playerid][Money]);
                    
ShowPlayerDialog(playerid,DIALOG_SUCCESS_2,DIALOG_STYLE_MSGBOX,""S_GREEN"Success!",""S_BLUE"You have successfully logged in!Welcome back!","Ok.","");
                }
                else
                {
                     
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,""S_WHITE"Login",""S_RED"You have entered an invalid password!.\n"S_WHITE"Type your password below to login!","Login","Quit");
                     
                }
                return 
1;
            }
        }
   }
   return 
1;

Reply
#2

Have you tried updating y_ini?
Reply
#3

****** left...He doesn't update it -_-
Reply
#4

Why dont you use this one ?

https://sampforum.blast.hk/showthread.php?tid=352703
Reply
#5

- You have to close the file after writing stuff to it:
PHP код:
INI_Close(file_variable
- Set your folder permissions.
- Don't use udb_hash. It's only slightly more secure than plain text.

https://github.com/Misiur/YSI-Includes
https://github.com/Misiur/YSI
Reply
#6

I fixed it anyway thanks!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)