14.05.2013, 19:52
Alguem min ajuda porfavor, esse fs nгo esta carregando e nem salvando as contas.
Mas ele nгo da erro.
OBS: Tenho no scriptfile a pasta Contas .
Mas ele nгo da erro.
OBS: Tenho no scriptfile a pasta Contas .
PHP код:
#include <a_samp>
#include <dini>
#define DIALOG_REGISTRO 1
#define DIALOG_LOGIN 2
#define CONTAS "Contas/%s.ini"
#define Amarelo 0xFFFF00AA
#define Vermelho 0xFF0000AA
#define Verde 0x00FF00AA
#define TXT_RLOGIN "{FFFFFF}Bem Vindo novamente!\nNick: {FFFF00}%s \n{FFFFFF}Status: {00FF00}Registrado"
#define TXT_LOGIN "{FFFFFF}Bem Vindo novamente!\nNick: {FFFF00}%s \n{FFFFFF}Status: {00FF00}Registrado"
#define TXT_NREGISTER "{FFFFFF}Registre sua conta!\nNick: {FFFF00}%s \n{FFFFFF}Status: {FF0000}Nгo Resistrado"
#define TXT_RL "{00FF00}Registrado com sucesso! \n{FFFF00}Digite sua senha e divirta-se. "
new TotalMatou[MAX_PLAYERS];
new TotalMorreu[MAX_PLAYERS];
new TotalLogou[MAX_PLAYERS];
forward SalvarLevel(playerid);
forward CarregarLevel(playerid);
public OnFilterScriptInit()
{
print("\n\n__________________________________________________________________");
print(" Sistema de registro MTO loaded!");
print(" By : mau_tito");
print(" ---------------------------");
return 1;
}
public OnFilterScriptExit()
{
print("\n\n__________________________________________________________________");
print(" Sistema de registro MTO loaded!");
print(" By : mau_tito");
print(" ---------------------------");
return 1;
}
SalvarPlayer(playerid)
{
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof(Nome));
new String[50];
format(String, sizeof(String), CONTAS, Nome);
dini_IntSet(String,"Dinheiro", GetPlayerMoney(playerid));
dini_IntSet(String,"Score", GetPlayerScore(playerid));
dini_IntSet(String,"Total Matou", TotalMatou[playerid]);
dini_IntSet(String,"Total Morreu", TotalMorreu[playerid]);
dini_IntSet(String,"Total Logou", TotalLogou[playerid]);
return 1;
}
CarregarPlayer(playerid)
{
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof(Nome));
new String[50];
format(String, sizeof(String), CONTAS, Nome);
GivePlayerMoney(playerid, dini_Int(String,"Dinheiro"));
SetPlayerScore(playerid , dini_Int(String,"Score" ));
TotalMatou[playerid] = dini_Int(String, "Total Matou");
TotalMorreu[playerid] = dini_Int(String, "Total Morreu");
TotalLogou[playerid] = dini_Int(String, "Total Logou");
return 1;
}
public OnGameModeExit()
{
for(new i=0; i<MAX_PLAYERS; i++)
SalvarPlayer(i);
return 1;
}
public OnPlayerConnect(playerid)
{
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof(Nome));
new String[100];
format(String, sizeof(String), CONTAS, Nome);
if(!dini_Exists(String))
{
format(String, sizeof(String), TXT_NREGISTER, Nome);
ShowPlayerDialog(playerid, DIALOG_REGISTRO, 3, "Registro", String, "Registrar", "Cancelar");
}
else
{
format(String, sizeof(String),TXT_LOGIN, Nome);
ShowPlayerDialog(playerid, DIALOG_LOGIN, 3, "Registro Com Sucesso", String, "Logar", "Cancelar");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SalvarPlayer(playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerConnected(killerid))
{
TotalMatou[killerid]++;
}
TotalMorreu[playerid]++;
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_REGISTRO)
{
if(response)
{
if(!strlen(inputtext))
{
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof(Nome));
new String[1000];
format(String, sizeof(String), TXT_NREGISTER, Nome);
ShowPlayerDialog(playerid, DIALOG_REGISTRO, 3, "Registro", String, "Registrar", "Cancelar");
SendClientMessage(playerid,0x1E90FFAA,"Senha incorreta !!");
return 1;
}
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof(Nome));
new String[100];
format(String, sizeof(String), CONTAS, Nome);
dini_Create(String);
dini_Set(String,"Senha",inputtext);
dini_IntSet(String,"Dinheiro",0);
dini_IntSet(String,"Dinheiro",1);
dini_IntSet(String,"Vida",50);
dini_IntSet(String,"TotalMatou",0);
dini_IntSet(String,"Total Morreu",0);
dini_IntSet(String,"Total Logou",0);
ShowPlayerDialog(playerid, DIALOG_LOGIN, 3, "Login", TXT_RL, "Logar", "Cancelar");
return 1;
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Vocк foi kickado||Motivo: Nгo quer se registrar");
Kick(playerid);
return 1;
}
}
if(dialogid == DIALOG_LOGIN)
{
if(response)
{
if(!strlen(inputtext))
{
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof(Nome));
new String[1000];
format(String, sizeof(String),TXT_LOGIN, Nome);
ShowPlayerDialog(playerid, DIALOG_LOGIN, 3, "Registro", String, "Logar", "Cancelar");
SendClientMessage(playerid,0x1E90FFAA,"Senha Incorreta !");
return 1;
}
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof(Nome));
new String[100];
format(String, sizeof(String), CONTAS, Nome);
if(!strcmp(inputtext,dini_Get(String,"Senha"),false))
{
CarregarPlayer(playerid);
TotalLogou[playerid]++;
SpawnPlayer(playerid);
return 1;
}
else
{
SendClientMessage(playerid,0x00FF00AA,"Senha incorreta digite-a novamente");
format(String, sizeof(String), TXT_RLOGIN, Nome);
ShowPlayerDialog(playerid, DIALOG_LOGIN, 3, "Registro", String, "Logar", "Cancelar");
}
return 1;
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Vocк foi kickado||Motivo: Nгo quer logar");
Kick(playerid);
return 1;
}
}
return 0;
}