SA-MP Forums Archive
Looking for Prox Detector - 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)
+--- Thread: Looking for Prox Detector (/showthread.php?tid=282343)



Looking for Prox Detector - DDodo - 10.09.2011

I'm looking for a nice prox detector for commands like /me /do /shout .. etc


Re: Looking for Prox Detector - AustinJ - 10.09.2011

Here is mine that I use in my custom gamemode. Change the PlayerInfo[playerid][Logged] to what ever you use to check if the player is connected. Other then that here it is.
pawn Код:
stock SendRangedMessage(sourceid, color, message[], Float:range)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(sourceid, x, y, z);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][Logged] == 1)
        {
            if(GetPlayerVirtualWorld(sourceid) == GetPlayerVirtualWorld(i))
            {
                if(IsPlayerInRangeOfPoint(i, range, x, y, z))
                {
                    SendClientMessage(i, color, message);
                }
            }
        }
    }
    return 1;
}
EDIT: Mine detects if the player is in the same world and if they are logged also.


Re: Looking for Prox Detector - Max_Coldheart - 10.09.2011

pawn Код:
stock SendLocalChat(playerid,color,msg[],Float:radius)
{
  new Float:x,Float:y,Float:z;
  GetPlayerPos(playerid,x,y,z);
  for(new ply;ply<MAX_PLAYERS;ply++)
  {
    if(IsPlayerInRangeOfPoint(ply,radius,x,y,z))SendClientMessage(ply,color,msg);
  }
  return 1;
}
An method made by Joe Staff.

Have a nice day !


Re: Looking for Prox Detector - DDodo - 10.09.2011

I was referring to a prox detector that has different shades of a color depending on how far away the receiver is, thanks for help though


Re: Looking for Prox Detector - =WoR=Varth - 10.09.2011

Or use Smart Chat.


Re: Looking for Prox Detector - Jafet_Macario - 10.09.2011

pawn Код:
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
                {
                    if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                    {
                        SendClientMessage(i, col1, string);
                    }
                    else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                    {
                        SendClientMessage(i, col2, string);
                    }
                    else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                    {
                        SendClientMessage(i, col3, string);
                    }
                    else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                    {
                        SendClientMessage(i, col4, string);
                    }
                    else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                    {
                        SendClientMessage(i, col5, string);
                    }
                }
            }
        }
    }
    return 1;
}