Ann/MSG in a world

Started by MEGAMIND, Sep 09, 2018, 06:42 PM

Previous topic - Next topic

MEGAMIND

Hi everyone does anyone know how to announe or message everyone in a specific world for example

I want to announce or display a message to everyone in world 2, but it should not be displayed in world 1

!

#1
function MessageWorld( world, text ) {
  for( local i = 0; i < GetMaxPlayers(); i++ ) {
    local plr = FindPlayer(i);
    if ( !plr ) continue;
    if ( plr.World != world.tointeger() ) continue;
    MessagePlayer( text, plr );
  }
}

Discord: zeus#5155

MEGAMIND

#2
Quote from: ! on Sep 09, 2018, 07:03 PMfor( local i = 0; i < GetMaxPlayers; i++ ) {
  local plr = FindPlayer(i);
  if ( !plr ) continue;
  if ( plr.World != 2 ) continue;
  MessagePlayer( "Bla bla bla", plr );
}

Message is required not messageplayer,

Like it has announed sething to all only in world 2 to everyone but should not announce in world 1

MatheuS

Quote from: MEGAMIND on Sep 09, 2018, 07:04 PM
Quote from: ! on Sep 09, 2018, 07:03 PMfor( local i = 0; i < GetMaxPlayers; i++ ) {
  local plr = FindPlayer(i);
  if ( !plr ) continue;
  if ( plr.World != 2 ) continue;
  MessagePlayer( "Bla bla bla", plr );
}

Message is required not messageplayer

It's the same thing, you'll be sending message to everyone in the 2 world. The MessagePlayer was only used to identify players
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

MEGAMIND

Quote from: Takanaue on Sep 09, 2018, 07:07 PM
Quote from: MEGAMIND on Sep 09, 2018, 07:04 PM
Quote from: ! on Sep 09, 2018, 07:03 PMfor( local i = 0; i < GetMaxPlayers; i++ ) {
  local plr = FindPlayer(i);
  if ( !plr ) continue;
  if ( plr.World != 2 ) continue;
  MessagePlayer( "Bla bla bla", plr );
}

Message is required not messageplayer

It's the same thing, you'll be sending message to everyone in the 2 world. The MessagePlayer was only used to identify players
any other example pls

!

#5
local i = 0;
while( i < GetMaxPlayers() ) {
  local plr = FindPlayer(i);
  i++;
 
  if ( !plr ) continue;
  if ( plr.World != 2 ) continue;
  MessagePlayer( "Bla bla bla", plr );
}

Discord: zeus#5155