You can use playerattached() to check if a players is attached before it runs anymore script or a piece of script. By using something like if(playerattached()==0) { end; } you can prevent a script for running with no player attached. Or another version is if(playerattached()!=0) { announce "Your really did it!",bc_self,0x008000; }.
Peopleperson49
*playerattached()
Returns the ID of the player currently attached to the script. It will return
0 if no one is attached, or if the attached player no longer exists on the map
server. It is wise to check for the attached player in script functions that
deal with timers as there's no guarantee the player will still be logged on
when the timer triggers. Note that the ID of a player is actually their
account ID.