help , IsPlayerInRangeOfPoint
#1

Hi

i make this CMD

pawn Код:
CMD:test(playerid, params[])
{
    new hu;
    hu = CreateObject(2000, 1637.10046, -2241.53931, 12.49765,   0.00000, 0.00000, 0.00000);
    new Float:gx, Float:gy, Float:gz;
    GetPlayerPos(hu, gx, gy, gz);
    if(!IsPlayerInRangeOfPoint(playerid, 5.0, Float:gx, Float:gy, Float:gz)) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not near this Object.");
    {
        SendClientMessage(playerid, COLOR_YELLOWGREEN, "Good job.");
        return 1;
    }
}

But in Game i go at this object and jut get meage "You are not near this Object."
Reply
#2

pawn Код:
CMD:test(playerid, params[])
{
    new hu;
    hu = CreateObject(2000, 1637.10046, -2241.53931, 12.49765,   0.00000, 0.00000, 0.00000);
    new Float:gx, Float:gy, Float:gz;
    GetPlayerPos(hu, gx, gy, gz);
    if(IsPlayerInRangeOfPoint(playerid, 5.0, Float:gx, Float:gy, Float:gz))
    {
        SendClientMessage(playerid, COLOR_YELLOWGREEN, "Good job.");
    }
    else return return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not near this Object.");
    return 1;
}
Reply
#3

Quote:
Originally Posted by _Jake_
Посмотреть сообщение
pawn Код:
CMD:test(playerid, params[])
{
    new hu;
    hu = CreateObject(2000, 1637.10046, -2241.53931, 12.49765,   0.00000, 0.00000, 0.00000);
    new Float:gx, Float:gy, Float:gz;
    GetPlayerPos(hu, gx, gy, gz);
    if(IsPlayerInRangeOfPoint(playerid, 5.0, Float:gx, Float:gy, Float:gz))
    {
        SendClientMessage(playerid, COLOR_YELLOWGREEN, "Good job.");
    }
    else return return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not near this Object.");
    return 1;
}
No work
Reply
#4

ooppps forgot.

try to remove the float tags.

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, gx, gy, gz))
Reply
#5

Quote:
Originally Posted by _Jake_
Посмотреть сообщение
ooppps forgot.

try to remove the float tags.

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, gx, gy, gz))
http://postimg.org/image/rdlq8j9qr/

Why No work !! , please help me
Reply
#6

do you think i need Get Pos for this object ?
Reply
#7

Lol.....
pawn Код:
CMD:test(playerid, params[])
{
    new hu;
    hu = CreateObject(2000, 1637.10046, -2241.53931, 12.49765,   0.00000, 0.00000, 0.00000);
    new Float: x, Float: y, Float: z;
    GetObjectPos(hu, x, y, z);
    if(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
    {
        SendClientMessage(playerid, COLOR_YELLOWGREEN, "You're not near this object.");
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_YELLOWGREEN, "Good job.");
    }
    return 1;
}
There you go, simple fix.
Reply
#8

Код:
new Float: x, Float: y, Float: z;
    GetObjectPos(hu, x, y, z);
    if(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
This is such LOL code it will always be true since your seeing if your in range of where your players position is.

But if you don't make mistakes you'll never learn!
Reply
#9

Quote:
Originally Posted by zDivine
Посмотреть сообщение
Lol.....
pawn Код:
CMD:test(playerid, params[])
{
    new hu;
    hu = CreateObject(2000, 1637.10046, -2241.53931, 12.49765,   0.00000, 0.00000, 0.00000);
    new Float: x, Float: y, Float: z;
    GetObjectPos(hu, x, y, z);
    if(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
    {
        SendClientMessage(playerid, COLOR_YELLOWGREEN, "You're not near this object.");
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_YELLOWGREEN, "Good job.");
    }
    return 1;
}
There you go, simple fix.
Yo Yo !! Yeh man this is working , thank you very much
Reply
#10

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Код:
new Float: x, Float: y, Float: z;
    GetObjectPos(hu, x, y, z);
    if(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
This is such LOL code it will always be true since your seeing if your in range of where your players position is.

But if you don't make mistakes you'll never learn!
getOBJECTpos
..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)