SA-MP Forums Archive
Messages in range - 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: Messages in range (/showthread.php?tid=480476)



Messages in range - Wizzy951 - 10.12.2013

Well I know that nowadays ProxDetector is an outdated method to send messages in certain range. So I have a question and it is: what methods do you use to send those messages ?


Re: Messages in range - Lajko1 - 10.12.2013

Well for me ProxDetector is still the best..


Re: Messages in range - Wizzy951 - 10.12.2013

Quote:
Originally Posted by Lajko1
Посмотреть сообщение
Well for me ProxDetector is still the best..
According to other's mind - check this. Note this had been posted in 2011.


Re: Messages in range - Lajko1 - 10.12.2013

Well you can also make your own detect if player is near player that is speaking and send MSG to him :P sure with loops and IsPlayerInRangeOfPoint or w/e is that function - I saw this somewhere..


Re: Messages in range - Wizzy951 - 10.12.2013

Quote:
Originally Posted by Lajko1
Посмотреть сообщение
Well you can also make your own detect if player is near player that is speaking and send MSG to him :P sure with loops and IsPlayerInRangeOfPoint or w/e is that function - I saw this somewhere..
I would appreciate if you find it for me!


Re: Messages in range - Zamora - 10.12.2013

pawn Код:
Stock SendNearMessage(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new Float:ix, Float:iy, Float:iz;
    new Float:cx, Float:cy, Float:cz;
    foreach(Player, i)
    {
        if(IsPlayerLoggedIn{i})
        {
            if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
            {
                GetPlayerPos(i, ix, iy, iz);
                cx = (x - ix);
                cy = (y - iy);
                cz = (z - iz);
                if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
                {
                    SendClientMessage(i, col1, string);
                }
                else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
                {
                    SendClientMessage(i, col2, string);
                }
                else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
                {
                    SendClientMessage(i, col3, string);
                }
                else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
                {
                    SendClientMessage(i, col4, string);
                }
                else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
                {
                    SendClientMessage(i, col5, string);
                }
            }
        }
    }
    return 1;
}
pawn Код:
SendNearMessage(playerid, 15, string, COLOR_WHITE COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE);



Re: Messages in range - Wizzy951 - 11.12.2013

Quote:
Originally Posted by Zamora
Посмотреть сообщение
pawn Код:
Stock SendNearMessage(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new Float:ix, Float:iy, Float:iz;
    new Float:cx, Float:cy, Float:cz;
    foreach(Player, i)
    {
        if(IsPlayerLoggedIn{i})
        {
            if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
            {
                GetPlayerPos(i, ix, iy, iz);
                cx = (x - ix);
                cy = (y - iy);
                cz = (z - iz);
                if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
                {
                    SendClientMessage(i, col1, string);
                }
                else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
                {
                    SendClientMessage(i, col2, string);
                }
                else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
                {
                    SendClientMessage(i, col3, string);
                }
                else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
                {
                    SendClientMessage(i, col4, string);
                }
                else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
                {
                    SendClientMessage(i, col5, string);
                }
            }
        }
    }
    return 1;
}
pawn Код:
SendNearMessage(playerid, 15, string, COLOR_WHITE COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE);
Nice, but it gives me some errors.


Re: Messages in range - Zamora - 11.12.2013

Write me the errors..


Re: Messages in range - Wizzy951 - 11.12.2013

Quote:
Originally Posted by Zamora
Посмотреть сообщение
Write me the errors..
Well, I fixed them. Anyway thank you!