A 19-year-old found with drugs will carry out unpaid work in the community.
Jack Hopkinson, of Bowood Road, Elland, was found with cocaine in a toilet cubicle by bouncers at Liquid nightclub, Halifax.
The doormen had become suspicious when Hopkinson went in with a friend and didn’t return.
They took him to the reception area where Hopkinson tried to run away.
Calderdale Magistrates Court heard that Hopkinson had five bags of cocaine, weighing 2.93g, and £115 in cash.
Hopkinson, representing himself, told magistrates he had lost his job two weeks before the incident and began taking the drug with friends.
He said he was sorry for what had happened and was no longer using the drug
He pleaded guilty to a charge of possessing a controlled drug of class A.
Magistrates decided to impose a community order on Hopkinson.
He will be subject to the order for 12 months, meaning he will have to carry out 60 hours of community work and pay £85 in costs.