How should I send a reward to the match winner?

Hello there,

I’m trying to look in to how to distribute reward in winner’s wallet within matchLoop.

Right now my code is:

switch(s.winnerInfo){
        case WinnerInfo.BLUE:{
            s.blueUserIds.forEach(userId=>{
                let netAmount = s.usersBetAmount[userId] //todo rewards logic
                nk.walletUpdate(userId, {[currencyKeyName]: netAmount},{
                    transfer_type: "blue_winner",
                    fight_number: s.fightInfo.fight_number
                },true);
                s.blueUserIds = s.blueUserIds.filter((e: string) => e !== userId)
                s.usersBetAmount[userId] = 0
            })
        }break;
    }

Is there an alternative way of doing it? Or is there any documentations available regarding this?

Thank you

Hi @seiferxiii welcome to the forum. Can you tell me about how a match plays and how the wind condition is determined? When the win condition is determined would you like to send that player a reward?

Are you using client relayed multipayer, and what engine, and server runtime are you using?