SA-MP Forums Archive
Can anyone tell me how to make a /Local cmd? LOCAL chat - 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: Can anyone tell me how to make a /Local cmd? LOCAL chat (/showthread.php?tid=126752)



Can anyone tell me how to make a /Local cmd? LOCAL chat - Tony_Valentino - 10.02.2010

i need a local chat comand that works in radius please show me the code or tell me how.
i searched also NO HELP
not even wiki


Re: Can anyone tell me how to make a /Local cmd? LOCAL chat - Babul - 10.02.2010

a local chat is basically a chat message that only gets sent to a certain range of a player. search for a /whisper command. that will do fine


Re: Can anyone tell me how to make a /Local cmd? LOCAL chat - Calgon - 10.02.2010

With ZCMD+SSCANF:

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;
}
STOCK:

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;
}