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 updated

  • GREATEST(diamonds + ?, 0) β†’ Ensures the value never goes below 0

  • { amount, user_id } β†’ Parameters passed in order (amount first, then user_id)

Atualizado