if (strcmp(cmd, "/logar", false) ==0 )
{
if(IsPlayerConnected(playerid))
{
new tmppass[64];
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк jб estб logado.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USO: /logar [senha]");
return 1;
}
strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
Encrypt(tmppass);
FixBug[playerid] = 60;
OnPlayerLogin(playerid,tmppass);
}
return 1;
}
if (strcmp(cmd, "/registrar", false) ==0 )
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "|Rpg Rio|: Vocк jб fez o Login");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Contas/%s.ini", sendername);
new File: hFile = fopen(string, io_read);
if (hFile)
{
SendClientMessage(playerid, COLOR_YELLOW, "O nickname jб existe, volte com outro.");
fclose(hFile);
return 1;
}
new tmppass[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USO: /registrar [senha] [email]");
return 1;
}
if(strlen(tmp) < 0 || strlen(tmp) > 15)
{
SendClientMessage(playerid, COLOR_GRAD1,"O numero de letras/numeros de sua senha deve estar entre 0 e 15!");
return 1;
}
new senha[15];
strmid(senha,tmp,0,strlen(tmp),255);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USO: /registrar <senha> <email>");
return 1;
}
if(strfind(tmp,"@",true,1)==-1)
{
SendClientMessage(playerid, COLOR_GRAD1,"O email digitado nгo й vбlido.");
return 1;
}
new File:eFile = fopen("Cfg/emails.cfg", io_append);
format(string,256,"%s - %s\r\n", sendername, tmp);
fwrite(eFile,string);
fclose(eFile);
strmid(tmppass, senha, 0, strlen(senha), 255);
Encrypt(tmppass);
OnPlayerRegister(playerid,tmppass);
}
return 1;
}
|