GiveCoins VIP
π Giving Diamonds to Players
There are two ways to give diamonds to a player:
Using the in-game command
Updating directly through the database
πΉ Method 1 β In-Game Command
Use the following command inside the F8:
givemoney [player_id] diamonds [amount]
Example: givemoney 12 diamonds 500
This will give 500 diamonds to the player with ID 12
.
πΉ Method 2 β Database Update (SQL)
You can also update a playerβs diamonds directly in the database.
This uses the table battle_users
.
Example SQL Update
UPDATE battle_users
SET diamonds = GREATEST(diamonds + ?, 0)
WHERE user_id = ?;
πΉ Using oxmysql Export in Lua
If you want to handle this directly in your scripts with oxmysql, you can use:
exports.oxmysql:execute([[
UPDATE battle_users
SET diamonds = GREATEST(diamonds + ?, 0)
WHERE user_id = ?
]], { amount, user_id })
diamonds
β The column being updatedGREATEST(diamonds + ?, 0)
β Ensures the value never goes below0
{ amount, user_id }
β Parameters passed in order (amount
first, thenuser_id
)
Atualizado