need help plz IsPlayerInRangeOfPoint not work
#1

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

Reply
#2

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?
Reply
#3

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 )
Reply
#4

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;
}
Reply
#5

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.
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)