question

karlanton avatar image
karlanton asked

Grant item?

I've tried to setup a playstream hook which would grant an item to a player which didnt work. But it did work to increment a statistics value. And im guessing i can't grant an item this way because it would be easier for a cheater to get items this way? So what do i have to do to grant a player an item?

apiswebhooks
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Hernando avatar image
Hernando answered

Setup a playstream hook to grant the player items is a safe way (and you can use server authoritative code to check things you need to).So if you are using the ServerAPI(server.GrantItemsToUser) to grant the player items in cloudscript, then it should work as expected.

Thus I guess there may be some problems in your Rules or CloudScript. Is it convenient to post the detailed configuration information of them?

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

karlanton avatar image karlanton commented ·

I don't quite understand what I'm supposed to write in the cloudscript to grant an item to a player ..

Anyway, this is how i setup the rule to grant an item to a player:

https://gyazo.com/d5376eaf34742cc522985b9106114352

which as i said didn't work but it did work with incrementing player statistics!

0 Likes 0 ·
Hernando avatar image Hernando karlanton commented ·

Your rules configuration looks correct, can you show the code that calls the function Client.WritePlayerEvent ? And please confirm whether the custom event has these three records in the playstream after the client writes event.

0 Likes 0 ·
Hernando avatar image Hernando karlanton commented ·

Besides, It is not safe to grant a item to a player without CloudScirpt or custom game server checking the data. If the item grant is in response to a client-generated action (via WritePlayerEvent), there’s nothing preventing a hacker from sending that event over and over again. So, we recommend that you write logic in the CloudScript handler to check the input from client.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.