Prblem save file Y_ini
#1

Hy!
I have a problem with Y_ini ...
I want to save a string using the name you GM ...
the problem is that every time you use the command to change the name to GM appears to me a new line in the .ini file




I forgot something in the script?


Код:
#include <a_samp>
#include <zcmd>
#include <YSI\y_ini>


#define 	DIR_SET_SERV			"SetariiServer.ini"

#define 	DIALOG_SETNUMESRV       		15
//#define 	DIALOG_VersiuneServer           16


#define 	SCM 			SendClientMessage
#define 	SPD 			ShowPlayerDialog


enum Sett_Server
{
	NumeServer[41]
	//VersiuneServer[41]
};
new Server[Sett_Server];

public OnFilterScriptInit()
{

	new str[128];
	if(fexist(DIR_SET_SERV)) INI_ParseFile(DIR_SET_SERV, "IncarcareSetariiServer");
	format(str, sizeof(str),".::[%s]::.",Server[NumeServer]);
	print(str);
	

	return 1;
}

forward IncarcareSetariiServer(name[], value[]);

public IncarcareSetariiServer(name[], value[])
{
	INI_String(	"Nume Server :", 			Server[NumeServer], 		41);
	//INI_String(	"Versiune Server :",		Server[VersiuneServer], 	21);
	
	return 1;
}

stock SetariiServer()
{
	new INI:File = INI_Open(DIR_SET_SERV);
	INI_SetTag(File,"Setari Server");
	
	INI_WriteString(File,"Nume Server :", 		Server[NumeServer]);
	//INI_WriteString(File,"Versiune Server :",	Server[VersiuneServer]);
	
	INI_Close(File);
	return 1;
}



CMD:schimbahostname(playerid, params[])
{
	SPD(playerid, DIALOG_SETNUMESRV, DIALOG_STYLE_INPUT,"Server Host Name","Scrie Numele Servarului", "Schimba", "Exit");
	return 1;
}
CMD:test(playerid, params[])
{
	new str[128];
	if(fexist(DIR_SET_SERV)) INI_ParseFile(DIR_SET_SERV, "IncarcareSetariiServer");
	format(str, sizeof(str),".::[%s]::.",Server[NumeServer]);
	print(str);
	SCM(playerid, -1,str);
	return 1;
}
/*CMD:schimbaversiune(playerid, params[])
{
	SPD(playerid, DIALOG_VersiuneServer, DIALOG_STYLE_INPUT,"Versiune Server","Scrie Versiunea ...", "Schimba", "Exit");
	return 1;
}*/
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
		case DIALOG_SETNUMESRV:
		{
			if(!response)
			
			if(strlen(inputtext) > 40) return SCM(playerid, -1,"Aici imi dade erori");
			new str[50];
			format(Server[NumeServer], 41, "%s", inputtext);
			format(str, 50, "hostname %s", Server[NumeServer]);
			SendRconCommand(str);
			SetariiServer();
			SendRconCommand(str);
			
			if(fexist(DIR_SET_SERV)) INI_ParseFile(DIR_SET_SERV, "IncarcareSetariiServer");
			format(str, sizeof(str),"Host Name : %s",Server[NumeServer]);
			SCM(playerid,-1,str);
			
		}
		/*case DIALOG_VersiuneServer:
		{
			if(!response)

			if(strlen(inputtext) > 40) return SCM(playerid, -1,"Aici imi dade erori");
			new str[50];
			format(Server[VersiuneServer], 41, "%s", inputtext);
			format(str, 50, "Versiune : %s", Server[VersiuneServer]);
			SendRconCommand(str);
			SetariiServer();

			if(fexist(DIR_SET_SERV)) INI_ParseFile(DIR_SET_SERV, "IncarcareSetariiServer");
			format(str, sizeof(str),"Ai setat Versiunea la server: %s",Server[VersiuneServer]);
			SCM(playerid,-1,str);

		}*/
  	}
	return 1;
}
Reply


Messages In This Thread
Prblem save file Y_ini - by CMH - 22.06.2015, 20:29
Re: Prblem save file Y_ini - by CMH - 23.06.2015, 04:17
Re: Prblem save file Y_ini - by FernandoLight - 23.06.2015, 04:55

Forum Jump:


Users browsing this thread: 1 Guest(s)