11.02.2011, 15:01
Hey, how can i make my /me command so, that only players not further then 5 meters can c it?
CMD:me( playerid, params[ ] )
{
for( new i = 0; i < MAX_PLAYERS; i++ )
{
new Float:x, Float:y, Float:z;
GetPlayerPos( i, x, y, z );
if ( IsPlayerInRangeOfPoint ( i, 5.0, x, y, z ) ) // You can always change the range
{
if ( i == playerid ) continue;
new string[ 128 ];
new pName[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, pName, sizeof pName );
format( string, sizeof string, "%s %s", pName, params );
SendClientMessage( i, 0xAAAAAA, string );
}
}
return 1;
}
if (strcmp("/me", cmdtext, true, 3) == 0)
{
for( new i = 0; i < MAX_PLAYERS; i++ )
{
new Float:x, Float:y, Float:z;
GetPlayerPos( i, x, y, z );
if ( IsPlayerInRangeOfPoint ( i, 5.0, x, y, z ) ) // You can always change the range
{
if ( i == playerid ) continue;
new string[ 128 ];
new pName[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, pName, sizeof pName );
format( string, sizeof string, "%s %s", pName, cmdtext );
SendClientMessage( i, 0xAAAAAA, string );
}
}
return 1;
}
pawn Код:
|