case DIALOG_LOGIN:
{
if (!response) return SCM(playerid, COLOR_WHITE, "You have failed to login. Please reconnect and try again.");
if(response)
{
if(udb_hash(inputtext) == pInfo[playerid][pPassword])
{
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, pInfo[playerid][pCash]);
SetSpawnInfo(playerid, NO_TEAM, pInfo[playerid][pSkin], pInfo[playerid][pX], pInfo[playerid][pY], pInfo[playerid][pZ], pInfo[playerid][pA], 0, 0, 0, 0, 0, 0);
TogglePlayerSpectating(playerid, false);
SCM(playerid, COLOR_YELLOW, "Login Successful!");
return 1;
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
return 1;
}
}
if(dialogid == REGISTER_LOGIN)
{
if(!response) return Kick(playerid);
if(response)
{
new hpass[129];
WP_Hash(hpass, sizeof(hpass), inputtext);
if(!strcmp(hpass, pInfo[playerid][pPass], false))
{
if(LoginAttempt[playerid] > 0)
{
LoginAttempt[playerid] = 0;
return ShowPlayerDialog(playerid, REGISTER_LOGIN2, DIALOG_STYLE_PASSWORD, "Login", "You made too many login attempts. Enter your second password to Login.", "Enter", "Cancel");
}
IsPlayerLoggedIn[playerid] = true;
SCM(playerid, COLOR_GREEN, "You've successfully logged in. Welcome back.");
SetSpawnInfo(playerid, 0, pInfo[playerid][pSkin], pInfo[playerid][pX], pInfo[playerid][pY], pInfo[playerid][pZ], pInfo[playerid][pA], 0, 0, 0, 0, 0, 0);
TogglePlayerSpectating(playerid, false);
SetCameraBehindPlayer(pid);
SetPlayerVirtualWorld(playerid, pInfo[playerid][pVW]);
SetPlayerInterior(playerid, pInfo[playerid][pInterior]);
SetPlayerScore(playerid, pInfo[playerid][pPlayingHours]);
TIMER_MONEYCHECK[playerid] = SetTimerEx("MoneyCheck", 1000, true, "i", playerid);
TIMER_CURRENTWEAPON[playerid] = SetTimerEx("CurrentWeapon", 150, true, "i", playerid);
TIMER_PAYCHECK[playerid] = SetTimerEx("PayCheckTimer", 60000*60, true, "i", playerid);
PayTime[playerid] = 3600;
if(pInfo[playerid][pRegistered] == false) // If their not registered/accepted by helpers.
{
SetSpawnInfo(playerid, NO_TEAM, pInfo[playerid][pSkin], -4846.1611,1949.6287,2.8717,123.7555, 0, 0, 0, 0, 0, 0);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SaveUser(playerid);
TogglePlayerSpectating(playerid, false);
SetCameraBehindPlayer(pid);
LoadInterior(pid);
SCM(pid,COLOR_ORANGE, "A helper will be with you shortly.");
new str[128];
format(str,sizeof(str), "NOTIFICATION: Player %s (%d) is now ready for the RP test. Use /hhgoto to teleport to the player.", GetName(pid), pid);
SendClientMessageToHelpers(COLOR_HELPER, str);
}
if(pInfo[playerid][pDrugAddiction] > 0) // If the player is addicted to a drug.
{
TIMER_ADDICTION[playerid] = SetTimerEx("DrugAddiction", 900000, true, "i", playerid);
}
Weapon[playerid][pInfo[playerid][pWeapon0]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon0], 99999);
Weapon[playerid][pInfo[playerid][pWeapon1]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon1], 99999);
Weapon[playerid][pInfo[playerid][pWeapon2]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon2], 99999);
Weapon[playerid][pInfo[playerid][pWeapon3]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon3], 99999);
Weapon[playerid][pInfo[playerid][pWeapon4]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon4], 99999);
Weapon[playerid][pInfo[playerid][pWeapon5]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon5], 99999);
Weapon[playerid][pInfo[playerid][pWeapon6]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon6], 99999);
Weapon[playerid][pInfo[playerid][pWeapon7]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon7], 99999);
Weapon[playerid][pInfo[playerid][pWeapon8]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon8], 99999);
Weapon[playerid][pInfo[playerid][pWeapon9]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon9], 99999);
Weapon[playerid][pInfo[playerid][pWeapon10]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon10], 99999);
Weapon[playerid][pInfo[playerid][pWeapon11]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon11], 99999);
Weapon[playerid][pInfo[playerid][pWeapon12]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon12], 99999);
SetPlayerArmedWeapon(playerid, pInfo[playerid][pWeapon0]);
for(new i=0; i<MAX_HOUSES; i++)
{
new path[30];
format(path,sizeof(path), HPATH, i);
if(fexist(path))
{
if(strsame(GetName(playerid), hInfo[i][hRenter], true) && hInfo[i][hRent] > 0)
{
pInfo[playerid][pMoney] -= hInfo[i][hRent];
hInfo[i][hRentPay] += hInfo[i][hRent];
new str[128];
format(str, sizeof(str), "You have paid $%i for rent. (House ID %i)", hInfo[i][hRent], i);
SCM(playerid, COLOR_WHITE, str);
}
}
}
}
else
{
SCM(pid,COLOR_GREY, "ERROR: You've entered an incorrect password.");
LoginAttempt[playerid] += 1;
if(LoginAttempt[playerid] == 3)
{
new astr[64], ipstr[16];
GetPlayerIp(playerid, ipstr, sizeof(ipstr));
format(astr, sizeof(astr), "Player %s (%i) with ip %s failed to login. They have been kicked.", GetName(playerid), playerid, ipstr);
SendClientMessageToAdmins(COLOR_ADMIN, astr, 1);
Kick(playerid);
return 1;
}
ShowPlayerDialog(playerid, REGISTER_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Enter your password to Login.", "Enter", "Cancel");
return 1;
}
}
}
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
Also, you are loading from the tag 'data', meaning if those values are not assigned under the tag (INI_SetTag) 'data', then they won't be loaded.
|
And I wouldn't recommend using udb to hash your passwords.. it might be easier for you to store and handle the passwords, but it isn't the best hashing method around.
|
Well if you're being placed at 0.0, 0.0, 0.0, then obviously the loading isn't working correctly or you wouldn't be having this issue.
Try debugging to see what the values of 'pX', 'pY', 'pZ' and 'pA' are. |
//New Variables: Enum, load, save, register
enum PlayerInfo
{
pPassword,
pCash,
pSkin,
pAdmin,
pVip,
pKills,
pDeaths,
pBan,
pBanReason[128],
Float:pX,
Float:pY,
Float:pZ,
Float:pA,
Float:pHealth,
Float:pArmor
}
new pInfo[MAX_PLAYERS][PlayerInfo];
//snip
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",pInfo[playerid][pPassword]);
INI_Int("Cash",pInfo[playerid][pCash]);
INI_Int("Skin",pInfo[playerid][pSkin]);
INI_Int("Admin",pInfo[playerid][pAdmin]);
INI_Int("Vip",pInfo[playerid][pVip]);
INI_Int("Kills",pInfo[playerid][pKills]);
INI_Int("Deaths",pInfo[playerid][pDeaths]);
INI_Int("Ban",pInfo[playerid][pBan]);
INI_String("BanReason",pInfo[playerid][pBanReason]);
INI_Float("X",pInfo[playerid][pX]);
INI_Float("Y",pInfo[playerid][pY]);
INI_Float("Z",pInfo[playerid][pZ]);
INI_Float("A",pInfo[playerid][pA]);
INI_Float("Health",pInfo[playerid][pHealth]);
INI_Float("Armor",pInfo[playerid][pArmor]);
INI_Int("Inventory0",Inventory[playerid][0]);
INI_Int("InventoryCount0",InventoryCount[playerid][0]);
INI_Int("Inventory1",Inventory[playerid][1]);
INI_Int("InventoryCount1",InventoryCount[playerid][1]);
INI_Int("Inventory2",Inventory[playerid][2]);
INI_Int("InventoryCount2",InventoryCount[playerid][2]);
INI_Int("Inventory3",Inventory[playerid][3]);
INI_Int("InventoryCount3",InventoryCount[playerid][3]);
INI_Int("Inventory4",Inventory[playerid][4]);
INI_Int("InventoryCount4",InventoryCount[playerid][4]);
INI_Int("Inventory5",Inventory[playerid][5]);
INI_Int("InventoryCount5",InventoryCount[playerid][5]);
INI_Int("Inventory6",Inventory[playerid][6]);
INI_Int("InventoryCount6",InventoryCount[playerid][6]);
INI_Int("Inventory7",Inventory[playerid][7]);
INI_Int("InventoryCount7",InventoryCount[playerid][7]);
INI_Int("Inventory8",Inventory[playerid][8]);
INI_Int("InventoryCount8",InventoryCount[playerid][8]);
INI_Int("Inventory9",Inventory[playerid][9]);
INI_Int("InventoryCount9",InventoryCount[playerid][9]);
INI_Int("Inventory10",Inventory[playerid][10]);
INI_Int("InventoryCount10",InventoryCount[playerid][10]);
INI_Int("Inventory11",Inventory[playerid][11]);
INI_Int("InventoryCount11",InventoryCount[playerid][11]);
INI_Int("Inventory12",Inventory[playerid][12]);
INI_Int("InventoryCount12",InventoryCount[playerid][12]);
INI_Int("Inventory13",Inventory[playerid][13]);
INI_Int("InventoryCount13",InventoryCount[playerid][13]);
INI_Int("Inventory14",Inventory[playerid][14]);
INI_Int("InventoryCount14",InventoryCount[playerid][14]);
INI_Int("Inventory15",Inventory[playerid][15]);
INI_Int("InventoryCount15",InventoryCount[playerid][15]);
INI_Int("Inventory16",Inventory[playerid][16]);
INI_Int("InventoryCount16",InventoryCount[playerid][16]);
INI_Int("Inventory17",Inventory[playerid][17]);
INI_Int("InventoryCount17",InventoryCount[playerid][17]);
INI_Int("Inventory18",Inventory[playerid][18]);
INI_Int("InventoryCount18",InventoryCount[playerid][18]);
INI_Int("Inventory19",Inventory[playerid][19]);
INI_Int("InventoryCount19",InventoryCount[playerid][19]);
INI_Int("Inventory20",Inventory[playerid][20]);
INI_Int("InventoryCount20",InventoryCount[playerid][20]);
INI_Int("Inventory21",Inventory[playerid][21]);
INI_Int("InventoryCount21",InventoryCount[playerid][21]);
INI_Int("Inventory22",Inventory[playerid][22]);
INI_Int("InventoryCount22",InventoryCount[playerid][22]);
INI_Int("Inventory23",Inventory[playerid][23]);
INI_Int("InventoryCount23",InventoryCount[playerid][23]);
INI_Int("Inventory24",Inventory[playerid][24]);
INI_Int("InventoryCount24",InventoryCount[playerid][24]);
INI_Int("Inventory25",Inventory[playerid][25]);
INI_Int("InventoryCount25",InventoryCount[playerid][25]);
INI_Int("Inventory26",Inventory[playerid][26]);
INI_Int("InventoryCount26",InventoryCount[playerid][26]);
INI_Int("Inventory27",Inventory[playerid][27]);
INI_Int("InventoryCount27",InventoryCount[playerid][27]);
INI_Int("Inventory28",Inventory[playerid][28]);
INI_Int("InventoryCount28",InventoryCount[playerid][28]);
INI_Int("Inventory29",Inventory[playerid][29]);
INI_Int("InventoryCount29",InventoryCount[playerid][29]);
return 1;
}
//snip
forward SaveUser(playerid);
public SaveUser(playerid)
{
new Float:x, Float:y, Float:z, Float:a, Float:health, Float:armor;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
new skin = GetPlayerSkin(playerid);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File, "data");
INI_WriteInt(File, "Cash",pInfo[playerid][pCash]);
INI_WriteInt(File, "Skin",skin);
INI_WriteInt(File, "Admin",pInfo[playerid][pAdmin]);
INI_WriteInt(File, "Vip",pInfo[playerid][pVip]);
INI_WriteInt(File, "Kills",pInfo[playerid][pKills]);
INI_WriteInt(File, "Deaths",pInfo[playerid][pDeaths]);
INI_WriteInt(File, "Ban",pInfo[playerid][pBan]);
INI_WriteString(File, "BanReason",pInfo[playerid][pBanReason]);
INI_WriteFloat(File, "X",x);
INI_WriteFloat(File, "Y",y);
INI_WriteFloat(File, "Z",z);
INI_WriteFloat(File, "A",a);
INI_WriteFloat(File, "Health",health);
INI_WriteFloat(File, "Armor",armor);
INI_WriteInt(File, "Inventory0",Inventory[playerid][0]);
INI_WriteInt(File, "InventoryCount0",InventoryCount[playerid][0]);
INI_WriteInt(File, "Inventory1",Inventory[playerid][1]);
INI_WriteInt(File, "InventoryCount1",InventoryCount[playerid][1]);
INI_WriteInt(File, "Inventory2",Inventory[playerid][2]);
INI_WriteInt(File, "InventoryCount2",InventoryCount[playerid][2]);
INI_WriteInt(File, "Inventory3",Inventory[playerid][3]);
INI_WriteInt(File, "InventoryCount3",InventoryCount[playerid][3]);
INI_WriteInt(File, "Inventory4",Inventory[playerid][4]);
INI_WriteInt(File, "InventoryCount4",InventoryCount[playerid][4]);
INI_WriteInt(File, "Inventory5",Inventory[playerid][5]);
INI_WriteInt(File, "InventoryCount5",InventoryCount[playerid][5]);
INI_WriteInt(File, "Inventory6",Inventory[playerid][6]);
INI_WriteInt(File, "InventoryCount6",InventoryCount[playerid][6]);
INI_WriteInt(File, "Inventory7",Inventory[playerid][7]);
INI_WriteInt(File, "InventoryCount7",InventoryCount[playerid][7]);
INI_WriteInt(File, "Inventory8",Inventory[playerid][8]);
INI_WriteInt(File, "InventoryCount8",InventoryCount[playerid][8]);
INI_WriteInt(File, "Inventory9",Inventory[playerid][9]);
INI_WriteInt(File, "InventoryCount9",InventoryCount[playerid][9]);
INI_WriteInt(File, "Inventory10",Inventory[playerid][10]);
INI_WriteInt(File, "InventoryCount10",InventoryCount[playerid][10]);
INI_WriteInt(File, "Inventory11",Inventory[playerid][11]);
INI_WriteInt(File, "InventoryCount11",InventoryCount[playerid][11]);
INI_WriteInt(File, "Inventory12",Inventory[playerid][12]);
INI_WriteInt(File, "InventoryCount12",InventoryCount[playerid][12]);
INI_WriteInt(File, "Inventory13",Inventory[playerid][13]);
INI_WriteInt(File, "InventoryCount13",InventoryCount[playerid][13]);
INI_WriteInt(File, "Inventory14",Inventory[playerid][14]);
INI_WriteInt(File, "InventoryCount14",InventoryCount[playerid][14]);
INI_WriteInt(File, "Inventory15",Inventory[playerid][15]);
INI_WriteInt(File, "InventoryCount15",InventoryCount[playerid][15]);
INI_WriteInt(File, "Inventory16",Inventory[playerid][16]);
INI_WriteInt(File, "InventoryCount16",InventoryCount[playerid][16]);
INI_WriteInt(File, "Inventory17",Inventory[playerid][17]);
INI_WriteInt(File, "InventoryCount17",InventoryCount[playerid][17]);
INI_WriteInt(File, "Inventory18",Inventory[playerid][18]);
INI_WriteInt(File, "InventoryCount18",InventoryCount[playerid][18]);
INI_WriteInt(File, "Inventory19",Inventory[playerid][19]);
INI_WriteInt(File, "InventoryCount19",InventoryCount[playerid][19]);
INI_WriteInt(File, "Inventory20",Inventory[playerid][20]);
INI_WriteInt(File, "InventoryCount20",InventoryCount[playerid][20]);
INI_WriteInt(File, "Inventory21",Inventory[playerid][21]);
INI_WriteInt(File, "InventoryCount21",InventoryCount[playerid][21]);
INI_WriteInt(File, "Inventory22",Inventory[playerid][22]);
INI_WriteInt(File, "InventoryCount22",InventoryCount[playerid][22]);
INI_WriteInt(File, "Inventory23",Inventory[playerid][23]);
INI_WriteInt(File, "InventoryCount23",InventoryCount[playerid][23]);
INI_WriteInt(File, "Inventory24",Inventory[playerid][24]);
INI_WriteInt(File, "InventoryCount24",InventoryCount[playerid][24]);
INI_WriteInt(File, "Inventory25",Inventory[playerid][25]);
INI_WriteInt(File, "InventoryCount25",InventoryCount[playerid][25]);
INI_WriteInt(File, "Inventory26",Inventory[playerid][26]);
INI_WriteInt(File, "InventoryCount26",InventoryCount[playerid][26]);
INI_WriteInt(File, "Inventory27",Inventory[playerid][27]);
INI_WriteInt(File, "InventoryCount27",InventoryCount[playerid][27]);
INI_WriteInt(File, "Inventory28",Inventory[playerid][28]);
INI_WriteInt(File, "InventoryCount28",InventoryCount[playerid][28]);
INI_WriteInt(File, "Inventory29",Inventory[playerid][29]);
INI_WriteInt(File, "InventoryCount29",InventoryCount[playerid][29]);
INI_Close(File);
return 1;
}
[data]
InventoryCount29 = 0
Inventory29 = 0
InventoryCount28 = 0
Inventory28 = 0
InventoryCount27 = 0
Inventory27 = 0
InventoryCount26 = 0
Inventory26 = 0
InventoryCount25 = 0
Inventory25 = 0
InventoryCount24 = 0
Inventory24 = 0
InventoryCount23 = 0
Inventory23 = 0
InventoryCount22 = 0
Inventory22 = 0
InventoryCount21 = 0
Inventory21 = 0
InventoryCount20 = 0
Inventory20 = 0
InventoryCount19 = 0
Inventory19 = 0
InventoryCount18 = 0
Inventory18 = 0
InventoryCount17 = 0
Inventory17 = 0
InventoryCount16 = 0
Inventory16 = 0
InventoryCount15 = 0
Inventory15 = 0
InventoryCount14 = 0
Inventory14 = 0
InventoryCount13 = 0
Inventory13 = 0
InventoryCount12 = 0
Inventory12 = 0
InventoryCount11 = 0
Inventory11 = 0
InventoryCount10 = 0
Inventory10 = 0
InventoryCount9 = 0
Inventory9 = 0
InventoryCount8 = 0
Inventory8 = 0
InventoryCount7 = 0
Inventory7 = 0
InventoryCount6 = 0
Inventory6 = 0
InventoryCount5 = 0
Inventory5 = 0
InventoryCount4 = 0
Inventory4 = 0
InventoryCount3 = 0
Inventory3 = 0
InventoryCount2 = 0
Inventory2 = 0
InventoryCount1 = 0
Inventory1 = 0
InventoryCount0 = 0
Inventory0 = 0
Armor = 0.000000
Health = 0.000000
A = 16.280002
Z = 10.401393
Y = 1944.359008
X = 2154.173583
BanReason =
Ban = 0
Deaths = 0
Kills = 0
Vip = 0
Admin = 0
Skin = 72
Cash = 0
//snipped password
[data] value1=... value2=.. ..
Open ini file of user and make sure that all values are under the tag [data]
Should be in this format : Код:
[data] value1=... value2=.. .. Now with that being done, try to debug the value as and when they are loaded, i.e., inside LoadUser_data callback. If you are comparing password that means password has already been loaded and was loaded successfully. So see that the line you are using here is same as the line you used to load password, if you used same way to load password. |
Just out of curiosity, do health and armour load properly?
If they do, then try changing the names of the variables in the file to something like 'PlayerX', 'PlayerY', instead of just 'X', 'Y', etc. I have a hunch that I've encountered this issue before, but I can't exactly remember if it was because of the variable names consisting of only 1 letter. Oh, and: https://sampwiki.blast.hk/wiki/SHA256_PassHash |