28.09.2010, 16:01
(
Последний раз редактировалось Scenario; 28.09.2010 в 19:52.
)
Here, this should do it.
Notice, this command uses ZCMD and SSCANF2. Change the colors.
This is the custom function to make it work.
Notice, this command uses ZCMD and SSCANF2. Change the colors.
pawn Код:
command(me, playerid, params[])
{
new Message[128], string[128];
if( sscanf( params, "s[128]", Message) )
{
SendClientMessage( playerid, COLOR_WHITE, "SYNTAX: /me [action]" );
}
else
{
format( string, sizeof( string ), "* %s %s", GetPlayerNameEx( playerid ), Message);
NearByMessage( playerid, COLOR_PURPLE, string);
}
return 1;
}
pawn Код:
forward NearByMessage(playerid, color, String[]);
public NearByMessage( playerid, color, String[])
{
new Float: PlayerX, Float: PlayerY, Float: PlayerZ, string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected( i ))
{
GetPlayerPos( playerid, PlayerX, PlayerY, PlayerZ);
if(IsPlayerInRangeOfPoint(i, 12, PlayerX, PlayerY, PlayerZ) )
{
if(GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( i ) && GetPlayerInterior( playerid ) == GetPlayerInterior( i ) )
{
SendClientMessage(i, color, string);
}
}
}
}
return 1;
}
forward NearByMessageEx(playerid, color, String[], Float: range);
public NearByMessageEx( playerid, color, String[], Float: range)
{
new Float: PlayerX, Float: PlayerY, Float: PlayerZ, string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected( i ) )
{
GetPlayerPos( playerid, PlayerX, PlayerY, PlayerZ);
if(IsPlayerInRangeOfPoint(i, range, PlayerX, PlayerY, PlayerZ) )
{
if(GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( i ) )
{
SendClientMessage(i, color, string);
}
}
}
}
}
stock GetPlayerNameEx(playerid)
{
new str[24], String[128];
GetPlayerName(playerid,String,24);
strmid(str,String,0,strlen(String),24);
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if (str[i] == '_') str[i] = ' ';
}
return str;
}