Thanks for your query.Based on the facts that you have posted it appears that you have problem of Erectile Dysfunction
You have been having Typhoid Fever
since three weeks and taking medications for the same.
It is common to have libido after any major illness and this is the reason for you not getting good erection.
Since you are smoker and consume alcohol on regular basis this is also an additional factor for not getting erection.
Do not worry thing will settle down once you recover completely from your present illness.