Password -
CSLangdale - 06.04.2016
Код:
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
InterpolateCameraPos(playerid, 380.2796, -340.6636, 49.3404, -162.2861, 157.5699, 53.6954, 150000);
InterpolateCameraLookAt(playerid, 381.0202, -341.3334, 49.4304, -162.9535, 158.3127, 53.8754, 100000);
SetPlayerMapIcon(playerid, 1, 373.4215, -275.4926, 1.0578, 9, 0, MAPICON_LOCAL);
SetTimer("LevelTimer", 1800000, true);
TogglePlayerSpectating(playerid, 1); // remove "Spawn" button
SetPlayerPos(playerid, -162.9535, 158.3127, 53.8754);
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_user", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Type your password below to login.", "Login", "Quit");
}
else ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Type your password below to register a new account.", "Register", "Quit");
PreloadAnimLib(playerid, "KNIFE");
PreloadAnimLib(playerid, "MEDIC");
return 1;
}
Код:
public OnPlayerDisconnect(playerid, reason)
{
if(Logged[playerid] == true)
{
new year, month, day, hour, minute, second, Float: X, Float: Y, Float: Z, Float: hp, Float: armor;
GetPlayerArmour(playerid, armor), GetPlayerHealth(playerid, hp);
getdate(year, month, day), gettime(hour, minute, second), GetPlayerPos(playerid, X, Y, Z);
GetPlayerWeaponData(playerid, 2, pInfo[playerid][Weapon1], pInfo[playerid][Wep1Ammo]);
GetPlayerWeaponData(playerid, 3, pInfo[playerid][Weapon2], pInfo[playerid][Wep2Ammo]);
GetPlayerWeaponData(playerid, 4, pInfo[playerid][Weapon3], pInfo[playerid][Wep3Ammo]);
GetPlayerWeaponData(playerid, 5, pInfo[playerid][Weapon4], pInfo[playerid][Wep4Ammo]);
GetPlayerWeaponData(playerid, 6, pInfo[playerid][Weapon5], pInfo[playerid][Wep5Ammo]);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File, "Player Data");
// account related
INI_WriteInt(File, "Admin", pInfo[playerid][Admin]);
INI_WriteInt(File, "Level", pInfo[playerid][Level]);
INI_WriteInt(File, "Skin", GetPlayerSkin(playerid));
INI_WriteInt(File, "Exp", pInfo[playerid][Exp]);
INI_WriteInt(File, "CurExp", pInfo[playerid][CurExp]);
INI_WriteInt(File, "Gender", pInfo[playerid][Gender]);
INI_WriteInt(File, "Registered", pInfo[playerid][Registered]);
INI_WriteInt(File, "HandMoney", GetPlayerMoney(playerid));
INI_WriteInt(File, "BankMoney", pInfo[playerid][BankMoney]);
INI_WriteFloat(File, "Armour", armor);
INI_WriteFloat(File, "Health", hp);
// faction
INI_WriteInt(File, "Faction", pInfo[playerid][Faction]);
INI_WriteInt(File, "FactionTier", pInfo[playerid][FactionTier]);
INI_WriteString(File, "FactionRank", pInfo[playerid][FactionRank]);
INI_WriteInt(File, "Weapon1", pInfo[playerid][Weapon1]);
INI_WriteInt(File, "Wep1Ammo", pInfo[playerid][Wep1Ammo]);
INI_WriteInt(File, "Weapon2", pInfo[playerid][Weapon2]);
INI_WriteInt(File, "Wep2Ammo", pInfo[playerid][Wep2Ammo]);
INI_WriteInt(File, "Weapon3", pInfo[playerid][Weapon3]);
INI_WriteInt(File, "Wep3Ammo", pInfo[playerid][Wep3Ammo]);
INI_WriteInt(File, "Weapon4", pInfo[playerid][Weapon4]);
INI_WriteInt(File, "Wep4Ammo", pInfo[playerid][Wep4Ammo]);
INI_WriteInt(File, "Weapon5", pInfo[playerid][Weapon5]);
INI_WriteInt(File, "Wep5Ammo", pInfo[playerid][Wep5Ammo]);
// server-side
INI_WriteInt(File, "LastPos", 1);
INI_WriteInt(File, "LastInt", GetPlayerInterior(playerid));
INI_WriteInt(File, "LastVW", GetPlayerVirtualWorld(playerid));
INI_WriteFloat(File, "LastX", X);
INI_WriteFloat(File, "LastY", Y);
INI_WriteFloat(File, "LastZ", Z);
INI_WriteInt(File, "Mask", pInfo[playerid][Mask]);
INI_WriteInt(File, "MaskID", pInfo[playerid][MaskID]);
INI_WriteInt(File, "PhoneNumber", pInfo[playerid][PhoneNumber]);
INI_WriteInt(File, "HouseOwner", pInfo[playerid][HouseOwner]);
INI_WriteInt(File, "BizOwner", pInfo[playerid][BizOwner]);
INI_WriteInt(File, "VehicleOwner", pInfo[playerid][VehicleOwner]);
// informational
INI_WriteInt(File, "lvDay", day);
INI_WriteInt(File, "lvMonth", month);
INI_WriteInt(File, "lvYear", year);
INI_WriteInt(File, "lvHour", hour);
INI_WriteInt(File, "lvMinute", minute);
INI_WriteInt(File, "lvSecond", second);
INI_Close(File);
}
return 1;
}
can anyone see a problem there why when i connect and type my password in it says its incorrect?
Re: Password -
Lucky13 - 06.04.2016
Can you also post the OnDialogResponse too? We have to see if you compare the typed password with the registered one correctly.
Re: Password -
CSLangdale - 06.04.2016
Oh yea sorry
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new string[128], pname[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, pname, sizeof(pname));
switch(dialogid)
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Type your password below to register a new account.", "Register", "Quit");
new INI:File = INI_Open(UserPath(playerid));
new rand1 = random(99999), rand2 = random(99999);
INI_SetTag(File, "Player Data");
INI_WriteInt(File, "Password", udb_hash(inputtext));
INI_WriteInt(File, "Admin", 0);
INI_WriteInt(File, "Level", 1);
INI_WriteInt(File, "Skin", 0);
INI_WriteInt(File, "Exp", 0);
INI_WriteInt(File, "Gender", 0);
INI_WriteInt(File, "Registered", 0);
INI_WriteFloat(File, "Armour", 0);
INI_WriteFloat(File, "Health", 100);
INI_WriteInt(File, "Faction", 0);
INI_WriteInt(File, "FactionTier", 0);
INI_WriteString(File, "FactionRank", "None");
INI_WriteInt(File, "HandMoney", 0);
INI_WriteInt(File, "BankMoney", 0);
INI_WriteInt(File, "Mask", 0);
INI_WriteInt(File, "MaskID", rand1);
INI_WriteInt(File, "PhoneNumber", rand2);
INI_WriteInt(File, "HouseOwner", 9999);
INI_WriteInt(File, "VehicleOwner", 9999);
INI_WriteInt(File, "BizOwner", 9999);
INI_WriteInt(File, "Weapon1", 0);
INI_WriteInt(File, "Wep1Ammo", 0);
INI_WriteInt(File, "Weapon2", 0);
INI_WriteInt(File, "Wep2Ammo", 0);
INI_WriteInt(File, "Weapon3", 0);
INI_WriteInt(File, "Wep3Ammo", 0);
INI_WriteInt(File, "Weapon4", 0);
INI_WriteInt(File, "Wep4Ammo", 0);
INI_WriteInt(File, "Weapon5", 0);
INI_WriteInt(File, "Wep5Ammo", 0);
INI_WriteInt(File, "lvDay", 0);
INI_WriteInt(File, "lvMonth", 0);
INI_WriteInt(File, "lvYear", 0);
INI_WriteInt(File, "lvHour", 0);
INI_WriteInt(File, "lvMinute", 0);
INI_WriteInt(File, "lvSecond", 0);
INI_WriteInt(File, "LastPos", 0);
INI_WriteInt(File, "LastVW", 0);
INI_WriteInt(File, "LastInt", 0);
INI_WriteFloat(File, "LastX", 0);
INI_WriteFloat(File, "LastY", 0);
INI_WriteFloat(File, "LastZ", 0);
INI_Close(File);
format(string, sizeof(string), "SERVER:{FFFFFF} Welcome to the server, %s!", pname);
SendClientMessage(playerid, 0x46E850FF, string);
SetSpawnInfo(playerid, 0, 0, 0.00, 0.00, 0.00, 0.00, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
}
case DIALOG_LOGIN:
{
if (!response) return Kick(playerid);
if(response)
{
if(udb_hash(inputtext) == pInfo[playerid][Pass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
format(string, sizeof(string), "SERVER:{FFFFFF} Welcome back, %s! You last logged in at %d/%d/%d %d:%d:%d.", pname, pInfo[playerid][lvDay], pInfo[playerid][lvMonth], pInfo[playerid][lvYear], pInfo[playerid][lvHour], pInfo[playerid][lvMinute], pInfo[playerid][lvSecond]);
SendClientMessage(playerid, 0x46E850FF, string);
Logged[playerid] = true;
SetSpawnInfo(playerid, 0, 0, 0.00, 0.00, 0.00, 0.00, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
else ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "{FFFFFF}You have entered an {C44B4B}incorrect{FFFFFF} password.\nType your password below to login.", "Login", "Quit");
return 1;
}
}
Re: Password -
Lucky13 - 06.04.2016
I'm not 100% sure if this is the problem, but try setting the INI_SetTag(File, "Player Data"); to INI_SetTag(File, "data"); everywhere in your script, delete your account and try registering again then try to login.
Re: Password -
CSLangdale - 06.04.2016
Stilll not working....
Re: Password -
Lucky13 - 06.04.2016
Ah, try to change this: INI_ParseFile(UserPath(playerid), "LoadUser_user", .bExtra = true, .extra = playerid);
with: INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
At OnPlayerConnect
Re: Password -
CSLangdale - 06.04.2016
thats what it was before and i had this problem then lol
Re: Password -
Lucky13 - 06.04.2016
What about the SetTag? Are they still with "data" only?
Re: Password -
CSLangdale - 06.04.2016
Its still the same issue
Re: Password -
Lucky13 - 06.04.2016
Weird..can you also post the LoadUser code?