I'm a beginner at scripting myself, but I think this might help solve your problem:
~1
police sidechat" WHAT THE HELL ARE YOU DOING!!!"
~1
#loop1
police domove getpos sean
? sean distance police <8 : goto "takegun"
~0.5
goto "loop1"
#takegun
~2
police sidechat "you are under arrest. I am taking your weapons"
~2
removeallweapons sean
~1
#loop2
? sean distance police > 15 : goto "warning"
~0.5
goto "loop2"
#warning
police sidechat "Please stay where you are"
police domove getpos sean
police dotarget sean
police dofire sean
exit
See if that helps.