25.10.2014, 14:07
Can't work out the issue here.. Hoping someone here can.
pawn Код:
case DIALOG_LOGIN:
{
new query[144];
mysql_format(sqlHandle, query, sizeof(query), "SELECT `Password` FROM `samp_users` WHERE `Username` = '%e'", Name[playerid]);
mysql_tquery(sqlHandle, query, "", "");
new rows, fields;
cache_get_data(rows, fields);
cache_get_field_content(0, "Password", Account[playerid][Password]);
if(!strcmp(hash, Account[playerid][Password]))
{
new query2[1024];
SCM(playerid, COLOR_GREEN, "You have successfully logged into "GAMEMODE_SHORTNAME". You will be spawned in a minute.");
SCM(playerid, COLOR_GREEN, "Remember, if you need help use "EMBED_WHITE"/assistance");
SCM(playerid, COLOR_GREEN, "And if you find a player is breaking the rules use "EMBED_WHITE"/report");
strcat(query2, "SELECT `age`, `AdminLevel`, `money`, `skin`, `gender`, `pDisX`, `pDisY`, `pDisZ`, pDisA`, ");
strcat(query2, "`health`, `armour` FROM `samp_users` WHERE `Username` = '%e'");
mysql_format(sqlHandle, query2, sizeof(query), query, Name[playerid]);
mysql_function_query(sqlHandle, query2, true, "OnAccountLoad", "i", playerid);
}
Function:OnAccountLoad(playerid)
{
new rows,
fields;
// Collect rows
cache_get_data(rows, fields);
// Load Strings ----------------------------------------------------
cache_get_field_content(0, "Password", Account[playerid][Password]);
// -----------------------------------------------------------------
// Load Integers ------------------------------------------------------------
Account[playerid][AdminLevel] = cache_get_field_content_int(0, "AdminLevel");
Account[playerid][Money] = cache_get_field_content_int(0, "money");
Account[playerid][Faction] = cache_get_field_content_int(0, "faction");
Account[playerid][pSkin] = cache_get_field_content_int(0, "skin");
Account[playerid][pGender] = cache_get_field_content_int(0, "gender");
// --------------------------------------------------------------------------
// Load Floats --------------------------------------------------------------
Account[playerid][pX] = cache_get_field_content_float(0, "pDisX");
Account[playerid][pY] = cache_get_field_content_float(0, "pDisY");
Account[playerid][pZ] = cache_get_field_content_float(0, "pDisZ");
Account[playerid][pA] = cache_get_field_content_float(0, "pDisA");
// --------------------------------------------------------------------------
// Set Money ----------------------------------------
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, Account[playerid][Money]);
// --------------------------------------------------
// Set Clothes -----------------------------------
SetPlayerSkin(playerid, Account[playerid][pSkin]);
// -----------------------------------------------
// Spawn Player ----------------------------------
SetSpawnInfo(playerid, 0, Account[playerid][pSkin], Account[playerid][pX], Account[playerid][pY], Account[playerid][pZ], Account[playerid][pA], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
// -----------------------------------------------
// Log
printf("[LoadCheck] Admin Level: %d || Money: %d || Faction: %d || Skin: %d || Gender: %d || Spawn X: %f || Spawn Y: %f || Spawn Z: %f || Spawn A: %f",
Account[playerid][AdminLevel], Account[playerid][Money], Account[playerid][Faction], Account[playerid][pSkin], Account[playerid][pGender],
Account[playerid][pX], Account[playerid][pY], Account[playerid][pZ], Account[playerid][pA]);
// ---
return 1;
}