SA-MP Forums Archive
How would I - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How would I (/showthread.php?tid=125594)



How would I - ihatetn931 - 04.02.2010

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




Re: How would I - timmehhh - 04.02.2010

Use Proxdetector in OnPlayerDisconnect


Re: How would I - Correlli - 04.02.2010

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).


Re: How would I - Calgon - 04.02.2010

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.


Re: How would I - ihatetn931 - 04.02.2010

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


Re: How would I - Calgon - 04.02.2010

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).