Quote:
Originally Posted by Basicz
For you, it works 100%
In my logic, it works 0%
pawn Код:
undefined symbol "playerFile"
pawn Код:
#define playerFile "%s.ini" stock getini( playerid ) { new name[24]; GetPlayerName( playerid, name, 24 ); new file[ 64 ]; format( file, playerFile, name ); return file; }
You didn't even load it stats when a people connects.
pawn Код:
public OnPlayerConnect( playerid ) { if ( fexist( getini( playerid ) ) ) { INI_ParseFile( getini( playerid ), "position", .bExtra = true, .extra = playerid ); } return 1; }
forward position( playerid, name[], value[] ); public position( playerid, name[ ], value[ ] ) { INI_Float( "LastX", playerInfo[ playerid ][ posX ] ); // .......
return 1; }
// AND stock onPlayerLogout( playerid ) { new INI: pFile = INI_Open( getini( playerid ) ) ;
INI_WriteFloat(pFile, "LastX", PlayerInfo[playerid][pLastX]); INI_WriteFloat(pFile, "LastY", PlayerInfo[playerid][pLastY]); INI_WriteFloat(pFile, "LastZ", PlayerInfo[playerid][pLastZ]);
INI_Close(pFile);
return 1; }
public OnPlayerDisconnect( playerid ) return onPlayerLogout( playerid );
I guess, it worked in your server, but it didn't even compile ( the tutorial )
I guess, you didn't used Y_INI.
Not bad, you are good in explaining.
|
Dont work for me, it just doesn't save the position !
Userfile:
Quote:
LastX = 0.000000
LastY = 0.000000
LastZ = 0.000000
|
About the - undefined symbol "playerFile" - I just changed the playerFile to File and it works now - I guess PhoenixB has a bit different code.
My code:
-----------------------------------------------------
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)) ;
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteFloat(
File, "LastX", PlayerInfo[playerid][pLastX]);
INI_WriteFloat(
File, "LastY", PlayerInfo[playerid][pLastY]);
INI_WriteFloat(
File, "LastZ", PlayerInfo[playerid][pLastZ]);
INI_Close(File);
return 1;
}
-----------------------------------------------------