无法在两个不同的地方得到math.random的工作

function INV:DeleteInventoryItem( ply, pos, item)
    local rarity = INV.PLAYERS[ply:SteamID64()][pos].quality
    ---print(rarity)
    local value = "credits"
    if(rarity == "Common")then
        local amount = math.floor(math.random(1, 30))
        table.remove( INV.PLAYERS[ply:SteamID64()], pos)
        local var = ply:ChatPrint("你从拆卸中获得了 ".. amount .." 个积分!")
        ply:INVAddCredits( amount )
        self.SAVE:SendInventory( ply )
        local updatevalue = INV.PLAYERS[ply:SteamID64()].inventorydata.credits
        UpdateDatabase(value, ply:SteamID(), updatevalue)
    end
end

我遇到的问题是我不能从amount变量中得到相同的值,所以它说你得到了一定数量的积分,但实际上它给了你不同的数量。

我真的很困惑怎么能使它成为相同的金额...任何帮助都将不胜感激!

点赞
用户12713065
用户12713065

感谢大家的帮助!

感谢大家的协助,我已经修正了问题,原因是库存额度添加出了问题。

  • 感谢 D12
2020-01-21 18:27:53