Elsewhere, a man was arrested for a string of indecent assaults after pupils named him.
The year-old All-Wales School Liaison Programme aims to foster good relations between young people and community police officers in the classroom.
But according to an internal end-of-year report, the programme - part of the personal and social education timetable - is also helping to fight crime.
Officers are trained to deliver lessons on social issues affecting young people such as binge drinking, anti-social behaviour, drugs, and under-age sex and pregnancy.
Secondary pupils have been shown a video mapping the path of a drug-user through the penal system. Rather than telling young people to say no to drugs, it lets them ponder the consequences through a user's eyes.
Children are also approaching officers with their own concerns. Unknown to her parents, the schoolgirl who arranged to meet a stranger had been exchanging electronic messages with the man over several months. But she told a police officer assigned to her school about the planned meeting, and he informed her parents.
Linda Roberts, a Port Talbot secondary-school teacher who co-ordinates the scheme, said: "Considerable support has been received from heads and PSE teachers, and young people have also welcomed this initiative."
Sue Lyle, education lecturer at Swansea Institute of Higher Education, said: "The introduction of this programme is now widely seen as an acceptable way of supporting aspects of the PSE curriculum."
The school liaison programme was launched in September 2004, thanks to Pounds 3.2 million funded by the National Assembly and Wales's four police forces.
An Assembly government spokesperson said: "We see education as key to helping tackle substance misuse, which is why we've allocated over pound;3 million towards this programme over three years."
There are 70 community officers working in schools across Wales, each responsible for four secondaries and their feeder primary schools. Almost 97 per cent of Welsh schools signed up to the scheme: in south Wales, only nine schools have opted out.
The internal report on the scheme's first year says 54 per cent of heads who answered a questionnaire were positive about it.
Future funding is likely to depend on an evaluation by Professor Howard Williamson, of the University of Glamorgan, who is vice-chair of the Wales Youth Agency.