18.08.2015, 23:44
(
Последний раз редактировалось Lуs; 19.08.2015 в 14:04.
)
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?
#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;
}