SA-MP Forums Archive
need help plz IsPlayerInRangeOfPoint not work - 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: need help plz IsPlayerInRangeOfPoint not work (/showthread.php?tid=527014)



need help plz IsPlayerInRangeOfPoint not work - edwardluciano - 20.07.2014

First used
pawn Код:
if(strcmp(cmd, "/createt", true) == 0)
        {
            new Float:editor[3];
            GetPlayerPos(playerid,editor[0],editor[1],editor[2]);
            CreateDynamicObject(3383, editor[0]+1, editor[1]-3, editor[2]-1, 0.0,0.0,0.0, -1, -1, -1, 100.0); //object(a51_labtable1_) (1)

            CreateDynamicObject(2891, editor[0]+1, editor[1]-2.5, editor[2], 0.0,0.0,0.0, -1, -1, -1, 100.0);//object(kmb_packet) (1)
            CreateDynamicObject(2891, editor[0]+1.2, editor[1]-2.5, editor[2], 0.0,0.0,0.0, -1, -1, -1, 100.0);//object(kmb_packet) (1)
            CreateDynamicObject(2891, editor[0]+1.1, editor[1]-2.5, editor[2]+0.2, 0.0,0.0,0.0, -1, -1, -1, 100.0);//object(kmb_packet) (1)

            CreateDynamicObject(2901, editor[0], editor[1]-3, editor[2]+0.3, 0.0,0.0,0.0, -1, -1, -1, 100.0);//object(kmb_marijuana) (1)

        }
For create table follow picture



And after use

pawn Код:
if(strcmp(cmd, "/makedrugs", true) == 0)
        {
            new Float:editor[3];
            GetObjectPos(3383, editor[0], editor[1], editor[2]);
            if(IsPlayerInRangeOfPoint(playerid, 7.0, editor[0], editor[1], editor[2]))
            {
                SendClientMessage(playerid, COLOR_RED,"ok"COL_WHITE": you near table");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED,"error"COL_WHITE": you aren't near table");
                return 1;
            }
        }
For make drug but notwork




Re: need help plz IsPlayerInRangeOfPoint not work - biker122 - 20.07.2014

You've made the distance so long..
pawn Код:
if(strcmp(cmd, "/makedrugs", true) == 0)
{
new Float:editor[3];
GetObjectPos(3383, editor[0], editor[1], editor[2]);
if(IsPlayerInRangeOfPoint(playerid, 0.5, editor[0], editor[1], editor[2]))
{
SendClientMessage(playerid, COLOR_RED,"ok"COL_WHITE": you near table");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED,"error"COL_WHITE": you aren't near table");
return 1;
}
}
Try this?


Re: need help plz IsPlayerInRangeOfPoint not work - edwardluciano - 20.07.2014

Quote:
Originally Posted by biker122
Посмотреть сообщение
You've made the distance so long..
pawn Код:
if(strcmp(cmd, "/makedrugs", true) == 0)
{
new Float:editor[3];
GetObjectPos(3383, editor[0], editor[1], editor[2]);
if(IsPlayerInRangeOfPoint(playerid, 0.5, editor[0], editor[1], editor[2]))
{
SendClientMessage(playerid, COLOR_RED,"ok"COL_WHITE": you near table");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED,"error"COL_WHITE": you aren't near table");
return 1;
}
}
Try this?
not work (T^T )


Re: need help plz IsPlayerInRangeOfPoint not work - Metharon - 20.07.2014

pawn Код:
if(strcmp(cmd, "/createt", true) == 0)
{
    new Float:editor[3];
    GetPlayerPos(playerid,editor[0],editor[1],editor[2]);
    CreateDynamicObject(3383, editor[0]+1, editor[1]-3, editor[2]-1, 0.0,0.0,0.0, -1, -1, -1, 100.0); //object(a51_labtable1_) (1)
    CreateDynamicObject(2891, editor[0]+1, editor[1]-2.5, editor[2], 0.0,0.0,0.0, -1, -1, -1, 100.0);//object(kmb_packet) (1)
    CreateDynamicObject(2891, editor[0]+1.2, editor[1]-2.5, editor[2], 0.0,0.0,0.0, -1, -1, -1, 100.0);//object(kmb_packet) (1)
    CreateDynamicObject(2891, editor[0]+1.1, editor[1]-2.5, editor[2]+0.2, 0.0,0.0,0.0, -1, -1, -1, 100.0);//object(kmb_packet) (1)
    CreateDynamicObject(2901, editor[0], editor[1]-3, editor[2]+0.3, 0.0,0.0,0.0, -1, -1, -1, 100.0);//object(kmb_marijuana) (1)
    return 1;  
}


if(strcmp(cmd, "/makedrugs", true) == 0)
{
    new Float:editor[3];
    GetObjectPos(3383, editor[0], editor[1], editor[2]);
    if(IsPlayerInRangeOfPoint(playerid, 2, editor[0], editor[1], editor[2]))
    {
        SendClientMessage(playerid, COLOR_RED,"uhh , metharon is sexy");
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED,"Oh , em geh , how you can't +1 him ?");
        return 1;
    }
    return 1;
}



Re: need help plz IsPlayerInRangeOfPoint not work - Mauzen - 20.07.2014

editor[] in both cases is a local variable. Local variables wont keep their value.
After you use
new Float:editor[3];
All the values are 0.0 again.

In order to get this to work, you need to use global variables. Check the wiki or tutorials here if you dont know how to do that, i wont explain it here.


Re: need help plz IsPlayerInRangeOfPoint not work - edwardluciano - 20.07.2014

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
editor[] in both cases is a local variable. Local variables wont keep their value.
After you use
new Float:editor[3];
All the values are 0.0 again.

In order to get this to work, you need to use global variables. Check the wiki or tutorials here if you dont know how to do that, i wont explain it here.
i will try it thank you