Y_INI Problem
#1

I use Y_ini for saving and loading files. I have a timer that saves every player stats every second. Now sometimes happens that in scriptfiles i see .ini file. There is no owner of that file(no name) and inside file there are stas from some user. How to prevent server to create that file?
Reply
#2

did you copy that code to a tutorial ?
Reply
#3

you mean from tutorial? no, i wrote it my self
Reply
#4

ok give me the code which saves the user data
like the string
or post it here
Reply
#5

Код:
function SaveAccountStats(playerid)
{
if(spawnan[playerid] == 10)
	{
	new
		INI:File = INI_Open(UserPath(playerid))
	;
    INI_SetTag(File,"data");
    
   	PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
    PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
   	new
	   	Float:x,
	    Float:y,
		Float:z
	;
	GetPlayerPos(playerid,x,y,z);
	PlayerInfo[playerid][pPos_x] = x;
	PlayerInfo[playerid][pPos_y] = y;
	PlayerInfo[playerid][pPos_z] = z;
	
    INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
    INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
    INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
    INI_WriteFloat(File,"Pos_x",PlayerInfo[playerid][pPos_x]);
    INI_WriteFloat(File,"Pos_y",PlayerInfo[playerid][pPos_y]);
    INI_WriteFloat(File,"Pos_z",PlayerInfo[playerid][pPos_z]);
    INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
    INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
    INI_WriteInt(File,"Accent",PlayerInfo[playerid][pAccent]);
    INI_WriteInt(File,"Posao",PlayerInfo[playerid][Posao]);
    INI_WriteInt(File,"Ugovor",PlayerInfo[playerid][Ugovor]);
    INI_WriteInt(File,"Plata",PlayerInfo[playerid][Plata]);
    INI_WriteInt(File,"Level",PlayerInfo[playerid][Level]);
    INI_WriteInt(File,"Exp",PlayerInfo[playerid][Exp]);
    INI_WriteInt(File,"RExp",PlayerInfo[playerid][RExp]);
    INI_WriteInt(File,"Organizacija",PlayerInfo[playerid][Organizacija]);
    INI_WriteInt(File,"Rank",PlayerInfo[playerid][Rank]);
    INI_WriteInt(File,"Lider",PlayerInfo[playerid][Lider]);
    INI_WriteInt(File,"Banka",PlayerInfo[playerid][Banka]);
    INI_WriteInt(File,"Auto",PlayerInfo[playerid][AutoKljuc]);
    INI_WriteInt(File,"Auto2",PlayerInfo[playerid][AutoKljuc2]);
    INI_WriteInt(File,"Auto3",PlayerInfo[playerid][AutoKljuc3]);
    INI_WriteInt(File,"Vozacka",PlayerInfo[playerid][Vozacka]);
    INI_WriteInt(File,"Kuca",PlayerInfo[playerid][KucaKljuc]);
    INI_WriteInt(File,"Stan",PlayerInfo[playerid][StanKljuc]);
    INI_WriteInt(File,"Vikendica",PlayerInfo[playerid][VikendicaKljuc]);
    INI_WriteInt(File,"Firma",PlayerInfo[playerid][FirmaKljuc]);
    INI_WriteInt(File,"AdminLevel",PlayerInfo[playerid][AdminLevel]);
    INI_WriteInt(File,"GALevel",PlayerInfo[playerid][GALevel]);
    INI_WriteInt(File,"Upozorenja",PlayerInfo[playerid][Upozorenja]);
    INI_WriteInt(File,"Ulogovan",PlayerInfo[playerid][Ulogovan]);
INI_WriteInt(File,"Bon",PlayerInfo[playerid][Bon]);
    INI_WriteInt(File,"Adresar",PlayerInfo[playerid][Adresar]);
    INI_WriteInt(File,"Telefon",PlayerInfo[playerid][Telefon]);
    INI_WriteInt(File,"Kredit",PlayerInfo[playerid][Kredit]);
    INI_WriteInt(File,"Sekunde",PlayerInfo[playerid][Sekunde]);
    INI_WriteInt(File,"Sati",PlayerInfo[playerid][Sati]);
    INI_WriteInt(File,"Rata",PlayerInfo[playerid][Rata]);
    INI_WriteInt(File,"Spawn",PlayerInfo[playerid][Spawn]);
    INI_WriteInt(File,"Droga",PlayerInfo[playerid][Droga]);
    INI_WriteInt(File,"Materijali",PlayerInfo[playerid][Materijali]);
    INI_WriteInt(File,"Zatvor",PlayerInfo[playerid][Zatvor]);
    INI_WriteInt(File,"Zatvoren",PlayerInfo[playerid][Zatvoren]);
    INI_WriteInt(File,"Tutorial",PlayerInfo[playerid][Tutorial]);
    INI_WriteInt(File,"TutorialZav",PlayerInfo[playerid][TutorialZav]);
    INI_WriteInt(File,"Drzava",PlayerInfo[playerid][Drzava]);
    INI_WriteString(File, "Mail", PlayerInfo[playerid][Mail]);
    INI_WriteInt(File,"Sjeme",PlayerInfo[playerid][Sjeme]);
    INI_WriteInt(File,"Plantano",PlayerInfo[playerid][Plantano]);
    INI_WriteInt(File,"Plantano2",PlayerInfo[playerid][Plantano2]);
    INI_WriteInt(File,"PrevozT",PlayerInfo[playerid][PrevozT]);
    INI_WriteInt(File,"PrevozM",PlayerInfo[playerid][PrevozM]);
    INI_WriteInt(File,"Muted",PlayerInfo[playerid][Muted]);
    INI_WriteInt(File,"Donator",PlayerInfo[playerid][Donator]);
    INI_Close(File);
    }
    return 1;
}
Reply
#6

