If money isn't credited to my account when I sell something, how come they take money out when I buy something ??? .

Whenever you sell something, the proceed are credited to your account. Doesn't matter whether it's an option or a stock, etc. Conversely, whenever you buy something, the proceeds are deducted from your account. Transactions result in a change in your cash balance.
Margin and SMA balance may be affected.
Account value is not affected unless the value of the underlying changes

Whenever you sell something, the proceed are credited to your account. Doesn't matter whether it's an option or a stock, etc. Conversely, whenever you buy something, the proceeds are deducted from your account. Transactions result in a change in your cash balance.
Margin and SMA balance may be affected.
Account value is not affected unless the value of the underlying changes