Skip to content
View in the app

A better way to browse. Learn more.

MagicDuel Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Function: mds_get_resource_count()

Featured Replies

  • Root Admin

array mds_get_resource_count()

Returns an associative array with the resources a user has in their inventory and the count.

The returned format is:

array(42) {
  'Aromatic herbs' =>
  int(98)
  'Basic Iron Ingot' =>
  int(4)
  'Bones' =>
  int(2)
  'Branches' =>
  int(109)
  'Bushies' =>
  int(50)
  'Clay' =>
  int(18)
}

If the user has no resources this will return an empty array. The keys are the resource name and the value is the number of resources.

 

A quick example how to loop through the associative array and get all the values displayed

 


@vb = mds_get_resource_count();

//@vb is the associative array you get from the function
//in the foreach loop we go through @vb
//with @vk we assign the k.ey of @vb so in this case the name of the resource
//@vv is the va.lue to @vk


foreach (@vb as @vk => @vv) {
    echo "Resource: @vk, Amount: @vv<br>";
}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Forum Statistics

  • Total Topics 17.5k
  • Total Posts 182.2k

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.