Y_ini problem
#1

Hello friends!I have on problem here...Y_ini system makes file on playerdisconnect but the file is blank.Nothing saves.

here is my code :

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

#define FAILAI "Zaidejai/%s.ini"

enum pData
{
    Slaptazodis[ 24 ],
    Pinigai,
    Taskai
}
new PlayerData[ MAX_PLAYERS ][ pData ];

new Statusas[ MAX_PLAYERS ];

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{
	Statusas[ playerid ] = 0;

    if( fexist( Zaideju_failai( playerid ) ) )
    {
        INI_ParseFile( Zaideju_failai( playerid ), "Krauti_domenis", .bExtra = true, .extra = playerid );
        ShowPlayerDialog( playerid, 1, DIALOG_STYLE_PASSWORD, "Prisijugimas", "Бveskite prisijungimo slaptaюodб", "Prisijungti", "Iрeiti" );
    }
    else
    {
        ShowPlayerDialog( playerid, 2, DIALOG_STYLE_INPUT, "Registracija", "Бveskite naujа slaptaюodб", "Registruotis", "Iрeiti" );
    }
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	Saugome_Duomenis( playerid );
	return 1;
}

public OnPlayerSpawn(playerid)
{
    if( Statusas[ playerid ] == 1 ) // uюsiregistravжs katik
	{
		/* SetPlayerPos( playerid, X, Y, Z ); */
		GivePlayerMoney( playerid, 3000 );
		SetPlayerScore( playerid, 200 );
	}
	else if( Statusas[ playerid ] == 2 ) // Jei katik бvedл slaptaюodб teisingai duodame uюkrautus domenis
	{
 		GivePlayerMoney( playerid, PlayerData[ playerid ][ Pinigai ] );
    	SetPlayerScore( playerid, PlayerData[ playerid ][ Taskai ] );
	}
	else if( Statusas[ playerid ] == 3 ) // Tuриia.
	{

	}
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if( dialogid == 2 )
	{
	    if ( !response )
		{
		    Kick( playerid );
			return 1;
		}
		if( response )
		{
		    if( !strlen( inputtext ) ) return ShowPlayerDialog( playerid, 2, DIALOG_STYLE_PASSWORD, "Klaida", "Slaptaюodyje turi bыti raidлs arba skaiиiai", "Registruotis", "Iрeiti" );
			new INI: Failas = INI_Open( Zaideju_failai( playerid ) );
   			INI_WriteString( Failas, "Slaptazodis", inputtext );
            INI_Close( Failas );
            SendClientMessage( playerid, -1, "Registracija sлkimga. Jыs automatiрkai prijungtas prie sаskaitos." );
            Statusas[ playerid ] = 1;
			return 1;
		}
		return 1;
	}
	
	if( dialogid == 1 )
	{
		if( !response )
		{
		    Kick( playerid );
		    return 1;
		}
		
		if( strcmp( inputtext, PlayerData[ playerid ][ Slaptazodis ], false ) )
        {
        	ShowPlayerDialog( playerid, 1, DIALOG_STYLE_PASSWORD, "Klaida", "Jыsш бvestas sаskaitos slaptaюodis yra neteisingas\nVeskite dar kartа.", "Tжsti", "Iрeiti" );
        }
		else
        {
			INI_ParseFile( Zaideju_failai( playerid ), "Krauti_domenis", .bExtra = true, .extra = playerid );
            SendClientMessage( playerid, -1, "Sлkimingai prisijungлte" );
            Statusas[ playerid ] = 2;
		}
	}
	
	return 1;
}


forward Krauti_domenis( playerid, name[ ], value[ ] );
public Krauti_domenis( playerid, name[ ], value[ ] )
{
    INI_String( "Slaptazodis", PlayerData[ playerid ][ Slaptazodis ], 24 );
    INI_Int( "Pinigai", PlayerData[ playerid ][ Pinigai ] );
    INI_Int( "Taskai", PlayerData[ playerid ][ Taskai ] );
    Statusas[ playerid ] = 3;
    return 1;
}

stock Saugome_Duomenis( playerid )
{
    new INI: Failas = INI_Open( Zaideju_failai( playerid ) );
    INI_WriteInt( Failas, "Pinigai", GetPlayerMoney( playerid ) );
    INI_WriteInt( Failas, "Taskai", GetPlayerScore( playerid ) );
    INI_Close( Failas );
	return 1;
}

stock Zaideju_failai( playerid )
{
	new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),"Zaidejai/%s.ini",playername);
    return string;
Reply
#2

bump
Reply
#3

Quote:
Originally Posted by Dziugsas
Посмотреть сообщение
bump
Quote:
Originally Posted by kaisersouse
b) Do not bump
Some people apparently think they are important enough to bump their own topic after 10 minutes.
You can bump topics when the last reply is at least 48 hours old, and it needs to have useful information about your problem.
48 hours between each bump
Reply
#4

oh come on !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)