SA-MP Forums Archive
Saving Player Name Won't Work - 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: Saving Player Name Won't Work (/showthread.php?tid=513070)



Saving Player Name Won't Work - AroseKhanNiazi - 14.05.2014

Код:
enum PlayerInfo
{
	playername[24]//user's name
}
Spawn for first time after register
Код:
	new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    pInfo[playerid][playername] = pname;
registry
Код:
new PlayerName[MAX_PLAYER_NAME];
            GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
            new INI:file = INI_Open(Path(playerid)); // we will open a new file for them to save their account inside of Scriptfiles/Users folder
            INI_SetTag(file,"Players_Data");
			INI_WriteString(file,"Name",PlayerName);
auto_Save
Код:
if(playerloggedin[playerid] == 1)
    	{
	     	if(fexist(Path(playerid)))
	        {// then
	        new INI:file = INI_Open(Path(playerid)); //will open their file
	        INI_SetTag(file,"Players_Data");//We will set a tag inside of user's account called "Players_Data"
			INI_WriteInt(file,"Name",pInfo[playerid][playername]);
}
}
Код:
forward loadaccount_Players_Data(playerid, name[], value[]);
public loadaccount_Players_Data(playerid, name[], value[])
{
    INI_String("Name", pInfo[playerid][playername], 24);
return 0;
}
result was Name = 83


Re: Saving Player Name Won't Work - AroseKhanNiazi - 14.05.2014

tried with an other name result is 120
the name one was Sasuke_Uchiha and second was Xeeshan


Re: Saving Player Name Won't Work - Konstantinos - 14.05.2014

pawn Код:
// in auto save
INI_WriteInt(file,"Name",pInfo[playerid][playername]);
It should be INI_WriteString.


Re: Saving Player Name Won't Work - AroseKhanNiazi - 14.05.2014

thanks


Re: Saving Player Name Won't Work - Aerotactics - 14.05.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
// in auto save
INI_WriteInt(file,"Name",pInfo[playerid][playername]);
It should be INI_WriteString.
Damn, beat me to it.

Anyways, you're writing an Integer when you use "WriteInt," which is why you were getting an integer (number) the first time.


Re: Saving Player Name Won't Work - AroseKhanNiazi - 14.05.2014

works