Stickenkid's MySQL assistance
#1

I'm trying to load player's weapons, but I'm not sure how to assign the field to a variable so that I could use it in GivePlayerWeapon..
Can anybody please show me an example?

pawn Код:
format(Query, sizeof(Query), "SELECT weapons, ammo FROM weapons WHERE id = %d", PlayerInfo[playerid][DBID]);
                    mysql_query(Query);
                    mysql_store_result();
                    if(mysql_num_rows())
                    {
                        for(new i, j = mysql_num_rows(); i < j; i++)
                        {
                            mysql_fetch_field_num(i, "weapons");
                            mysql_fetch_field_num(i, "ammo");
                            if(!(0 <= PlayerInfo[playerid][Weapons] <= 46)) continue;
                            GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapons], PlayerInfo[playerid][Ammo]);
                        }
                    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)