Whisper command +REP
#1

Could anybody script a /w TEXT command for me which stands for whisper,and only people in close proximity can hear the message?
Reply
#2

PHP код:
CMD:w(playeridparams[])
{
    if(
isnull(params)) return SendClientMessage(playeridCOLOR_SEAGREEN"Usage: /w(hisper) [message]");
    new 
string[150], pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(stringsizeof string"'%s whispers' %s %s"pNamestringparams);
    
SendRangeMessage(playerid, -1string20.0);
    return 
1;

Paste this somewhere in your script outside any callback / cmd.
PHP код:
stock SendRangeMessage(playeridCOLOR, const text[], Float:range)
{
    new 
Float:XFloat:YFloat:Z;
    
GetPlayerPos(playeridXYZ);
    for(new 
GetPlayerPoolSize()+1; --i!=-1;)
    {
        if(!
IsPlayerConnected(i) || IsPlayerNPC(i) || !IsPlayerInRangeOfPoint(irangeXYZ)) continue;
        
SendClientMessage(iCOLORtext);
    }
    return 
1;

Reply
#3

Quote:
Originally Posted by saffierr
Посмотреть сообщение
PHP код:
CMD:w(playeridparams[])
{
    if(
isnull(params)) return SendClientMessage(playeridCOLOR_SEAGREEN"Usage: /w(hisper) [message]");
    new 
string[150], pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(stringsizeof string"'%s whispers' %s %s"pNamestringparams);
    
SendRangeMessage(playerid, -1string20.0);
    return 
1;

Paste this somewhere in your script outside any callback / cmd.
PHP код:
stock SendRangeMessage(playeridCOLOR, const text[], Float:range)
{
    new 
Float:XFloat:YFloat:Z;
    
GetPlayerPos(playeridXYZ);
    for(new 
GetPlayerPoolSize()+1; --i!=-1;)
    {
        if(!
IsPlayerConnected(i) || IsPlayerNPC(i) || !IsPlayerInRangeOfPoint(irangeXYZ)) continue;
        
SendClientMessage(iCOLORtext);
    }
    return 
1;

Stop the abuse of stock!
Reply
#4

Thanks you alot.
Reply
#5

Well you can easily use the /w cmd without a stock but, I don't see the big problem init. Maybe if you tell me the problem or something which could cause a problem, I might use it without a stock.
Reply
#6

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Well you can easily use the /w cmd without a stock but, I don't see the big problem init. Maybe if you tell me the problem or something which could cause a problem, I might use it without a stock.
It's not about "problem" it's about the proper usage of stock. Click that thread link posted by Infinity above, you will find it out yourself.
Reply
#7

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Well you can easily use the /w cmd without a stock but, I don't see the big problem init. Maybe if you tell me the problem or something which could cause a problem, I might use it without a stock.
He didn't mean that you shouldn't have a "SendRangeMessage"
What he meant is that adding the word stock behind a function in a script (Excluding includes) is useless.
Reply
#8

PHP код:
COMMAND:w(playeridparams[])
{
    new 
iPlayeriText128 ];
    if( 
sscanf params"us"iPlayeriText))  return SCP(playerid"[PlayerID/PartOfName] [message]");
    if(!
IsPlayerConnected(iPlayer)) return SendClientError(playeridPLAYER_NOT_FOUND);
    if(
PlayerTemp[iPlayer][wlock]==&& !PlayerInfo[playerid][power])
        return 
SendClientMessage(playerid,COLOR_RED,"The given player has locked their whispers.");
    new 
iDistance GetDistanceBetweenPlayers(playeridiPlayer);
    if(
iDistance || PlayerInfo[playerid][power] || PlayerInfo[playerid][helper])
    {
        if(
iDistance 6format(iStrsizeof(iStr), "(( [%s] %s: %s ))"AdminLevelName(playerid), AnonAdmin(playerid), iText);
        else 
format(iStrsizeof(iStr), "** %s[%d] whispers: %s"MaskedName(playerid), playeridiText);
        
SendClientMessage(iPlayerCOLOR_YELLOWiStr);
        if(
iDistance 6format(iStrsizeof(iStr), "(( PM sent to %s: %s ))"RPName(iPlayer), iText);
        else 
format(iStrsizeof(iStr), "** Whisper sent to %s[%d]: %s"MaskedName(iPlayer), iPlayeriText);
        
SendClientMessage(playeridCOLOR_YELLOWiStr);
        
format(iStr,sizeof(iStr),"%s whispers to %s:%s",PlayerName(playerid),PlayerName(iPlayer),iText);
        
PlayerLoop(i)
}
    }
    else 
SendClientError(playerid"Player is too far away!");
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)