Posts: 600
Threads: 99
Joined: Apr 2008
Reputation:
0
How would i go about making Joining and leaving messages where the players around that person can see them and not everyone esle.
Posts: 23
Threads: 0
Joined: Jan 2008
Reputation:
0
Use Proxdetector in OnPlayerDisconnect
Posts: 6,340
Threads: 58
Joined: May 2009
Reputation:
0
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).
Posts: 6,129
Threads: 36
Joined: Jan 2009
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.
Posts: 6,129
Threads: 36
Joined: Jan 2009
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).