Saving Player Name Won't Work
#1

Код:
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
Reply
#2

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

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

thanks
Reply
#5

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.
Reply
#6

works
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)