[Ajuda] Setar o Player Normal se nгo tiver registro
#1

Bom pessoal nгo to conseguindo setar o player que nгo tem o sistema de salvamento salvo ou seja um novato que entro ele ta nascendo la na Roзa e eu queria fazer tipo uma variavel que iria ler se existe o salvamento ele nasce onde salvo, Se nгo ele nasce no Setplayerpos, Alguem poderia me ajudar nгo estou conseguindo fazer?

pawn Код:
#include <a_samp>
#include <DOF2>

#define     PLAYER_FILE    "Spawn/%s.ini" //altere para sua pasta/arquivo de players padrгo

new
    bool: g_bool_player_connected [ MAX_PLAYERS ];

public OnFilterScriptExit ( )
{
    DOF2_Exit ( );
    return 1;
}

public OnPlayerConnect ( playerid )
{
    g_bool_player_connected [ playerid ] = true;
    return 1;
}

public OnPlayerSpawn ( playerid )
{
    if ( g_bool_player_connected [ playerid ] )
    {
        new
            Float: flo_old_player_pos [ 3 ],
            Float: flo_old_player_fa,
            int_old_player_int,
            str_player_name [ MAX_PLAYER_NAME ],
            playerFileFormatted[62];
        g_bool_player_connected [ playerid ] = false;
        GetPlayerName ( playerid, str_player_name, sizeof str_player_name );
        format(playerFileFormatted, 62, PLAYER_FILE, str_player_name);
        flo_old_player_pos [ 0 ]  = DOF2_GetFloat ( playerFileFormatted, "Last Pos X" );
        flo_old_player_pos [ 1 ]  = DOF2_GetFloat ( playerFileFormatted, "Last Pos Y" );
        flo_old_player_pos [ 2 ]  = DOF2_GetFloat ( playerFileFormatted, "Last Pos Z" );
        flo_old_player_fa = DOF2_GetFloat ( playerFileFormatted, "Last Pos FA" );
        int_old_player_int = DOF2_GetInt ( playerFileFormatted, "Last Int" );
        SetPlayerPos ( playerid, flo_old_player_pos [ 0 ], flo_old_player_pos [ 1 ], flo_old_player_pos [ 2 ] );
        SetPlayerFacingAngle ( playerid, flo_old_player_fa );
        SetPlayerInterior ( playerid, int_old_player_int );
    }
    return 1;
}

public OnPlayerDisconnect ( playerid )
{
    new
        str_player_name [ MAX_PLAYER_NAME ],
        Float: flo_player_pos [ 3 ],
        Float: flo_player_fa,
        int_player_int = GetPlayerInterior ( playerid ),
        playerFileFormatted[62];

    GetPlayerPos ( playerid, flo_player_pos [ 0 ], flo_player_pos [ 1 ], flo_player_pos [ 2 ] );
    GetPlayerFacingAngle ( playerid, flo_player_fa );
    GetPlayerName ( playerid, str_player_name, sizeof str_player_name );

    format(playerFileFormatted, 62, PLAYER_FILE, str_player_name);

    if ( !DOF2_FileExists ( playerFileFormatted ) )
        DOF2_CreateFile ( playerFileFormatted );

    DOF2_SetFloat ( playerFileFormatted, "Last Pos X", flo_player_pos [ 0 ] );
    DOF2_SetFloat ( playerFileFormatted, "Last Pos Y", flo_player_pos [ 1 ] );
    DOF2_SetFloat ( playerFileFormatted, "Last Pos Z", flo_player_pos [ 2 ] );
    DOF2_SetFloat ( playerFileFormatted, "Last Pos FA", flo_player_fa );
    DOF2_SetInt ( playerFileFormatted, "Last Int", int_player_int );

    DOF2_SaveFile ( );

    return 1;
}
Obs: Este filterscript foi feito pelo nosso amigo Lуs, no forum https://sampforum.blast.hk/showthread.php?tid=409002
Reply
#2

Eu estava atualizando o script, e ele vai corrigir este erro, creio que hoje ou amanhг devo postar a atualizaзгo, seguido com a atualizaзгo do LHouse tambйm. Esse erro foi corrigido.
Reply
#3

Vlw Lуs s2 Brother ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)