1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

No unlocks

Discussion in 'BF2Statistics discussion' started by Sunnyghost, Apr 2, 2021.

  1. Sunnyghost

    Sunnyghost Member

    For some reason I don't get the question to choose a new unlock kit, when i log in to BF2.
    I am using BF2statistics 3.03 and playing mainly AIX2.
    All points, medals, ribbons and badges that I earned in game, are visible in BF2HQ. But I am not able to unlock one of the bonus kits. BF2 should give me to choice to select a kit to unlock, because I ahve enough points but I never get that option.
    When I manualy added the player_unlock table, the unlocks are shown in BF2HQ and I can use them in game.

    Anybody info to solve this?
     
  2. Wilson212

    Wilson212 Administrator Staff Member

    Are there any errors in the ASP log files? (Look in /ASP/system/logs" folder)
     
  3. Sunnyghost

    Sunnyghost Member

    No errors in log files.

    Maybe I just don't understand how it should work?

    My situation:

    BF2statistics version 3 Beta 4
    MS server 2016
    XAMPP windows-x647.2.34-0-VC15

    4 authorised servers: AIX2.0 conguest, AIX2.0 COOP, Special Forces COOP and BF2 conguest.
    All servers are uploading snapshots without any problem.

    Private Stats Admin:

    Rank Checking - disabled
    Awards Require Round Completion - disabled
    Unlocks Option - Earned
    Bonus Unlocks - Basic
    Min Rank for unlocks - Lance Corporal(2)

    All awards earned in game, are shown in BF2HQ and BF2sclone ( Badges, ribbons and unlocks ). so far so good.
    Even all unlocks I earned are shown BF2sclone and I can use them in game.

    The only thing i don't understand: The unlocks I earned ( because of the badges ), are not shown as un-locked in BF2HQ and i don't get a pop-up screen when I log in to BF2, thats telling me there are unlocks available and the option to select them.

    I also noticed the "player_unlock" table is empty.

    It looks like i only get the unlocks because i earned the "basic" badges and not because of the earned points ( 500+ ).
    If I change the "Bonus Unlocks" option to "veteran", i dont get any unlocks ( because i dont have the badges ) but i also do not get an unlock, after eaching more then 500 points.

    Maybe my thinking is wrong?
     
  4. Wilson212

    Wilson212 Administrator Staff Member

    What you are saying sounds right. I will take a look at this and see if maybe there is a bug in my code that is preventing unlocks from being stored properly
     
    Last edited: Apr 5, 2021
  5. Sunnyghost

    Sunnyghost Member

    Edit after latest update from beta 3 to beta 4:

    I have all basic badges. My score is 500+ points.
    I have no unlocks at all in game and they are also not visible in BF2HQ and BF2sclone.
    "player_unlock" table is empty.

    When I put one unlock in the "player-unlock" table, i get next screen in game and only can select "choose later" to close this screen. When i select "select unlock", it starts a loop.

    [​IMG]
     
  6. Wilson212

    Wilson212 Administrator Staff Member

    This is a lot of good information, thank you! Once I get home from work today I will look into getting this fixed (seems like an issue with the ASP).
     
  7. Sunnyghost

    Sunnyghost Member

    More info and hopefully you can use this. ( I earned bronze medic,
    Assault and Spec Ops badge ) ( I also earned 185 points in game ) ( Unlock options - "earned", Bonus unlocks - "Basic" and Min Rank for unlocks - "Pvt First Class (1) ).

    Checked the queries found in "getunlocksinfo.php" and "selectunlock.php".

    getunlocksinfo:
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]

    selectunlock.php

    [​IMG]
    [​IMG]
    [​IMG]

    Just for testing, i added kit 11

    [​IMG]
    [​IMG]
    [​IMG]
     
    Last edited: Apr 5, 2021
  8. Wilson212

    Wilson212 Administrator Staff Member

    After a review of my latest beta code, this is indeed a problem with my code. I am going to re-do the unlock system over the next couple of days and release an improved unlocks system, which will allow you to control which unlocks require other unlocks to be selected (plus, the bug fix ;))
     
    kjhedges likes this.
  9. Sunnyghost

    Sunnyghost Member

    Thanks again Wilson ;)
     
  10. Hjaldrgud

    Hjaldrgud New Member

    Hello. I'm having the same problem.

    Example of log error:
    2021-09-15 16:20:57 -- ERROR: A Handled Exception was logged
    Exception Type: PDOException
    Message: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1
    Code: 21S01
    File: C:\Battlefield 2 servershit\xampp\htdocs\ASP\aspx\selectunlock.php
    Line: 81
    Stack Trace:
    [0] => [
    "/aspx/selectunlock.php" @ line 81
    PDO->exec('INSERT INTO player_unlock VALUES (2900204, 66, 1631715657)')
    ]
    [1] => [
    "/system/System.php" @ line 128
    include('C:\Battlefield 2 servershit\xampp\htdocs\ASP\aspx\selectunlock.php')
    ]
    [2] => [
    "/system/System.php" @ line 52
    System::HandleAspxRequest()
    ]
    [3] => [
    "/index.php" @ line 47
    System::Run()
    ]

    video showing:


    config options:
    $game_unlocks = 0;
    $game_unlocks_bonus = 3;
    $game_unlocks_bonus_min = 7;
    $game_awds_ignore_time = 0;

    no player_unlock tables created
    [​IMG]

    I'm running a bf2 version 1.41 of the game. Everything else with the system is running stellar. You deserve all the praise in the world.

    Bonus questions:
    -Am I able to edit the unlock code so I get all the unlocks based on rank, and none of the bonus ones based on badges?
    Just continue from this one(selectunlock.php) and build it upwards:
    "if ($rank >= 9)
    {
    return 7;
    }"

    -Is the system able to support more than 14 unlocks? say seven more for a total of 21.
    14 based on rank, and seven on badges.


    EDIT: I seem to have fixed my problem by editing "selectunlock.php" in ..\..\xampp\htdocs\ASP\aspx. Line 81:

    $connection->exec("INSERT INTO player_unlock VALUES ($pid, $id, $time)");

    Simply remove $time:

    $connection->exec("INSERT INTO player_unlock VALUES ($pid, $id)");


    Now I can recieve the unlocks and I get no strange loops or problems. Again I must say that this thing you've made is a thing of beauty. My bonus questions are still open to be answered though :p
     
    Last edited: Sep 15, 2021
    darth_3pio and NUKE like this.
  11. darth_3pio

    darth_3pio New Member

    While removing $time does fix the unlock issue, a bunch of other pages not loading inside the Private Stats Admin also seem to be broken by TimeSpan.php, could it be a problem with the way the value is being returned from here that's causing the problems?
     
  12. Hjaldrgud

    Hjaldrgud New Member

    Hey. I would advice you to install the ASP from the latest release from github. This is newer than the ASP found in the zip found here.
    This updates the unlock loop problem and some more stuff. Perhaps this fixes some of the broken stuff you have a problem with. https://github.com/BF2Statistics/ASP
     
  13. darth_3pio

    darth_3pio New Member

    That's where I had sourced the install, it doesn't seem to be a site problem, it seems to be a PHP version problem. Something with the way TimeSpan is structured is broken/deprecated in newer versions of PHP.

    I stuck the site on a different machine (compute stick) with the newest x86 xampp package I could find.Somewhere between PHP 7.3.0 and 7.4.29, I've replicated this by installing an older xampp package on the game server machine. As I've not studied PHP in depth I can't write something from scratch (at least not without the time to work on it), just tinker around the edges.

    Short term fix for anyone new coming in would be to pickup a xampp package in the 7.3.x range
     
    Hjaldrgud likes this.
  14. Hjaldrgud

    Hjaldrgud New Member

    Oh yeah. Sorry. I have misunderstood. I have that same problem as well. I didn't know that earlier xampp fixed this. Thank you, that's helpful and interesting. Uni is having a php class which I'm very likely gonna take. My plan was buying a php book and practice by trying to fix this particular problem :p
     
    darth_3pio likes this.
  15. darth_3pio

    darth_3pio New Member

    I've spent the weekend looking at the problem from a different angle. First things first, the player_unlock table was missing a column so the third value, $time, in the Insert statement was being rejected. I updated the sql dB schema and published these changes (and several others) in a fork on github. Secondly, the issue with TimeSpan, as I read it, is that curly braces have been deprecated, though I haven't had a chance to look at this, in theory all we'd have to do is change out the curly braces for square brackets as these were interchangeable in prior versions of PHP.
     
  16. darth_3pio

    darth_3pio New Member

    As we're on the topic of no unlocks, I've been trying to run the unranked-server package on a dedicated box, I was having difficulty getting it pull in rank and unlocks but could see the snapshots were being sent. And BFHQ was loading up the statistics. Turns out I needed to do the obvious thing and edit the hosts file on the server box.

    Obviously the most painless solution is what I was looking for. The new redirector however looks for the game first and refuses to work if that's not present. I have resorted to the older statistics control centre as that has solved this issue. No need to set up anything but the redirect.
     
    Last edited: May 22, 2022