Skip to content

Fix TeamBets module: bets blocked, broken odds, payout ignoring odds#1

Merged
Pintuzoft merged 1 commit intomainfrom
copilot/fix-betting-module
Mar 27, 2026
Merged

Fix TeamBets module: bets blocked, broken odds, payout ignoring odds#1
Pintuzoft merged 1 commit intomainfrom
copilot/fix-betting-module

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

The betting module was completely non-functional due to a bitwise operator bug blocking all bet placement, compounded by broken odds math and a payout that ignored odds entirely.

Bugs fixed

  • isOnATeam() always false — used bitwise | instead of logical ||, so every bet attempt was silently rejected with "You must be on a team":

    // Before
    return team == ( CsTeam.Terrorist | CsTeam.CounterTerrorist );
    // After
    return team == CsTeam.Terrorist || team == CsTeam.CounterTerrorist;
  • Odds calculation — integer division truncated all results to 0 or 1, and a zero-player team caused a DivideByZeroException:

    // Before
    odds = ctSize / tSize;
    // After
    odds = tSize > 0 ? (float)ctSize / tSize : 1.0f;
  • Payout ignored oddsodds was stored on Bet but never applied; winners only received their original stake back:

    // Before
    int payout = bet.amount;
    // After
    int payout = (int)(bet.amount * (1.0f + bet.odds));
  • Debug message — removed leftover PrintToChat("[TeamBets]: WooHoo! you are here!!") from handleBetCommand.

…ero, payout, and debug message

Agent-Logs-Url: https://github.com/Pintuzoft/OSBase/sessions/a980a35d-ddc2-47cd-b79f-8f1833bff3cf

Co-authored-by: Pintuzoft <6753348+Pintuzoft@users.noreply.github.com>
@Pintuzoft
Copy link
Copy Markdown
Owner

@copilot made a fix to teambets

@Pintuzoft Pintuzoft merged commit e071390 into main Mar 27, 2026
1 of 2 checks passed
Copilot stopped work on behalf of Pintuzoft due to an error March 27, 2026 12:47
Copilot AI requested a review from Pintuzoft March 27, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants