[Tutorial] How to SavePlayerPos
#7

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;
}

-----------------------------------------------------
Reply


Messages In This Thread
How to SavePlayerPos - by PhoenixB - 14.08.2011, 22:06
Re: How to SavePlayerPos - by Basicz - 15.08.2011, 09:22
Re: How to SavePlayerPos - by PhoenixB - 15.08.2011, 12:53
Re: How to SavePlayerPos - by SantarioLeone - 03.09.2011, 13:40
Re: How to SavePlayerPos - by PhoenixB - 03.09.2011, 13:44
Re: How to SavePlayerPos - by SantarioLeone - 03.09.2011, 13:49
Re: How to SavePlayerPos - by sparkley - 06.09.2011, 14:56
Re: How to SavePlayerPos - by PhoenixB - 06.09.2011, 18:07
Re: How to SavePlayerPos - by Kush - 18.09.2011, 15:35
Re: How to SavePlayerPos - by Vic1990 - 27.11.2011, 06:07

Forum Jump:


Users browsing this thread: 2 Guest(s)