SQLite help.
#1

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:
Код:
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);
}
Thanks.
Reply


Messages In This Thread
SQLite help. - by LoLeRo - 26.07.2016, 02:58
Re: SQLite help. - by Gammix - 26.07.2016, 03:07
Respuesta: Re: SQLite help. - by LoLeRo - 26.07.2016, 03:22
Re: Respuesta: Re: SQLite help. - by Gammix - 26.07.2016, 03:26
Respuesta: SQLite help. - by LoLeRo - 26.07.2016, 03:43
Re: Respuesta: SQLite help. - by Gammix - 26.07.2016, 03:46
Respuesta: SQLite help. - by LoLeRo - 26.07.2016, 03:48

Forum Jump:


Users browsing this thread: 2 Guest(s)