[HELP] Proxdetector doesn't work
#1

Hello I made proxdetector when someone player write on /b chat for example

/b hello

and when another player stand little further from that player he see that text in gray coolor ok that work but I noticed this I spawn on my house on vinewood and another player was on ls airport and I write on /b hello and he saw that text but he was on ls airoport far far away from me what's the problem?


pawn Код:
stock ProxDetectorElse(Float:radi,playerid,string[],color,elsecolor)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    foreach(Player,i)
    {
        if(!IsPlayerConnected(i))continue;
        if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
        {
            SendClientMessage(i,color,string);
        }
        else
        {
            SendClientMessage(i,elsecolor,string);
        }
    }
}
Reply
#2

Wait were you IN your house? in a interiour I mean...
How are you using this function?
example how I would do it:
pawn Код:
public OnPlayerText(playerid, text[])
{
    new message[257];
    format(message, sizeof(message), "%s says: %s", PlayerName(playerid), text);
    ProxDetector(20.0, playerid, message, COLOR_GREY);
    return 1;
}
stock ProxDetector(Float:radi, playerid, string[],color)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    foreach(Player,i)
    {
        if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
        {
            SendClientMessage(i,color,string);
        }
    }
}
stock PlayerName(playerid)
{
    new ppName[24];
    GetPlayerName(playerid, ppName, 24);
    return ppName;
}
Reply
#3

yes I use in the same way like this from your post and I was in interior and outside and still I write on b hello he saw that text on ls airport


edit I use like this

pawn Код:
GetPlayerName(playerid,sendername,sizeof(sendername));
        format(string,sizeof(string),"%s Kaze: %s",sendername,text);
        ProxDetectorElse(5.0,playerid,string,WHITE,COLOR_GRAY);
color white is if player is too close to player who write something on /b and see that text in white color color_gray is if player a little further from thatt player who write and see that text in the gray color that work's but the problem with that decetor is like I said I was on vinewood and another player was on airport and he see what I was write on /b cchat
Reply
#4

Then I guess you need to check if the player is in a interiour or not so hmm...
just try something like
pawn Код:
if(GetPlayerInterior(playerid) == 0)//0 is outside
{
    //then your OnPlayerText code
    GetPlayerName(playerid,sendername,sizeof(sendername));        
    format(string,sizeof(string),"%s Kaze: %s",sendername,text);      
    ProxDetectorElse(5.0,playerid,string,WHITE,COLOR_GRAY);
}
else
{
    //code if you are in a real interior since 0 is outside
}
Reply
#5

it doens't matter there still is the problem something is wrong with that proxdetector
Reply
#6

Have you tried the original un edited prox detector I gave you in my first post, see if the porblem is still there but if not then its your
pawn Код:
else        
{            
    SendClientMessage(i,elsecolor,string);        
}
Reply
#7

I don't want this that is not what I want it only show to near player in white color or it just one color I want if another player is further from player who is on mobile or /b then he ssaw text in yellow white color not white.That everything is working with proxdetector which I show in my first post but the probblem is just when someone type something on /b and if another player in another part of city he saw that text how to fix that it must be mistake in getting player pos in that proxdetector or something like that. Thanks
Reply
#8

Sorry then I don't know how to help you :/ Good luck though.
Reply
#9

Thanks anyway and thanks for trying to help me .

Anyone else? Thanks
Reply
#10

From my understanding, your current code says:
If Player B is near Player A, send them a message in color
else send Player B a message in elsecolor.

Add "else if" statements, so if Player B is within 10 metres, he gets color else if he is in 20 metres he will see elseif color. If they aren't within either area they will see nothing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)