[Include] SendClientMessage Tools
#1

Hi guys this is an include which contains some SendClientMessage functions to make work simple

Functions are :
GetDistanceBetweenPlayers(playerid1,playerid2)
This function is used to get players in a distance
pawn Код:
SCM(playerid,color,message);
This is a simplified version of SendClientMessage, the format's the same
eg,
pawn Код:
SCM(playerid,-1,"Hi);
************************************************** ************************
SCMToTeam(teamid,color,message);

This is a function to Send Messages to all player in a team.
eg,
pawn Код:
SCMToTeam(TEAM_COP,-1,"[COP RADIO] ALL COPS THIS IS A TEST"); // the team_cop can even be a integer
************************************************** *************************
SCMToNearbyPlayers(playerid,color,message[],distance)

This function is to Send Your message to the people you nearby in a specified distance.

eg,
pawn Код:
SCMToNearbyPlayersOfPlayer(playerid,-1,"lol",4);
where playerid is the person who is the Producer of the text, the people near the playerid will get the message
and distance is the range of voice
************************************************** ******************************

Code:
pawn Код:
#if defined _SCM_included
    #endinput
#endif
/*Made by superrobot48
any one can use this , edit this but DONT EVEN THINK ABOUT RELEASING IT IN YOUR NAME */


#define SCM SendClientMessage
#define SCMToAll SendClientMessageToAll

stock Float:GetDistanceBetweenPlayers(p1,p2){
        new Float:x1,Float:y1,Float:z1,Float:x3,Float:y3,Float:z3;
        if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2)){
                return -1.00;
        }
        GetPlayerPos(p1,x1,y1,z1);
        GetPlayerPos(p2,x3,y3,z3);
        return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2)+floatpower(floatabs(floatsub(y3,y1)),2)+floatpower(floatabs(floatsub(z3,z1)),2));
}

stock SCMToTeam(teamid,COLOR,message[])
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
     if(IsPlayerConnected(i))
     {
        if(GetPlayerTeam(i) == teamid)
        {
            SendClientMessage(i,COLOR,message);
        }
      }
    }
    return 1;
}

stock SCMToNearbyPlayersOfPlayer(playerid,color,message[],Float:distance)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetDistanceBetweenPlayers(i,playerid) < distance)
            {
                SCM(i,color,message);
            }
        }
    }
}
Download : http://www.mediafire.com/view/nclt61ypmq9tddt/SCM.inc
Reply
#2

Whats wrong with IsPlayerInRangeOfPoint ?
Reply
#3

Nice you just made it short EVEN though Good for lazy scriptors
Reply
#4

Actually, you could have used y_va to create "SendClientMessageFormatted", which will allow a scripter to put the format parameters directly in argument of the function.

Btw, I think "SendClientMessageToNearbyPlayers" already exists under the name of "ProxDetector".

Anyway, it's the motivation which counts, and it's nice to have thought about this.
Reply
#5

Thanks guys
btw is ProxDetector in a_samp ? O.o or as default ?
Reply
#6

You must create a "ProxDetector" function.
But your SendClientMessageToNearbyPlayers's function's common name is "ProxDetector".
And if I can add something (still about this function), the "distance" is usually a float.
Reply
#7

omg forgot that thanks
Reply
#8

Very very useless, everyone can do this include also the programer can do it without this include or another.
Reply
#9

I agree with iRaiDeN, you can create this include in about 30 seconds. Not so useful.
Reply
#10

pawn Код:
#define SCM SendClientMessage
#define SCMALL SendClientMessageToAll
Just in 2 lines.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)