SA-MP Forums Archive
Y_INI not creating expect 1 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: Y_INI not creating expect 1 file (/showthread.php?tid=641241)



Y_INI not creating expect 1 file - Mohaaaaaaaaaaa - 13.09.2017

Well i have posted lately that Y_ini is not writing any string characters but lately i configured that i define the ClanPath
%d not %i anyway but the fact is the saving system doesn't create more than 1 .ini file
PS:I am not used to Y_INI never used
Thanks In advance


PHP код:
forward SaveClan(clanid);
public  
SaveClan(clanid)
{
    new 
cfile[64];
    
format(cfile64ClanPathclanid);
    new 
INI:file INI_Open(cfile);
    
INI_SetTag(file,"Clan's Information");
    
INI_WriteString(file,"Leader"ClanInfo[clanid][Owner]);
    
INI_WriteString(file,"Name"ClanInfo[clanid][ClanName]);
    
INI_WriteString(file,"MOTD"ClanInfo[clanid][MOTD]);
    
INI_WriteString(file,"Rank1"ClanInfo[clanid][Rank1]);
    
INI_WriteString(file,"Rank2"ClanInfo[clanid][Rank2]);
    
INI_WriteString(file,"Rank3"ClanInfo[clanid][Rank3]);
    
INI_WriteString(file,"Rank4"ClanInfo[clanid][Rank4]);
    
INI_WriteString(file,"Rank5"ClanInfo[clanid][Rank5]);
    
INI_WriteString(file,"Rank6"ClanInfo[clanid][Rank6]);
    
INI_WriteInt(file,"Skin"ClanInfo[clanid][cSkin]);
    
INI_WriteInt(file,"XP"ClanInfo[clanid][XP]);
    
INI_WriteInt(file,"Members"ClanInfo[clanid][Members]);
    
INI_WriteInt(file,"ID"ClanInfo[clanid][cID]);
    
INI_Close(file);
    return 
1;




Re: Y_INI not creating expect 1 file [REP ++] - Elnova - 13.09.2017

Can You Show Me "ClanPath" Part Of The Script


Re: Y_INI not creating expect 1 file [REP ++] - Mohaaaaaaaaaaa - 13.09.2017

PHP код:
#define ClanPath     "COD/Clans/%i.ini" 



Re: Y_INI not creating expect 1 file [REP ++] - JesterlJoker - 13.09.2017

I'll help you but can you explain how things happen, or what do you wish to happen with that piece of code, I can see no error

PHP код:
    INI_SetTag(file,"Clan's Information"); //<- Though this part seems to be doing something wrong 
As far as I have tested and tried a lot Setting a tag cannot have spaces in between a text... I don't know if its just me or not, and if someone knows what really happens then your rebuke will be much appreciated for knowledge.

Try setting it like this
PHP код:
    INI_SetTag(file,"Clan's_Information");
    
//or
    
INI_SetTag(file,"Information"); 



Re: Y_INI not creating expect 1 file [REP ++] - Mohaaaaaaaaaaa - 13.09.2017

Fine,I appericate your help
although it has nothing to do with File tag setting either with this code
it's a probably an issue with the createclan command
so there it is the needed part of the code others is checking player money score etc
loose indentation due to the copy and the paste
Код:
	for(new idz=0; idz<sizeof(ClanInfo); idz++)
	{
	    Player[playerid][ClanID] = 1;
	    Player[playerid][ClanRank] = 6;
        
	    ClanInfo[Player[playerid][ClanID]][Owner] = format(ClanInfo[Player[playerid][ClanID]][Owner], 128, GetName(playerid));
        ClanInfo[idz][Members] +=1;
        ClanInfo[Player[playerid][ClanID]][ClanName] = text;
	    ClanInfo[Player[playerid][ClanID]][cSkin] = format(ClanInfo[idz][cSkin], 128, "");
		ClanInfo[Player[playerid][ClanID]][MOTD] = format(ClanInfo[idz][MOTD], 128, "Honor and reality");
		
		ClanInfo[idz][cID] = Player[playerid][ClanID];


	    ClanInfo[Player[playerid][ClanID]][Rank1] = format(ClanInfo[Player[playerid][ClanID]][Rank1], 60, "Aspirant");
	    ClanInfo[Player[playerid][ClanID]][Rank2] = format(ClanInfo[Player[playerid][ClanID]][Rank2], 60, "Lieutenant");
	    ClanInfo[Player[playerid][ClanID]][Rank3] = format(ClanInfo[Player[playerid][ClanID]][Rank3], 60, "Capitaines");
	    ClanInfo[Player[playerid][ClanID]][Rank4] = format(ClanInfo[Player[playerid][ClanID]][Rank4], 60, "Generals");
	    ClanInfo[Player[playerid][ClanID]][Rank5] = format(ClanInfo[Player[playerid][ClanID]][Rank5], 60, "Leader");
	    ClanInfo[Player[playerid][ClanID]][Rank6] = format(ClanInfo[Player[playerid][ClanID]][Rank6], 60, "Founder");
		
		ClanInfo[idz][XP] = 0;
		ClanInfo[Player[playerid][ClanID]][Active] = true;
		ClanInfo[Player[playerid][ClanID]][HasSkin] = false;
		
		
		
		SaveClan(idz);
		idz = MAX_CLANS;
    }



Re: Y_INI not creating expect 1 file [REP ++] - JasonRiggs - 13.09.2017

Doesn't it save at all? Doesn't it even Open the file? or write any of the titles? or any of the values?


Re: Y_INI not creating expect 1 file [REP ++] - JesterlJoker - 13.09.2017

Your using the format function wrong
PHP код:
       format(destination[], sizeof destinationtextparameters); 
//try this out
PHP код:
    for(new idz=0idz<sizeof(ClanInfo); idz++)
    {
        
Player[playerid][ClanID] = 1;
        
Player[playerid][ClanRank] = 6;
        
        
format(ClanInfo[Player[playerid][ClanID]][Owner], 128"%s"GetName(playerid));
        
ClanInfo[idz][Members] +=1;
        
format(ClanInfo[Player[playerid][ClanID]][ClanName], 128"%s"text);
        
format(ClanInfo[idz][cSkin], 128"");
        
format(ClanInfo[idz][MOTD], 128"Honor and reality");
        
        
ClanInfo[idz][cID] = Player[playerid][ClanID];


        
format(ClanInfo[Player[playerid][ClanID]][Rank1], 60"Aspirant");
        
format(ClanInfo[Player[playerid][ClanID]][Rank2], 60"Lieutenant");
        
format(ClanInfo[Player[playerid][ClanID]][Rank3], 60"Capitaines");
        
format(ClanInfo[Player[playerid][ClanID]][Rank4], 60"Generals");
        
format(ClanInfo[Player[playerid][ClanID]][Rank5], 60"Leader");
        
format(ClanInfo[Player[playerid][ClanID]][Rank6], 60"Founder");
        
        
ClanInfo[idz][XP] = 0;
        
ClanInfo[Player[playerid][ClanID]][Active] = true;
        
ClanInfo[Player[playerid][ClanID]][HasSkin] = false;
        
        
        
        
SaveClan(idz);
        
idz MAX_CLANS;
    } 
it should look something like that... I don't know if you redefined how format should be used though I haven't found someone do that so that's how it should workd


Re: Y_INI not creating expect 1 file [REP ++] - Mohaaaaaaaaaaa - 13.09.2017

Does it really matter or would effect since the values are all writing?


Re: Y_INI not creating expect 1 file [REP ++] - Mohaaaaaaaaaaa - 13.09.2017

Tho my problem is whenever for example u can go in game and /createclan then come another guy and /createclan
it doesn't create for example id 0.ini then 1.ini should be there it just deletes the 0 and overwrite on it :*(


Re: Y_INI not creating expect 1 file [REP ++] - Mohaaaaaaaaaaa - 13.09.2017

and yes i redefined how it should be redefined and it write in the .ini so all good