[Duvida] Salvamento -
Luciano* - 12.08.2012
Estou com o seguinte problema, quando alguem erra a senha й kickado mais quando ela volta e coloca a senha correta a conta dela й resetada, alguem poderia me dizer se tem algo de errado com este codigo?
PHP код:
if(dialogid == Dialog_Registro) {
if(response) {
if(!strlen(inputtext)) return ShowPlayerDialog(playerid,Dialog_Registro,DIALOG_STYLE_INPUT,"Registro","{CFCFCF}Digite uma senha para se registrar","Registrar","Cancelar");
if(strlen(inputtext) < 3 || strlen(inputtext) > 15) return ShowPlayerDialog(playerid,Dialog_Registro,DIALOG_STYLE_PASSWORD,"{CFCFCF}Registro","A senha deve ter de 3 a 15 caracteres","Registrar","Cancelar");
new string[70];
format(string,sizeof(string),"Conta registrada com sucesso! Senha: {F6E500}%s", inputtext);
SendClientMessage(playerid,-1,string);
DOF2_CreateFile(ReturnFileUser(playerid));
DOF2_SetString(ReturnFileUser(playerid),"Senha",inputtext);
GivePlayerMoney(playerid, 10000);
SetPlayerScore(playerid,10);
DOF2_SaveFile();
}
return 1;
}
if(dialogid == Dialog_Login) {
if(response) {
if(!strlen(inputtext)) return ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_INPUT,"Login","{CFCFCF}Digite sua senha","Logar","Cancelar");
if(strcmp(inputtext,DOF2_GetString(ReturnFileUser(playerid),"Senha"),true) == 0) {
GivePlayerMoney(playerid, 1000);
CarregarPlayer(playerid);
SendClientMessage(playerid,0x2CB60AAA,"» Logado com sucesso!");
}
else {
if(SenhaErrada[playerid] == 4) {
SendClientMessage(playerid,0xC5B43AAA,"[ERRO]: Vocк foi kickado por errar a senha 5 vezes!");
Kick(playerid);
}
else if(SenhaErrada[playerid] < 4) {
SenhaErrada[playerid] ++;
ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_INPUT,"Login","{FF0000}Senha incorreta\n{CFCFCF}Se errar 5 vezes serб banido.","Logar","Sair");
}
}
}
else if(!response) {
SendClientMessage(playerid,0xC5B43AAA,"Vocк foi kickado por nгo logar");
Kick(playerid);
}
return 1;
}
Obs: Segui o tutorial da Humildadeforever
Re: [Duvida] Salvamento -
.ThePro - 12.08.2012
Manda o CarregarPlayer
Verifica se nгo estб resetando as variбveis, se estiver coloca o carregar player depois de resetalas
Hospedagem SA-MP!
Atualmente temos a taxa de ping mais instбvel do mercado SA-MP no Brasil.
www.inetjogos.com.br
Respuesta: [Duvida] Salvamento -
Luciano* - 12.08.2012
Esta aqui;
PHP код:
//Salvamento
stock SalvarPlayer(playerid)
{
if(DOF2_FileExists(ReturnFileUser(playerid))) {
DOF2_SetInt(ReturnFileUser(playerid),"Level",GetPlayerScore(playerid));
DOF2_SetInt(ReturnFileUser(playerid),"Dinheiro",GetPlayerMoney(playerid));
DOF2_SetInt(ReturnFileUser(playerid),"Admin Level",PlayerDados[playerid][pAdmin]);
DOF2_SetInt(ReturnFileUser(playerid),"Skin",GetPlayerSkin(playerid));
DOF2_SetInt(ReturnFileUser(playerid),"VIP", PlayerDados[playerid][pVIP]);
DOF2_SaveFile();
}
}
//Salvamento
stock CarregarPlayer(playerid)
{
if(DOF2_FileExists(ReturnFileUser(playerid))) {
SetPlayerScore(playerid, DOF2_GetInt(ReturnFileUser(playerid), "Level"));
SetPlayerMoney(playerid, DOF2_GetInt(ReturnFileUser(playerid), "Dinheiro"));
PlayerDados[playerid][pAdmin] = DOF2_GetInt(ReturnFileUser(playerid),"Admin Level");
SetPlayerSkin(playerid, DOF2_GetInt(ReturnFileUser(playerid),"Skin"));
PlayerDados[playerid][pVIP] = DOF2_GetInt(ReturnFileUser(playerid),"VIP");
}
}
Respuesta: [Duvida] Salvamento -
Luciano* - 12.08.2012
Desculpe o duplo post, mais alguem sabe se tem algo de errado?
Respuesta: [Duvida] Salvamento -
AnonymouSs - 12.08.2012
Eu tambйm estou com esse problema, acredito que seja algo bem simples, mas mesmo assim nгo consegui corrigir.
Respuesta: [Duvida] Salvamento -
Luciano* - 12.08.2012
Eu achei que era conflito assim como o Don_Speed me disse, mais mudei o ID das dialogs e nгo adiantou!
Re: [Duvida] Salvamento -
humildadeforever - 12.08.2012
Posta a OnPlayerDisconnect e a OnPlayerConnect
Respuesta: [Duvida] Salvamento -
Luciano* - 12.08.2012
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
NoEvento[playerid] = false;
SalvarPlayer(playerid);
KillTimer(godcarTimer[playerid]);
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) {
Delete3DTextLabel(Incar[playerid]);
}
if(DonoCarro[playerid] != INVALID_VEHICLE_ID) {
DestroyVehicle(DonoCarro[playerid]);
}
new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
switch(reason) {
case 0: format(string, sizeof(string), "%s saiu do servidor. (Net/Crash)", pname);
case 1: format(string, sizeof(string), "%s saiu do servidor. (Saiu)", pname);
case 2: format(string, sizeof(string), "%s saiu do servidor. (Kick/Ban)", pname);
}
SendClientMessageToAll(0x778899FF, string);
switch(reason) {
case 0..2: KillTimer(TimerFPS[playerid]);
}
return 1;
}
No OnPlayerConnect
PHP код:
//Salvamento
if(!DOF2_FileExists(ReturnFileUser(playerid))) ShowPlayerDialog(playerid, Dialog_Registro, DIALOG_STYLE_PASSWORD,"-| Bem vindo |-","{CFCFCF}Conta:{FF0000} Nгo registrada\n \n{CFCFCF}Digite uma senha para se registrar:", "Registrar","Quit");
else if(DOF2_FileExists(ReturnFileUser(playerid))) ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_PASSWORD,"[Login]", "{CFCFCF}Olб, Seja bem-vindo ao nosso servidor\n \n{CFCFCF}Conta:{00FF00} Registrada\n{CFCFCF}Digite sua senha para logar:", "Logar","Quit");
Re: [Duvida] Salvamento -
humildadeforever - 12.08.2012
Pra comeзar coloque
pawn Код:
SenhaErrada[playerid] = 0;
Depois da funзгo de salvar.
Vou analisar o resto do code.
Respuesta: [Duvida] Salvamento -
Luciano* - 12.08.2012
Ok, estarei aguardando...