CodeRanch - Coin Toss & Dice Roll

Old Western Coin Toss & Dice Roll Gambling System for RedM

This script provides an immersive gambling system for RedM servers. Players can challenge each other to coin toss or dice roll games with customizable bets. The system features animations, sound effects, and full framework support.

🚀 Features

  • Multi-Framework Support: VORP, RSG, QBR and Standalone

  • Coin Toss Gambling: Classic heads or tails betting

  • Dice Roll Gambling: Customizable dice with 2-20 sides

  • Player vs Player: Challenge nearby players to wager matches

  • Animated Gameplay: Realistic coin flip and dice roll animations

  • Sound Effects: Immersive audio feedback for all actions

  • Interactive UI: NUI interface for creating challenges

  • Quick Commands: Fast challenge system via commands

  • Bet Validation: Automatic validation of bet amounts and player funds

  • Auto-Expiry: Challenges expire after timeout period

📋 Requirements

  • RedM Server (Beta 1491+)

  • Supported Frameworks: VORP, RSG, QBR or Standalone

🛠️ Installation

1

Download Files

Copy the resource folder to your server's resources folder.

2

Server.cfg Settings

Add your framework dependencies (only add the ones you use) and ensure the coin toss resource.

3

Configuration

Edit config.lua file according to your server's needs.

⚙️ Configuration

Framework Settings

Game Settings

Coin Toss Settings

Dice Roll Settings

UI Settings

Sound Settings

Animation Settings

Language Settings

🎮 Usage

For Players

Coin Toss Game

1

Approach Another Player

Get within 3 meters.

2

Open Challenge Menu

Type /cointoss (opens UI).

3

Set Bet Amount

Enter your desired bet.

4

Choose Heads or Tails

Pick your side.

5

Send Challenge

Player receives a notification.

6

Accept or Decline

Press G to accept, X to decline.

7

Watch the Flip

Animation plays automatically.

8

Winner Takes All

Winner receives both bets.

Quick Challenge:

Dice Roll Game

1

Approach Another Player

Get within 3 meters.

2

Open Challenge Menu

Type /diceroll (opens UI).

3

Set Bet Amount

Enter your desired bet.

4

Choose Dice Sides

Select 2-20 sided dice.

5

Send Challenge

Player receives a notification.

6

Accept or Decline

Press G to accept, X to decline.

7

Watch the Roll

Dice animation plays.

8

Winner Determined

Highest roll wins (tie returns bets).

Quick Challenge:

Challenge Acceptance

  • Press G to accept the challenge

  • Press X to decline the challenge

  • Challenge expires after 30 seconds

🔧 Advanced Settings

Customizing Bet Limits

Adjusting Game Duration

Disabling Features

Customizing Dice Range

Changing Key Bindings

🐛 Troubleshooting

chevron-rightFramework Not Detectedhashtag
  • Set Config.Framework manually instead of "auto"

  • Make sure your framework is properly loaded

  • Check framework name in fxmanifest.lua

chevron-rightMoney Not Deducting/Addinghashtag
  • Verify framework compatibility

  • Check if player has sufficient funds

  • Enable debug mode: Config.Debug = true

chevron-rightChallenges Not Workinghashtag
  • Check players are within range (default 3 meters)

  • Verify both players have enough money

  • Make sure player isn't already in a game

chevron-rightAnimations Not Playinghashtag
  • Check Config.Animations.Enabled = true

  • Verify prop models exist in game

  • Test with debug mode enabled

chevron-rightNo Sound Effectshashtag
  • Check Config.Sounds.Enabled = true

  • Verify sound files exist in nui/sounds/ folder

  • Check volume settings: Config.Sounds.Volume

🔄 Game Flow

Coin Toss Flow

1

Challenge Sent

Player A challenges Player B with bet amount.

2

Notification

Player B receives notification.

3

Acceptance

Player B accepts or declines.

4

Deduct Bets

If accepted, both players' money is deducted.

5

Animation

Coin flip animation plays (3 seconds).

6

Outcome

Coin lands on heads or tails.

7

Payout

Winner receives both bets (bet × 2).

Dice Roll Flow

1

Challenge Sent

Player A challenges Player B with bet and dice sides.

2

Notification

Player B receives notification.

3

Acceptance

Player B accepts or declines.

4

Deduct Bets

If accepted, both players' money is deducted.

5

Roll

Both players roll the dice.

6

Outcome

Higher roll wins; tie returns bets.

7

Payout

Winner receives both bets (bet × 2).

🛡️ Safety Features

  • Bet Validation: Automatic validation of bet amounts

  • Fund Check: Verifies both players have enough money

  • Distance Check: Players must be within range

  • Game Lock: Players cannot join multiple games

  • Auto-Expiry: Challenges expire after 30 seconds

  • Self-Challenge Prevented: Cannot challenge yourself

🎨 Customization

Adding Custom Sounds

Place your custom sounds in nui/sounds/ folder and reference them in config:

Modifying UI Theme

Edit nui/css/style.css and nui/js/script.js to customize the interface.

Adding New Props

Use GTA V object hash names for custom props:

🔍 Debug Mode

Enable debug mode to see detailed console logs:

Debug command (admin only):

📊 Framework Integration

VORP Core

RSG Core

QBR Core

Standalone

🔄 Updates

v1.0.0

  • Initial release

  • Coin toss gameplay

  • Dice roll gameplay

  • Multi-framework support

  • NUI interface

  • Sound effects

  • Animations

  • Debug mode

📄 License

This script is developed by CodeRanch. Commercial use requires permission.


Note: This script is developed for RedM Beta version. Incompatibilities may occur in RedM's official release.

Last updated