no i mean when the player will register
send me that one
Reply
#7

Код:
case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registracija...","Niste unjeli validan password.\nUkucajte novi password ispod da se registrujete.","Registracija","Izlaz");
                	new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",600);
                INI_WriteInt(File,"Sex",0);
                INI_WriteInt(File,"Age",0);
                INI_WriteFloat(File,"Pos_x",0);
    			INI_WriteFloat(File,"Pos_y",0);
    			INI_WriteFloat(File,"Pos_z",0);
   			 	INI_WriteInt(File,"Skin",289);
   			 	INI_WriteInt(File,"Team",0);
   			 	INI_WriteInt(File,"Accent",0);
   			 	INI_WriteInt(File,"Level",1);
   			 	INI_WriteInt(File,"Exp",0);
   			 	INI_WriteInt(File,"RExp",2);
   			 	INI_WriteInt(File,"Banka",500);
                INI_WriteInt(File,"Sekunde",0);
                INI_WriteInt(File,"Sati",0);
                INI_WriteInt(File,"Kredit",0);
                INI_WriteInt(File,"Rata",0);
                INI_WriteInt(File,"KucaKljuc",0);
                INI_WriteInt(File,"StanKljuc",0);
                INI_WriteInt(File,"FirmaKljuc",0);
                INI_WriteInt(File,"VikendicaKljuc",0);
                INI_WriteInt(File,"AutoKljuc",0);
                INI_WriteInt(File,"AutoKljuc2",0);
                INI_WriteInt(File,"AutoKljuc3",0);
                INI_WriteInt(File,"AdminLevel",0);
                INI_WriteInt(File,"GALevel",0);
                INI_WriteInt(File,"Lider",0);
                INI_WriteInt(File,"Rank",0);
                INI_WriteInt(File,"Organizacija",0);
                INI_WriteInt(File,"Telefon",0);
                INI_WriteInt(File,"Adresar",0);
                INI_WriteInt(File,"Materijali",0);
                INI_WriteInt(File,"Droga",0);
                INI_WriteInt(File,"Rank",0);
                INI_WriteInt(File,"Organizacija",0);
                INI_WriteInt(File,"Telefon",0);
                INI_WriteInt(File,"Plata",0);
                INI_WriteInt(File,"Posao",0);
                INI_WriteInt(File,"Vozacka",0);
                INI_WriteInt(File,"Upozorenja",0);
                INI_WriteInt(File,"Ulogovan",0);
                INI_WriteInt(File,"Bon",0);
                INI_WriteInt(File,"Spawn",0);
                INI_WriteInt(File,"Zatvor",0);
                INI_WriteInt(File,"Zatvoren",0);
                INI_WriteInt(File,"Tutorial",0);
                INI_WriteInt(File,"TutorialZav",0);
                INI_WriteInt(File,"Drzava",0);
                INI_WriteInt(File,"Sjeme",0);
                INI_WriteInt(File,"Plantano",0);
                INI_WriteInt(File,"Plantano2",0);
                INI_WriteInt(File,"PrevozM",0);
                INI_WriteInt(File,"PrevozT",0);
                INI_WriteInt(File,"Muted",0);
                INI_WriteInt(File,"Donator",0);
                INI_WriteInt(File,"Ugovor",0);
                 INI_Close(File);

               ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "- Spol -","Kojeg ste spola?","Musko","Zensko");

			for(new td2 = 3; td2 <= 6; td2++) { TextDrawHideForPlayer(playerid, RegisterLoginTD2[td2]); }
            }
        }
Reply
#8

oops ok find the
stock which has

pawn Код:
stock UserPath()
{
}
past it lets check if something is wrong
Reply
#9

Код:
#define PATH "Korisnici/%s.ini"

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
Reply
#10

Quote:
Originally Posted by n0namE
Посмотреть сообщение
Код:
#define PATH "Korisnici/%s.ini"

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
It's because of the format I'm sure. Tried formatting without the define 'PATH' ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)