It doesn't write on theINI File.. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: It doesn't write on theINI File.. (
/showthread.php?tid=618742)
It doesn't write on theINI File.. -
Gotham - 09.10.2016
Hi guys I created a register system but apparently it doesn't write anything on the .INI File..
Please help
PHP код:
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,""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;
}
Re: It doesn't write on theINI File.. -
ChristolisTV - 09.10.2016
Have you tried updating y_ini?
Re: It doesn't write on theINI File.. -
Gotham - 09.10.2016
****** left...He doesn't update it -_-
Re: It doesn't write on theINI File.. -
Bolex_ - 09.10.2016
Why dont you use this one ?
https://sampforum.blast.hk/showthread.php?tid=352703
Re: It doesn't write on theINI File.. -
AndySedeyn - 09.10.2016
- 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
Re: It doesn't write on theINI File.. -
Gotham - 09.10.2016
I fixed it anyway thanks!