Forum PayVault Please help

Discussion and help relating to the PlayerIO payment solution, PayVault.

Please help

Postby farjadfaisal123 » December 11th, 2017, 2:11 pm

How to remove a single item from player vault ?
Like I wna remove a pack after unpack . Can someone tell me a code for it?
farjadfaisal123
 
Posts: 4
Joined: November 17th, 2017, 1:46 pm

Re: Please help

Postby Henrik » December 11th, 2017, 8:32 pm

The Consume method removes items from a player's Vault.
Henrik
.IO
 
Posts: 1822
Joined: January 4th, 2010, 1:53 pm

Re: Please help

Postby farjadfaisal123 » December 12th, 2017, 3:33 pm

I know but it removes all not a single one
farjadfaisal123
 
Posts: 4
Joined: November 17th, 2017, 1:46 pm

Re: Please help

Postby Henrik » December 12th, 2017, 8:55 pm

The Consume method removes all items that you pass in. If you pass in the entire Items collection, it will remove all items. You have to grab the single item you want to remove, and pass that in.
Henrik
.IO
 
Posts: 1822
Joined: January 4th, 2010, 1:53 pm

Re: Please help

Postby farjadfaisal123 » December 13th, 2017, 3:04 am

Player.vault.comsume(“msbow”)”msbow” gives error
farjadfaisal123
 
Posts: 4
Joined: November 17th, 2017, 1:46 pm

Re: Please help

Postby Henrik » December 13th, 2017, 4:06 am

farjadfaisal123 wrote:Player.vault.comsume(“msbow”)”msbow” gives error


Yes, the method takes an item, not an itemkey. And the asynchronous method takes an array of items, so you have to grab the item you want to consume, and then pass it in in an array. Like this:

Code: Select all
var msbow = player.PayVault.First("msbow"); //Grabs the first item with itemkey "msbow".
if (msbow != null) {
    player.PayVault.Consume(new PayVaultItem[]{msbow}, delegate() {
        //Success!
    }, delegate(PlayerIOError error){
        //Error consuming...
    });
}
Henrik
.IO
 
Posts: 1822
Joined: January 4th, 2010, 1:53 pm

Re: Please help

Postby farjadfaisal123 » December 13th, 2017, 10:21 am

Thanks for the help
farjadfaisal123
 
Posts: 4
Joined: November 17th, 2017, 1:46 pm


Return to PayVault