How would I
#1

How would i go about making Joining and leaving messages where the players around that person can see them and not everyone esle.

Reply
#2

Use Proxdetector in OnPlayerDisconnect
Reply
#3

When player joins he isn't around anyone, so you can't send a message like that, but you can when he's disconnecting and if he's spawned. Make a loop for all players and check if those players are in the range with the player whos leaving (use IsPlayerInRangeOfPoint function).
Reply
#4

This is what I use / have made:

pawn Код:
stock NearByMessage(playerid, colour, string[])
{
    new Float: PlayerX, Float: PlayerY, Float: PlayerZ;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnectedEx( i ) )
        {
            GetPlayerPos(playerid, PlayerX, PlayerY, PlayerZ);
            if(IsPlayerInRangeOfPoint(i, 12, PlayerX, PlayerY, PlayerZ) )
            {
              if(GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( i ) && GetPlayerInterior( playerid ) == GetPlayerInterior( i ) )
          {
                SendClientMessage( i, colour, string );
            }
        }
        }
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new string[ 75 ], Name[ MAX_PLAYER_NAME ];
   
    GetPlayerName( playerid, Name, sizeof( Name ) );
   
    switch( reason )
    {
        case 0:
        {
            format( string, sizeof( string ), "%s has timed out from the server.", Name );
        }
        case 1:
        {
            format( string, sizeof( string ), "%s has left the server.", Name );
        }
      case 2:
        {
            format( string, sizeof( string ), "%s has been either kicked or banned from the server.", Name );
        }
    }

    NearByMessage( playerid, ANNOUNCEMENT, string );
    print( string );
   
    return 1;
}
You'll need to add a colour.
Reply
#5

Quote:
Originally Posted by CalgonX
This is what I use / have made:

pawn Код:
stock NearByMessage(playerid, colour, string[])
{
    new Float: PlayerX, Float: PlayerY, Float: PlayerZ;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnectedEx( i ) )
        {
            GetPlayerPos(playerid, PlayerX, PlayerY, PlayerZ);
            if(IsPlayerInRangeOfPoint(i, 12, PlayerX, PlayerY, PlayerZ) )
            {
              if(GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( i ) && GetPlayerInterior( playerid ) == GetPlayerInterior( i ) )
          {
                SendClientMessage( i, colour, string );
            }
        }
        }
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new string[ 75 ], Name[ MAX_PLAYER_NAME ];
   
    GetPlayerName( playerid, Name, sizeof( Name ) );
   
    switch( reason )
    {
        case 0:
        {
            format( string, sizeof( string ), "%s has timed out from the server.", Name );
        }
        case 1:
        {
            format( string, sizeof( string ), "%s has left the server.", Name );
        }
      case 2:
        {
            format( string, sizeof( string ), "%s has been either kicked or banned from the server.", Name );
        }
    }

    NearByMessage( playerid, ANNOUNCEMENT, string );
    print( string );
   
    return 1;
}
Thank you for the help, I belive i have played on your server calgon, I was Ryan_Pot. I don't have the ip anymore, Well the server in my favs gets a 9999 ping
Reply
#6

Quote:
Originally Posted by ihatetn931
Quote:
Originally Posted by CalgonX
This is what I use / have made:

pawn Код:
stock NearByMessage(playerid, colour, string[])
{
    new Float: PlayerX, Float: PlayerY, Float: PlayerZ;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnectedEx( i ) )
        {
            GetPlayerPos(playerid, PlayerX, PlayerY, PlayerZ);
            if(IsPlayerInRangeOfPoint(i, 12, PlayerX, PlayerY, PlayerZ) )
            {
              if(GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( i ) && GetPlayerInterior( playerid ) == GetPlayerInterior( i ) )
          {
                SendClientMessage( i, colour, string );
            }
        }
        }
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new string[ 75 ], Name[ MAX_PLAYER_NAME ];
   
    GetPlayerName( playerid, Name, sizeof( Name ) );
   
    switch( reason )
    {
        case 0:
        {
            format( string, sizeof( string ), "%s has timed out from the server.", Name );
        }
        case 1:
        {
            format( string, sizeof( string ), "%s has left the server.", Name );
        }
      case 2:
        {
            format( string, sizeof( string ), "%s has been either kicked or banned from the server.", Name );
        }
    }

    NearByMessage( playerid, ANNOUNCEMENT, string );
    print( string );
   
    return 1;
}
Thank you for the help, I belive i have played on your server calgon, I was Ryan_Pot. I don't have the ip anymore, Well the server in my favs gets a 9999 ping
Good to hear (+ check the hosted tab, we moved to Canada but we're still listed).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)