SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/09/2011, 05:10 PM   #1
DDodo
Little Clucker
 
Join Date: Feb 2010
Location: Romania
Posts: 20
Reputation: 3
Default Looking for Prox Detector

I'm looking for a nice prox detector for commands like /me /do /shout .. etc
__________________
If my post was helpful, please redirect your attention to the little star button
DDodo is offline   Reply With Quote
Old 10/09/2011, 05:14 PM   #2
AustinJ
Big Clucker
 
Join Date: Jul 2011
Location: Wisconsin
Posts: 146
Reputation: 15
Default Re: Looking for Prox Detector

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 Code:
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.
__________________
AustinJ is offline   Reply With Quote
Old 10/09/2011, 05:16 PM   #3
Max_Coldheart
Guest
 
Posts: n/a
Default Re: Looking for Prox Detector

pawn Code:
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 !
  Reply With Quote
Old 10/09/2011, 05:23 PM   #4
DDodo
Little Clucker
 
Join Date: Feb 2010
Location: Romania
Posts: 20
Reputation: 3
Default Re: Looking for Prox Detector

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
__________________
If my post was helpful, please redirect your attention to the little star button
DDodo is offline   Reply With Quote
Old 10/09/2011, 05:24 PM   #5
=WoR=Varth
High-roller
 
=WoR=Varth's Avatar
 
Join Date: Apr 2011
Location: Indonesia
Posts: 2,076
Reputation: 127
Default Re: Looking for Prox Detector

Or use Smart Chat.
__________________
Looking for scripter? PM me (NOPE RETIRED)
=WoR=Varth is offline   Reply With Quote
Old 10/09/2011, 05:24 PM   #6
Jafet_Macario
Huge Clucker
 
Jafet_Macario's Avatar
 
Join Date: Jul 2011
Posts: 472
Reputation: 60
Default Re: Looking for Prox Detector

pawn Code:
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;
}
__________________
Jafet_Macario is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
afk system si un prox detector bogdan123 Română/Romanian 4 18/03/2011 10:50 AM
[Map] Army Ship By [ProX]BlueFire [ProX]BlueFire Maps 7 07/03/2011 05:44 AM
Does this work same as prox detector? Torran Help Archive 3 25/02/2010 02:36 PM
Prox Detector SlashPT Help Archive 3 22/01/2010 08:12 PM


All times are GMT. The time now is 03:36 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.