07.06.2011, 00:09
pawn Код:
if(dialogid == logueo || dialogid == fallopass)
{
if(strlen(inputtext))
{
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
new Nombre[MAX_PLAYERS];
new file[MAX_PLAYERS];
GetPlayerName(playerid, Nombre, sizeof(Nombre));
format(file, sizeof(file), "%s.ini", Nombre);
if(fexist(file))
{
if(strval(tmppass))
{
IsLogged[playerid] = 1;
PlayerInfo[playerid][pAdmin] = dini_Int(file, "Admin");
PlayerInfo[playerid][pKills] = dini_Int(file, "Kills");
PlayerInfo[playerid][pBank] = dini_Int(file, "Banco");
PlayerInfo[playerid][pDeaths] = dini_Int(file, "Deaths");
PlayerInfo[playerid][pLogins] = dini_Int(file, "Logins");
PlayerInfo[playerid][pMats] = dini_Int(file, "Materiales");
PlayerInfo[playerid][pDrugs] = dini_Int(file, "Drogas");
SetPlayerArmour(playerid,PlayerInfo[playerid][pArmour]);
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
PlayerInfo[playerid][pLogins] ++;
SendClientMessage(playerid, COLOR_GREEN, "Te has identificado exitosamente.");
}
else
{
new loginstring[128];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"WRONG PASSWORD \n Por favor introduzca la contraseсa correcta:",loginname);
ShowPlayerDialog(playerid,fallopass,DIALOG_STYLE_INPUT,"Loguear",loginstring,"Loguear","Salir");
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 4) { Kick(playerid); }
}}}}
if(dialogid == registro)
{
if(strlen(inputtext))
{
new Nombre[MAX_PLAYERS];
new file[MAX_PLAYERS];
GetPlayerName(playerid, Nombre, sizeof(Nombre));
format(file, sizeof(file), "%s.ini", Nombre);
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(tmppass));
dini_IntSet(file, "Banco", 0);
dini_IntSet(file, "Admin", 0);
dini_IntSet(file, "Asesinatos", 0);
dini_IntSet(file, "Muertes", 0);
dini_IntSet(file, "Dinero", 0);
dini_IntSet(file, "Logins", 1);
dini_IntSet(file, "Materiales",0);
dini_IntSet(file, "Drogas",0);
dini_IntSet(file, "Chaleco",0);
PlayerInfo[playerid][pAdmin] = dini_Int(file, "Admin");
PlayerInfo[playerid][pKills] = dini_Int(file, "Kills");
PlayerInfo[playerid][pBank] = dini_Int(file, "Banco");
PlayerInfo[playerid][pDeaths] = dini_Int(file, "Deaths");
PlayerInfo[playerid][pLogins] = dini_Int(file, "Logins");
PlayerInfo[playerid][pCash] = dini_Int(file, "Dinero");
PlayerInfo[playerid][pMats] = dini_Int(file, "Materiales");
PlayerInfo[playerid][pDrugs] = dini_Int(file, "Drogas");
PlayerInfo[playerid][pArmour] = dini_Int(file, "Chaleco");
format(String, sizeof(file), "Cuenta creada exitosamente! %s - ''%s''", Nombre, tmppass);
SendClientMessage(playerid, 0xFFFFFFFF, String);
SendClientMessage(playerid, 0xFFFFFFFF, "Has sido identificado automбticamente");
IsLogged[playerid] = 1;
}
else
{
new regstring[128];
new regname[64];
GetPlayerName(playerid,regname,sizeof(regname));
format(regstring,sizeof(regstring),"Bienvenido, %s\nNo tienes una cuenta.\nPor favor regнstrese:",regname);
ShowPlayerDialog(playerid,registro,DIALOG_STYLE_INPUT,"Registrar",regstring,"Registrar","Salir");
}
}
else
{
Kick(playerid);
}}

