26.07.2016, 02:58
Hi, mi problem is that when i want to get an user variables with sqlite the system don't get the correct values, for example, when i log in with a account with field "admin" = 8, db_get_field_assoc_int is always getting value 0, instead of 8.
Here's my code:
Thanks.
Here's my code:
Код:
LoginPlayer(playerid)
{
new Query[100], DBResult: Result2;
format(Query, sizeof(Query), "SELECT username FROM users WHERE username = '%s' LIMIT 0, 1", Nick(playerid));
Result2 = db_query(Database, Query);
if(db_num_rows(Result2))
{
PlayerInfo[playerid][IID] = db_get_field_assoc_int(Result2, "userid");
PlayerInfo[playerid][Level] = db_get_field_assoc_int(Result2, "admin");
PlayerInfo[playerid][pVip] = db_get_field_assoc_int(Result2, "vip");
PlayerInfo[playerid][Money] = db_get_field_assoc_int(Result2, "money");
PlayerInfo[playerid][Score] = db_get_field_assoc_int(Result2, "score");
PlayerInfo[playerid][Kills] = db_get_field_assoc_int(Result2, "kills");
PlayerInfo[playerid][Deaths] = db_get_field_assoc_int(Result2, "deaths");
PlayerInfo[playerid][DGanados] = db_get_field_assoc_int(Result2, "dwin");
PlayerInfo[playerid][DPerdidos] = db_get_field_assoc_int(Result2, "dlost");
PlayerInfo[playerid][Experiencia] = db_get_field_assoc_int(Result2, "exp");
PlayerInfo[playerid][hourss] = db_get_field_assoc_int(Result2, "hours");
PlayerInfo[playerid][mins] = db_get_field_assoc_int(Result2, "mins");
PlayerInfo[playerid][secs] = db_get_field_assoc_int(Result2, "secs");
PlayerH[playerid][Spawn] = db_get_field_assoc_int(Result2, "pSpawn");
PlayerH[playerid][Houseid] = db_get_field_assoc_int(Result2, "HouseID");
PlayerInfo[playerid][Registered] = 1;
PlayerInfo[playerid][LoggedIn] = 1;
SetPlayerMoney(playerid, PlayerInfo[playerid][Money]);
SetPlayerScore(playerid, PlayerInfo[playerid][Score]);
}
db_free_result(Result2);
}


