void main()
{
    object oArea = GetArea(OBJECT_SELF);
    object oPlayer = GetFirstPC();
    int iStopPoint = GetLocalInt(OBJECT_SELF, "WHEEL_STOP_POINT");
    SendMessageToPC(oPlayer, "Script entered.");
    
    int i; // Define the variable outside the loop

    while (GetIsObjectValid(oPlayer))
    {
        if (GetDistanceBetween(OBJECT_SELF, oPlayer) < 10.0) // Assuming 10.0 as the proximity range
        {
            // Check for correct WHEEL_BET
            int iBet = GetLocalInt(oPlayer, "WHEEL_BET");
            if (iBet == iStopPoint)
            {
                int iBetAmount = GetLocalInt(oPlayer, "WHEEL_BET_AMOUNT");
                int iReward = iBetAmount * 4;

                // Reward the player with tickets
                for (i = 0; i < iReward; i++)
                {
                    CreateItemOnObject("cas_ticket", oPlayer, 1);
                }

                SendMessageToPC(oPlayer, "You won " + IntToString(iReward) + " tickets!");
            }

            // Reset the bet variables regardless of whether the bet was correct
            DeleteLocalInt(oPlayer, "WHEEL_BET");
            DeleteLocalInt(oPlayer, "WHEEL_BET_AMOUNT");
            SendMessageToPC(oPlayer, "The number you bet on and the amount has been reset. Please place new bets.");
        }

        oPlayer = GetNextPC();
    }
}
