10.06.2011, 19:01
tente
e crie a pasta Accounts, caso queira sem pasta basta mudar o
para
pawn Code:
#define Accounts Accounts/%s.ini
if(strcmp(cmd, "/registrar", true) == 0)
{
new Account[40],Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
format(Account,sizeof(Account),Accounts,Name);
tmp = strtok(cmdtext, idx);
if (!dini_Exists(udb_encode(Account)))
{
return SendClientMessage(playerid,-1,"Error:Conta jб cadastrada.");
}
if(20 < strlen(tmp) || strlen(tmp) < 4)
{
return SendClientMessage(playerid, COLOR_CYAN, "[RTX] INFORMA: Sua senha tem que ter mais de 4 e menos de 20 letras/nъmeros!");
}
else if(!strlen(tmp))
{
return SendClientMessage(playerid, COLOR_CYAN, "Uso correto: /registrar [senha] ~ Vai fazer com que vocк fique registrado com o server e seus stats sejam salvos!");
}
else
{
dini_Create(udb_encode(Account));
dini_IntSet(udb_encode(Account),"pass",udb_hash(tmp));
dini_Set(udb_encode(Account),"senha",tmp);
PlayerInfo[playerid][pAdmin] = 0;
PlayerInfo[playerid][pVIP] = 0;
PlayerInfo[playerid][pADA] = 0;
PlayerInfo[playerid][pTCP] = 0;
PlayerInfo[playerid][pPCC] = 0;
PlayerInfo[playerid][pRRB] = 0;
PlayerInfo[playerid][pEX] = 0;
PlayerInfo[playerid][pBOPE] = 0;
PlayerInfo[playerid][pGOE] = 0;
PlayerInfo[playerid][pCV] = 0;
format(string, sizeof(string), "%s(%i) registrado com a senha \"%s\"",Name,playerid,tmp);
printf(string);
format(string, sizeof(string), "Vocк criou a conta %s com a senha \"%s\". Nгo se esqueзa da sua senha!",Name,tmp);
SendClientMessage(playerid, COLOR_CYAN, string);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
ShowPlayerDialog(playerid, 60, DIALOG_STYLE_LIST, "Bem vindo(a), escolha uma facзгo", "Comando Vermelho - [CV]\nAmigos dos Amigos - [ADA]\nTerceiro Comando Puro - [TCP]\nPrimeiro Comando da Capital - [PCC]", "Selecionar", "");
}
return true;
}
else if(strcmp(cmd, "/login", true) == 0)
{
new Account[40],Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
format(Account,sizeof(Account),Accounts,Name);
tmp = strtok(cmdtext, idx);
if(logged[playerid] == 1)
{
return SendClientMessage(playerid, COLOR_CYAN, "Vocк jб estб logado!");
}
if(!strlen(tmp))
{
return SendClientMessage(playerid, COLOR_GREEN, "Uso correto: [senha]");
}
else if(dini_Exists(udb_encode(Account)))
{
if(udb_hash(tmp) != dini_Get(udb_encode(Account),"pass"))
{
SendClientMessage(playerid,-1,"Error: Senha incorreta.");
}
else
{
logged[playerid] = 1;
logado[playerid] = 1;
dini_Set(udb_encode(Account),"senha",tmp);
PlayerInfo[playerid][pAdmin] = dini_Int(udb_encode(Account),"level");
PlayerInfo[playerid][pPMs] = dini_Int(udb_encode(Account),"SeePMs");
PlayerInfo[playerid][pVIP] = dini_Int(udb_encode(Account),"levelvip");
PlayerInfo[playerid][pADA] = dini_Int(udb_encode(Account),"levelada");
PlayerInfo[playerid][pTCP] = dini_Int(udb_encode(Account),"leveltcp");
PlayerInfo[playerid][pBOPE] = dini_Int(udb_encode(Account),"levelbope");
PlayerInfo[playerid][pEX] = dini_Int(udb_encode(Account),"levelex");
PlayerInfo[playerid][pPCC] = dini_Int(udb_encode(Account),"levelpcc");
PlayerInfo[playerid][pRRB] = dini_Int(udb_encode(Account),"levelrrb");
PlayerInfo[playerid][pGOE] = dini_Int(udb_encode(Account),"levelgoe");
PlayerInfo[playerid][pCV] = dini_Int(udb_encode(Account),"levelcv");
GameTextForPlayer(playerid, "~G~ LOGADO COM SUCESSO!",2000,1);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
if(PlayerInfo[playerid][pAdmin] == 0)
{
SendClientMessage(playerid,COLOR_BLUE,"--------------------------");
SendClientMessage(playerid,COLOR_BLUE,"Membro Normal");
format(string,sizeof(string),"Logado como: %s",Name);
SendClientMessage(playerid,COLOR_BLUE,string);
}
}
return true;
}
pawn Code:
#define Accounts
pawn Code:
#define Accounts %s.ini