10.02.2010, 01:02
With ZCMD+SSCANF:
STOCK:
pawn Код:
command(local, playerid, params[])
{
new message[ 128 ], Name[ MAX_PLAYER_NAME ], string[ 128 ];
if( sscanf( params, "z", message) )
{
SendClientMessage( playerid, WHITE, "Syntax: /local [message]" );
}
else
{
GetPlayerName( playerid, Name, sizeof( Name ) );
format( string, sizeof( string ), "%s says: %s", Name, message );
NearByMessage( playerid, WHITE, string );
}
return 1;
}
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;
}