#include <a_samp> #include <dini> #include <dudb> #pragma unused ret_memcpy #define PLAYERS "Ћaidėjai/%s.ini" enum pInfo { pMoney, pExperiencePoints, } new PlayerInfo[MAX_PLAYERS][pInfo]; new PlayerLogged[MAX_PLAYERS];
public OnPlayerConnect(playerid) { PlayerLogged[playerid] = 0; new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), PLAYERS, name); if(!dini_Exists(file)) { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "{ffffff}Registracija", "{ffffff}Prisiregistruokite, įvesdami slaptaћodį.", "Registruotis", "Iљeiti"); } if(fexist(file)) { ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "{ffffff}Prisijungimas", "{ffffff}Prisijunkite, įvesdami slaptaћodį.", "Prisijungti", "Iљeiti"); } return 1; }
public OnPlayerDisconnect(playerid, reason) { new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), PLAYERS, name); if(PlayerLogged[playerid] == 1) { dini_IntSet(file, "Patirties taљkai", PlayerInformation[playerid][ExperiencePoints]); dini_IntSet(file, "Pinigai", PlayerInformation[playerid][Money]); } PlayerLogged[playerid] = 0; return 1; }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if (dialogid == 1) { new name[MAX_PLAYER_NAME], file[256], string[128]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), PLAYERS, name); if(!response) return Kick(playerid); if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "{ffffff}Registracija", "{ffffff}Prisiregistruokite, įvesdami slaptaћodį.", "Registruotis", "Iљeiti"); dini_Create(file); dini_IntSet(file, "Slaptaћodis", udb_hash(inputtext)); dini_IntSet(file, "Pinigai", PlayerInformation[playerid][Money] = 0); dini_IntSet(file, "Patirties taљkai", PlayerInformation[playerid][ExperiencePoints] = 0); format(string, 128, "Sėkmingai uћsiregistravote. Jūsų slaptaћodis: {ffff33}%s{ffffff}.", inputtext); SendClientMessage(playerid, 0xFFFFFFFF, string); SendClientMessage(playerid, 0xFFFFFFFF, "Informaciją apie serverį rasite, paraљę {ffff33}/informacija{ffffff}."); PlayerLogged[playerid] = 1; } if (dialogid == 2) { new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), PLAYERS, name); if(!response) return Kick(playerid); if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "{ffffff}Prisijungimas", "{ffffff}Prisijunkite, įvesdami slaptaћodį.", "Prisijungti", "Iљeiti"); new tmp; tmp = dini_Int(file, "Slaptaћodis"); if(udb_hash(inputtext) != tmp) { SendClientMessage(playerid, 0xFFFFFFFF, "{ff0033}Neteisingas {ffffff}slaptaћodis."); ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "{ffffff}Prisijungimas", "{ffffff}Prisijunkite, įvesdami slaptaћodį.", "Prisijungti", "Iљeiti"); } else { PlayerLogged[playerid] = 1; SetPlayerScore(playerid, PlayerInformation[playerid][ExperiencePoints]); GivePlayerMoney(playerid, dini_Int(file, "Pinigai") - GetPlayerMoney(playerid)); SendClientMessage(playerid, 0xFFFFFFFF, "{99ff33}Teisingas {ffffff}slaptaћodis. Sėkmingai prisijungėte."); } } return 1; }
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
return 1;
}
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
ShowPlayerDialog(.....);
return 1;
}
Showw me your code which looks like this:
pawn Код:
And you forgot to parse the file on player connect. Therefore it wouldnt load your pass so it should be like: pawn Код:
|