act_comm
Indigo/act_comm · 1.5 KB
From the archive indigo001.tgz
Download the archive « Back to the archive contents
<?
function do_quit( $player, $message )
{
$mud->resetconnection( $player, $char_list[$player] );
return;
}
function do_say( $player, $message )
{
if( is_array( $message ) )
{
foreach( $message as $word )
$output .= "$word ";
}
else
$output = $message;
socket_write( $player->sock_id, "Your message was $output\n" );
return;
}
function do_who( $player, $arg_arr )
{
global $char_list;
socket_write( $player->sock_id, "Who is currently on: \n" );
foreach( $char_list as $wch )
send_to_desc( $player->sock_id, "$wch->name\n" );
return;
}
function do_chat( $player, $message )
{
global $char_list;
if( is_array( $message ) )
{
foreach( $message as $word )
$output .= "$word ";
}
else
$output = $message;
foreach( $char_list as $wch )
send_to_desc( $wch->sock_id, "$player->name chats: $output\n" );
return;
}
function do_sockets( $player, $empty )
{
global $char_list;
foreach( $char_list as $wch )
{
/* Get addresses */
$status .= "$wch->name =>";
$location = socket_getpeername ($wch->sock_id, $peer_addr, $peer_port);
switch( $wch->con )
{
case 'CON_CONNECTING':
$status .= "Connecting => $location\n"; break;
case 'CON_PLAYING':
$status .= "Playing => $location\n"; break;
default:
$status .= "Unknown => $location\n"; break;
}
}
send_to_desc( $player->sock_id, $status );
}
?>