06.11.2012, 20:43
(
Last edited by CrusherCpt; 07/11/2012 at 11:18 AM.
)
O meu sistema de registo salva a password do user diferente da inputtext..
Para fazer login tenho de escrever §..
Code:
User = CrusherCpt Password = § Registado = true Money = 10000 Score = 0 Admin = 0
pawn Code:
//==============================REGISTER====================================
if(dialogid == DIALOG_REGISTER)
{
if(response)
{
if(strlen(inputtext) < 2)
{
new
String[128],
StringT[129];
format(String, sizeof(String), "{FFFFFF}Bem-Vindo{F0D50F} %s{FFFFFF}!!", GetName(playerid));
format(StringT, sizeof(StringT), "__________________________________\n\n{FFFFFF}O user{F0D50F} %s{FFFFFF} nao esta Registado!\n\nA Password tem de ter entre 4 a 35 caracteres..!", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, String, StringT, "Registar", "Sair");
}
else
{
new
Password[64],
StringY[128];
format(StringY, sizeof(StringY), "{FFFFFF}Registas-te o user {F0D50F}'%s' {FFFFFF}com a password {F0D50F}'%s'{FFFFFF}, foste Logado automaticamente!", GetName(playerid), inputtext);
SendClientMessage(playerid, 0x80FF00AA, StringY);
format(Password, sizeof(Password), "%s", inputtext);
PlayerInfo[playerid][pPassword] = Password;
DOF2_CreateFile(GetConta(playerid));
//PlayerInfo[playerid][pPassword] = strlen(inputtext);
DOF2_SetString(GetConta(playerid), "User", GetName(playerid));
DOF2_SetString(GetConta(playerid), "Password", PlayerInfo[playerid][pPassword]);
PlayerInfo[playerid][pRegisto] = true;
PlayerInfo[playerid][pMoney] = 10000;
PlayerInfo[playerid][pScore] = 0;
PlayerInfo[playerid][pAdmin] = 0;
SetPlayerScore(playerid, 0);
GivePlayerMoney(playerid, 10000);
DOF2_SaveFile();
//SalvarConta(playerid);
}
}
else
{
SendClientMessage(playerid, Red, "Registro Cancelado.");
Kick(playerid);
}
}
//==============================LOGIN=======================================
else if(dialogid == DIALOG_LOGIN)
{
if(response)
{
if(strlen(inputtext) >= 2)
{
if(strcmp(DOF2_GetString(GetConta(playerid), "Password", PlayerInfo[playerid][pPassword]), inputtext, true, 10) == 0)
{
new String1[128],
String2[129];
format(String1, sizeof(String1), "{FFFFFF}Bem-Vindo {F0D50F} %s{FFFFFF}!!", GetName(playerid));
format(String2, 179, "__________________________________\n\n{FFFFFF}O user{F0D50F} %s{FFFFFF} esta Logado e Pronto a Jogar!\n\nBom Jogo!!!", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_MSGBOX, String1, String2, "Ok", "");
CarregarConta(playerid);
//SpawnPlayer(playerid);
}
else
{
new String[126],
StringT[127];
format(String, sizeof(String), "{FFFFFF}Bem-Vindo {F0D50F} %s{FFFFFF}!!", GetName(playerid));
format(StringT, 179, "__________________________________\n\n{FFFFFF}O user{F0D50F} %s{FFFFFF} esta Registado!\n\nPassword Errada..!", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, String, StringT, "Login", "Sair");
}
}
}
else
{
SendClientMessage(playerid, Red, "Login Cancelado.");
Kick(playerid);
}
}
pawn Code:
stock SalvarConta(playerid)
{
if(!DOF2_FileExists(GetConta(playerid))) DOF2_CreateFile(GetConta(playerid));
DOF2_SetString(GetConta(playerid), "User", GetName(playerid));
DOF2_SetString(GetConta(playerid), "Password", PlayerInfo[playerid][pPassword]);
DOF2_SetBool(GetConta(playerid), "Registado", PlayerInfo[playerid][pRegisto]);
DOF2_SetInt(GetConta(playerid), "Money", GetPlayerMoney(playerid));
DOF2_SetInt(GetConta(playerid), "Score", GetPlayerScore(playerid));
DOF2_SetInt(GetConta(playerid), "Admin", PlayerInfo[playerid][pAdmin]);
DOF2_SaveFile();
return 1;
}
stock CarregarConta(playerid)
{
GivePlayerMoney(playerid, DOF2_GetInt(GetConta(playerid), "Money"));
SetPlayerScore(playerid, DOF2_GetInt(GetConta(playerid), "Score"));
PlayerInfo[playerid][pAdmin] = DOF2_GetInt(GetConta(playerid), "Admin");
return 1;
}