SA-MP Forums Archive
[Include] SendClientMessage Tools - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] SendClientMessage Tools (/showthread.php?tid=519729)



SendClientMessage Tools - superrobot48 - 15.06.2014

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


AW: SendClientMessage Tools - xerox8521 - 15.06.2014

Whats wrong with IsPlayerInRangeOfPoint ?


Re: SendClientMessage Tools - rockhopper - 16.06.2014

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


Re : SendClientMessage Tools - S4t3K - 16.06.2014

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.


Re: SendClientMessage Tools - superrobot48 - 20.06.2014

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


Re : SendClientMessage Tools - S4t3K - 20.06.2014

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.


Re: SendClientMessage Tools - superrobot48 - 20.06.2014

omg forgot that thanks


Re: SendClientMessage Tools - iRaiDeN - 20.06.2014

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


Re: SendClientMessage Tools - SickAttack - 20.06.2014

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


Re: SendClientMessage Tools - iFarbod - 20.06.2014

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