snoop.c
gurba-0.40/lib/cmds/wiz/snoop.c · 1.3 KB
From the archive gurba.tgz
Download the archive « Back to the archive contents
void main( string str ) {
if( str == "" ) {
int i;
object *pSnooping;
pSnooping = this_player()->query_snooping();
if( pSnooping != 0 && sizeof( pSnooping ) > 0 ) {
this_player()->message( "You are snooping:" );
for( i = 0; i < sizeof( pSnooping ); i++ ) {
this_player()->message( capitalize( pSnooping[i]->query_name() ) );
}
} else {
this_player()->message( "You are snooping noone." );
}
} else {
object pPlayer;
pPlayer = USER_D->find_player( str );
if( pPlayer == this_player() ) {
this_player()->message( "You can't snoop yourself." );
return;
}
if( pPlayer == 0 ) {
this_player()->message( "That player isn't here now." );
} else {
if( this_player()->is_snooping( pPlayer ) ) {
this_player()->remove_snooping( pPlayer );
pPlayer->remove_snoopee( this_player() );
} else {
int i;
object *pSnooping;
pSnooping = pPlayer->query_snooping();
if( pSnooping != 0 && sizeof( pSnooping ) > 0 ) {
for( i = 0; i < sizeof( pSnooping ); i++ ) {
if( pSnooping[i]->query_name() == this_player()->query_name() ) {
this_player()->message( "He's already snooping you." );
return;
}
}
}
this_player()->add_snooping( pPlayer );
pPlayer->add_snoopee( this_player() );
}
}
}
}