Quote:
Originally Posted by xPaw
Loop trough players, check team, and send message (MSG_ONE_UNRELIABLE)
|
How do i loop trough players and send message (MSG_ONE_UNRELIABLE) ?
get_user_team like this ?
PHP Code:
public Beacon_On( id )
{
if ( user_is_alive( id ) )
{
new CsTeams:team = cs_get_user_team( id )
if ( team == CS_TEAM_CT )
{
static origin[ 3 ]
emit_sound( id, CHAN_ITEM, Beacon, 1.0, ATTN_NORM, 0, PITCH_NORM )
get_user_origin( id, origin )
message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
write_byte( TE_BEAMCYLINDER )
write_coord( origin[ 0 ] )
write_coord( origin[ 1 ] )
write_coord( origin[ 2 ]-20 )
write_coord( origin[ 0 ] )
write_coord( origin[ 1 ] )
write_coord( origin[ 2 ]+200 )
write_short( Beacon )
write_byte( 0 )
write_byte( 1 )
write_byte( 6 )
write_byte( 2 )
write_byte( 1 )
write_byte( 0 )
write_byte( 0 )
write_byte( 255 )
write_byte( 255 )
write_byte( 6 )
message_end( )
set_task( 1.0, "Beacon_On", id )
}
else
{
new CsTeams:team = cs_get_user_team( id )
if ( team == CS_TEAM_CT )
{
static origin[ 3 ]
emit_sound( id, CHAN_ITEM, Beacon, 1.0, ATTN_NORM, 0, PITCH_NORM )
get_user_origin( id, origin )
message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
write_byte( TE_BEAMCYLINDER )
write_coord( origin[ 0 ] )
write_coord( origin[ 1 ] )
write_coord( origin[ 2 ]-20 )
write_coord( origin[ 0 ] )
write_coord( origin[ 1 ] )
write_coord( origin[ 2 ]+200 )
write_short( Beacon )
write_byte( 0 )
write_byte( 1 )
write_byte( 6 )
write_byte( 2 )
write_byte( 1 )
write_byte( 0 )
write_byte( 0 )
write_byte( 255 )
write_byte( 255 )
write_byte( 6 )
message_end( )
set_task( 1.0, "Beacon_On", id )
}
}
}
}
__________________