Jump to content
  • 0

REgister parola


WiDuAlK

Question

Nick: WiDuAlK

Problema: parola criptata

Erori / warnings: -

Lini/script:[pawn]#include <a_samp>

#include <Dini>

#include <dutils>

#define LIGHTBLUE "{00CED1}"

#define ALB "{ffffff}"

#define RED "{F81414}"

#define GREEN "{00FF22}"

#define COLOR_GREY 0xAFAFAFAA

#pragma unused ret_memcpy

#pragma unused strtok

forward OnPlayerLogin(playerid,password[]);

forward OnPlayerUpdate(playerid);

forward OnPlayerRegister(playerid, password[]);

enum pInfo

{

Pass,

Level,

Money

};

new PlayerInfo[MAX_PLAYERS][pInfo];

new gPlayerLogged[MAX_PLAYERS];

new gPlayerLogTries[MAX_PLAYERS];

new gPlayerAccount[MAX_PLAYERS];

new Typed[MAX_PLAYERS][64];

public OnGameModeInit()

{

SetGameModeText("TEST v1.0");

print("\n--------------------------------------");

print("Login & Register system. Made by pantelimonfl");

print("--------------------------------------\n");

AddPlayerClass(1,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(2,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(269,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(270,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(271,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(272,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(47,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(48,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(49,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(50,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(51,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(52,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(53,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(54,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(55,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(56,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(57,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

AddPlayerClass(58,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

  AddPlayerClass(68,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);

return 1;

}

public OnGameModeExit()

{

return 1;

}

public OnPlayerConnect(playerid)

{

    new string[128];

    new plname[MAX_PLAYER_NAME];

  GetPlayerName(playerid, plname, sizeof(plname));

PlayerInfo[playerid][Level] = 0;

PlayerInfo[playerid][Money] = 0;

    format(string, sizeof(string), "%s.ini", plname);

    if(dini_Exists(string))

{

gPlayerAccount[playerid] = 1;

}

else

{

gPlayerAccount[playerid] = 0;

}

return 1;

}

public OnPlayerRequestClass(playerid, classid)

{

ShowPlayerDialog(playerid,1234, DIALOG_STYLE_MSGBOX,""GREEN"Reguli",""ALB"Nu folosi un limbaj vulgar!\n"ALB"Nu face reclama altor servere\n"ALB"Nu iti da id-ul pe chat","Accept","Refuz");

    SetPlayerCameraPos(playerid, 1890.1014,-1194.7969,25.8091);

SetPlayerCameraLookAt(playerid, 1933.4393,-1196.2479,18.8163);

return 1;

}

public OnPlayerRegister(playerid, password[]) // [] isn't needed as the password is a integer (whole number)

{

    if(IsPlayerConnected(playerid))

    {

        new file[64];

        new playername3[MAX_PLAYER_NAME];

        GetPlayerName(playerid, playername3, sizeof(playername3));

        format(file, sizeof(file), "%s.ini", playername3);

        if(dini_Exists(file))

        {

            return SendClientMessage(playerid,COLOR_GREY,"This account is already registered.");

        }

        else

        {

            dini_Create(file);

            new password2 = num_hash(password);

            PlayerInfo[playerid][Pass] = password2;

            dini_IntSet(file, "Password",password2);

            dini_IntSet(file, "Level",PlayerInfo[playerid][Level]);

            dini_IntSet(file, "Money",PlayerInfo[playerid][Money]);

            ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Bun Venit",""ALB"Cont inregistrat cu succes!\n"ALB"Scrie parola ta mai jos pentru a te loga","Log-in","Quit");

        }

    }

    return 1;

}

public OnPlayerUpdate(playerid)

{

if(IsPlayerConnected(playerid))

{

    if(gPlayerLogged[playerid] == 1)

    {

new string3[64];

new playername3[MAX_PLAYER_NAME];

GetPlayerName(playerid, playername3, sizeof(playername3));

format(string3, sizeof(string3), "%s.ini", playername3);

dini_IntSet(string3, "Password",PlayerInfo[playerid][Pass]);

dini_IntSet(string3, "Level",PlayerInfo[playerid][Level]);

dini_IntSet(string3, "Money",PlayerInfo[playerid][Money]);

}

}

return 1;

}

public OnPlayerLogin(playerid,password[])

{

new string2[64];

new playername3[MAX_PLAYER_NAME];

GetPlayerName(playerid, playername3, sizeof(playername3));

format(string2, sizeof(string2), "%s.ini", playername3);

if (dini_Exists(string2))

{

    new password2 = num_hash(password);

if(dini_Int(string2,"Password") == password2)

{

    PlayerInfo[playerid][Pass] = dini_Int(string2,"Password");

    PlayerInfo[playerid][Level] = dini_Int(string2,"Level");

PlayerInfo[playerid][Money] = dini_Int(string2,"Money");

}

else

{

        gPlayerLogTries[playerid] += 1;

        ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Mai incearca!",""ALB"Ai introdus o parola gresita\n"ALB"Scrie-ti parola pentru a te loga!","Log-in","Quit");

        if(gPlayerLogTries[playerid] == 3) { Kick(playerid); }

        return 1;

}

    }

return 1;

}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{

    if(dialogid == 1234)

{

    if(response)

    {

        new playername[MAX_PLAYER_NAME];

        GetPlayerName(playerid, playername, sizeof(playername));

        new string[64];

        format(string, sizeof(string), "%s.ini", playername);

if (dini_Exists(string))

{

ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Bun venit. Te rugam sa te loghezi.",""ALB"Scrie parola ta aici pentru a te loga","Log-in","Quit");

}

else

{

ShowPlayerDialog(playerid, 1246, DIALOG_STYLE_INPUT,""ALB"Te rugam sa te inregistrezi!",""ALB"Scrie parola ta aici pentru a te inregistra.","Register","Quit");

}

}

else

{

    SendClientMessage(playerid, COLOR_GREY,"*Ai refuzat. Trebuie sa accepti regulile pentru a juca");

Kick(playerid);

}

}

if(dialogid == 1245)

{

    if(response)

    {

        strmid(Typed[playerid], inputtext, 0, strlen(inputtext), 255);

        if(!strcmp(Typed[playerid], "None", true))

{

ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Incerca din nou.",""ALB"Nu ai introdus o parola!\n"ALB"Scrie-ti parola mai jos pentru a te inregistra","Log-in","Quit");

  }

  else

  {

        OnPlayerLogin(playerid, inputtext);

}

}

else

{

    Kick(playerid);

}

}

if(dialogid == 1246)

{

    if(response == 1)

    {

        new sendername[MAX_PLAYER_NAME];

GetPlayerName(playerid, sendername, sizeof(sendername));

new string[512];

        format(string, sizeof(string),""ALB"Nume: "LIGHTBLUE"%s\n"ALB"Parola: "LIGHTBLUE"%s,\n"ALB"Bani: "LIGHTBLUE"10000\n"ALB"Scor: "LIGHTBLUE"500",sendername,inputtext);

        ShowPlayerDialog(playerid, 1242, DIALOG_STYLE_MSGBOX, ""LIGHTBLUE"Te-ai inregistrat cu succes",string,"Ok","");

        GivePlayerMoney(playerid, 10000);

        SetPlayerScore(playerid, 500);

        OnPlayerRegister(playerid, inputtext);

  }

else

{

    Kick(playerid);

}

}

return 1;

}[/pawn]

Ai incercat sa rezolvi singur ?:da am sters num_hash dar la parola scrie 0 in notepap...

EDIT: As vrea sa o decriptez ...

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Topic inchis , 48h+ fara reply/up.

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.