Li todo o tutorial do Desvendando o DOF2 Delk.
Agora como que faiz pra salvar tipo grana e pб?? Eu sei que й com o DOF2_GetInt(file[],key[],tag[]="")
Minha GM:
// Includes
#include <a_samp>
#include "../include/gl_common.inc"
#include <DOF2>
main()
{
printf("Servidor de teste Ligado");
}
/* Variaveis */
public OnPlayerConnect(playerid)
{
new str[128], name[32];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str),"%s.ini", name);
DOF2_CreateFile(str);
// Verificaзгo se o arquivo jб existe
new string[128], Nome[32];
GetPlayerName(playerid, Nome, sizeof(Nome));
format(string, sizeof(string), "%s.ini", Nome);
if(!DOF2_FileExists(string)) DOF2_CreateFile(string);
return 1;
}
public OnPlayerDisconnect(playerid)
{
new Salvar[128], NomeSalvar[128];
GetPlayerName(playerid, NomeSalvar, sizeof(NomeSalvar));
format(Salvar, sizeof(Salvar), "%s.ini", NomeSalvar);
DOF2_CreateFile(Salvar);
DOF2_SaveFile();
SalvarPlayer(playerid);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
if(strcmp(cmd, "/comeзo", true) ==0)
{
new Passado[128], Futuro[128];
format(Passado, sizeof(Passado), "%s.ini");
format(Futuro, sizeof(Futuro), "%s.ini");
DOF2_CreateFile(Passado);
DOF2_RenameFile(Passado, Futuro);
return 1;
}
if(strcmp(cmd, "/removerfile", true) ==0)
{
new Remover[128];
format(Remover, sizeof(Remover), "Contas/%s.ini");
DOF2_RemoveFile(Remover);
return 1;
}
return 0;
}
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
DOF2_Exit();
return 1;
}
public OnPlayerText(playerid, text[])
{
new String[256], Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof(Nome));
format(String, sizeof(String), "» %s[%d] digitou: %s", Nome, playerid, text);
SendClientMessageToAll(-1, String);
return 1;
}
stock GerarNome(playerid)
{
new CriarNome[MAX_PLAYER_NAME];
GetPlayerName(playerid, CriarNome, sizeof(CriarNome));
return 0;
}
stock SalvarPlayer(playerid)
{
return 1;
}