Jump to content

ralphix

New Members
  • Posts

    3
  • Joined

  • Last visited

ralphix's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I solved it! Many thanks anyway
  2. Hello, yes, for each level of weapon player need another item. My code for upgrading working, I have just problem with checking inventory -> if player have the item what need for upgrade. The query reading just first row, where player id = '$id'. Weapon upgrade for level 2 working, because the first row is item 2, so the upgrade do sucessfuly. But upgrade for level 3 or 4 not working, because the items is in row 2 and row 3, so then comes echo: you don't have item for upgrade! If I delete item 2 from player invenotry database, the first row is item 3 and then upgrade for level 3 works. I tried while, mysqli_fetch_all, mysqli_fetch_assoc but problem is still same, query still reading just first row.
  3. Hello there. Im working on my simple game, but I have a big problem now. Im trying create weapon upgrade system. Yes I know, the code is amateur. 😅 For next level weapon upgrade you need another item. Upgrade system working just in case, when the item is on the first line in the database. I tried while($itemneed=mysqli_fetch_array($itemcon2)) but still same problem. Why the system working just when the item is on the first line in database and not working with items in other lines? For example: In DB I have: Playerid, id (itemid) 2 2 2 3 2 4 and working just with item 2. When upgrade need another item (3 or 4), comes echo you don't have item for upgrade!. Where is problem, please? I don't know what to do next. Many thanks! $invcon="SELECT * from items where playerid='$id'"; $invcon2=mysqli_query($connection, $invcon); $itemupg=mysqli_fetch_array($invcon2); $itemcon="SELECT * from weapons where playerid='$id' and weapid='$weapid'"; $itemcon2=mysqli_query($connection, $itemcon) or die("could not select backpack"); $itemneed=mysqli_fetch_array($itemcon2); if($itemneed['level'] == 1) { $item = "2"; } elseif($itemneed['level'] == 2) { $item = "3"; } elseif($itemneed['level'] == 3) { $item = "4"; } if($itemupg['id'] != $item) { echo "you don't have item for upgrade!"; } else {
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.