Name change wrong (INI problem!)
#1

Hey guys!

I want to change a name IG so I created a system where a dialog pops up and you can change a name after you entered the rank number (which is stored in the PVaR). that works but saving and loading the name goes wrong!

Here's the code:

At Dialog:
Код:
		    new i = PlayerInfo[playerid][pFaction];
			if(GetPVarInt(playerid, "FrankEdit") == 1)
			{
		    	strcat(FactionInfo[i][fRank1], inputtext);
			}
SaveFactions(i);
The savefactions function:
Код:
stock SaveFactions(id)
{
	new dFile[128];
	format(dFile, sizeof(dFile),"Factions/%i.ini",id);
	new
	INI:File = INI_Open(dFile);
	INI_WriteString(File, "Name", FactionInfo[id][fName]);
	INI_WriteString(File, "fRank1", FactionInfo[id][fRank1]);
	INI_WriteString(File, "fRank2", FactionInfo[id][fRank2]);
	INI_WriteString(File, "fLeader", FactionInfo[id][fLeader]);

	INI_Close(File);
	return 1;
}
And last but not least the loading function:

Код:
forward LoadFactions(id, name[], value[]);
public LoadFactions(id, name[], value[])
{
		INI_String("Name",FactionInfo[id][fName],529);
		INI_String("fLeader",FactionInfo[id][fLeader],256);
		INI_String("fRank1",FactionInfo[id][fRank1],256);
                INI_String("fRank2",FactionInfo[id][fRank2],256);

		return 1;
}
Another weird thing. When SaveFactions is called, the fleader goes to default instead of saving the name of the player..

Anyone who can help me? This is a big problem :P.
Reply
#2

Try this
pawn Код:
//Change this
INI_WriteString(File, "Name", FactionInfo[id][fName]);
//to this
new name[24];
GetPlayerName(id,name,24);
INI_WriteString(File, "Name", name);
Reply
#3

fname = just the faction name, not the leader :P
fleader = the leader name which gets erased.
Reply
#4

Anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)