[Pedido] Salvamento
#1

Eae galera, estou procurando um sistema que salve score e grana em dof2, alguйm conhece algum ou esteja afim de me ensinar a fazer o meu prуprio?
Reply
#2

pawn Код:
#include <  a_samp   >
#include <  DOF2     >
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                   VARIБVEIS & DEFINIЗХES
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

#define pContas "Players/%s.ini"
enum pInfo
{
    pMatou,
    pMorreu
}

new PlayerInfo[MAX_PLAYERS][pInfo];
new Celulas[128];
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                            PUBLICS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

public OnGameModeExit()
{
    for(new i=0; i<MAX_PLAYERS; i++) {
        SConta(i);
    }
    DOF2_Exit();
    return true;
}

public OnPlayerDisconnect(playerid, reason)
{
    SConta(playerid);
    return true;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerConnected(killerid)) {
        PlayerInfo[killerid][pMatou]++;
    }
    PlayerInfo[playerid][pMorreu]++;
    return true;
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                        ADAPTE AO SEU GM
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */


// Apуs o player se registrar no server
format(SalvarContas, sizeof(SalvarContas), pContas, Nome(playerid));
DOF2_CreateFile(SalvarContas);
DOF2_SetInt(SalvarContas, "Dinheiro", 0);

// Apуs o login
format(SalvarContas, sizeof(SalvarContas), pContas, Nome(playerid));
GivePlayerMoney(playerid, DOF2_GetInt(SalvarContas, "Dinheiro"));
DOF2_SaveFile();

//Final do gamemode
SConta(playerid)
{
    format(SalvarContas, sizeof(SalvarContas), pContas, Nome(playerid));
    DOF2_SetInt(SalvarContas,"Dinheiro", GetPlayerMoney(playerid));
    DOF2_SaveFile();
    return true;
}

stock Nome(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    return name;
}
Reply
#3

Obg LS
Reply
#4

Quote:
Originally Posted by BartWhite
Посмотреть сообщение
Obg LS
De nada
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)