[HELP]The data isn't writing
#1

Hello again!Sorry for multiple posting,but I have another problem :@
I using YSI:INI include for my AdminScript,but the data isn't writing :@
THE CODE OF REGISTER DIALOG AND public OnDialogResponse vvv
Код:
if(!INI_Exist(file)) {ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Register","Te rugam sa te inregistrezi mai jos","Register","Kick");SendClientMessage(playerid,0x66FF00FF,"Bine ai venit pe GTA.Know.RO!Te rugam sa te inregistrezi mai jos!");}/*Dialog*/
Код:
if(dialogid == 0)
	{
	if(response)
	{
	new password = inputtext[128];
	new string[128];
	INI_Open(file);
	INI_WriteString(file,"Parola",password);
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid,"pName",sizeof(pName));
	INI_WriteString(file,"Nume",pName);
	INI_WriteInt("Level",PInfo[playerid][level]);
	INI_WriteInt("Cash",PInfo[playerid][cash]);
	INI_WriteInt("Coins",PInfo[playerid][coins]);
	INI_WriteInt("Score",PInfo[playerid][score]);
	SendClientMessage(playerid,0x66FF00FF,"Te-ai inregistrat cu succes!!!");
	format(string,128,"Te-ai inregistrat cu succes %s cu parola %s !!!",pName,password);
	SendClientMessage(playerid,0x66FF00FF,string);
	}
	else
	{
	SendClientMessage(playerid,0xFF0000FF,"Nu te-ai inregistrat!Ai primit KICK!!!");
	Kick(playerid);
	}
	}/*OnDialogResponse script*/
Reply
#2

Do you get any warnings/errors when compiling?
I see that you do 'INI_Open(file);', but I don't see any file variable in the code provided.
Reply
#3

Quote:
Originally Posted by burnfire
Посмотреть сообщение
Hello again!Sorry for multiple posting,but I have another problem :@
I using YSI:INI include for my AdminScript,but the data isn't writing :@
THE CODE OF REGISTER DIALOG AND public OnDialogResponse vvv
Код:
if(!INI_Exist(file)) {ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Register","Te rugam sa te inregistrezi mai jos","Register","Kick");SendClientMessage(playerid,0x66FF00FF,"Bine ai venit pe GTA.Know.RO!Te rugam sa te inregistrezi mai jos!");}/*Dialog*/
Код:
if(dialogid == 0)
	{
	if(response)
	{
	new password = inputtext[128];
	new string[128];
	INI_Open(file);
	INI_WriteString(file,"Parola",password);
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid,"pName",sizeof(pName));
	INI_WriteString(file,"Nume",pName);
	INI_WriteInt("Level",PInfo[playerid][level]);
	INI_WriteInt("Cash",PInfo[playerid][cash]);
	INI_WriteInt("Coins",PInfo[playerid][coins]);
	INI_WriteInt("Score",PInfo[playerid][score]);
	SendClientMessage(playerid,0x66FF00FF,"Te-ai inregistrat cu succes!!!");
	format(string,128,"Te-ai inregistrat cu succes %s cu parola %s !!!",pName,password);
	SendClientMessage(playerid,0x66FF00FF,string);
	}
	else
	{
	SendClientMessage(playerid,0xFF0000FF,"Nu te-ai inregistrat!Ai primit KICK!!!");
	Kick(playerid);
	}
	}/*OnDialogResponse script*/
You should probably use
pawn Код:
INI_Close ( myFile );
at the end of the file writing... also, on these lines...
pawn Код:
INI_WriteInt("Level",PInfo[playerid][level]);
    INI_WriteInt("Cash",PInfo[playerid][cash]);
    INI_WriteInt("Coins",PInfo[playerid][coins]);
    INI_WriteInt("Score",PInfo[playerid][score]);
the first paramter should be the file name, for instance,
pawn Код:
INI_WriteInt(file, "Level",PInfo[playerid][level]);
    INI_WriteInt(file, "Cash",PInfo[playerid][cash]);
    INI_WriteInt(file, "Coins",PInfo[playerid][coins]);
    INI_WriteInt(file, Score",PInfo[playerid][score]);
Reply
#4

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
Do you get any warnings/errors when compiling?
I see that you do 'INI_Open(file);', but I don't see any file variable in the code provided.
OOOO!My mistake!The "file" is defined by #define:
Код:
#define file "BAdmin/Profiles/%s.ini"
Sorry.My mistake!
Reply
#5

Quote:
Originally Posted by burnfire
Посмотреть сообщение
OOOO!My mistake!The "file" is defined by #define:
Код:
#define file "BAdmin/Profiles/%s.ini"
Sorry.My mistake!
So, does it work now?
if not, make sure the folders exist, are writable, and that the folder names are exactly the same as in your define.
As far as I know, the names are case sensitive.
Reply
#6

pawn Код:
new password = inputtext[128];
Wrong. Also you should - no, you must - hash passwords.
Reply
#7

Wait a second!I need to create the folder where server put data
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
pawn Код:
new password = inputtext[128];
Wrong. Also you should - no, you must - hash passwords.
You don't have to, but it's recommended that you do!

Quote:
Originally Posted by burnfire
Посмотреть сообщение
Wait a second!I need to create the folder where server put data
Open up the folder named 'Scriptfiles' in your server root, then create a folder called 'BAdmin', then inside it create another folder called 'Profiles'. You should know what to do if you had read the tutorial you were using, carefully.
Reply
#9

Quote:
Originally Posted by burnfire
Посмотреть сообщение
Wait a second!I need to create the folder where server put data
Yep, in scriptfiles folder, create BAdmin folder, and in the BAdmin folder create a folder called Profiles.
Reply
#10

Quote:
Originally Posted by SilverKiller
Посмотреть сообщение
Yep, in scriptfiles folder, create BAdmin folder, and in the BAdmin folder create a folder called Profiles.
The problems appear to be strong keeped to me.Now,appear another problem.Here is image of problem.My register script is same.In dialog I put DIALOG_STYLE_INPUT but it show like a DIALOG_STYLE_MSGBOX .How can I do?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)