SA-MP Forums Archive
help , IsPlayerInRangeOfPoint - 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: help , IsPlayerInRangeOfPoint (/showthread.php?tid=431607)



help , IsPlayerInRangeOfPoint - morocco - 19.04.2013

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."


Re: help , IsPlayerInRangeOfPoint - JaKe Elite - 19.04.2013

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;
}



Re : Re: help , IsPlayerInRangeOfPoint - morocco - 19.04.2013

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


Re: help , IsPlayerInRangeOfPoint - JaKe Elite - 19.04.2013

ooppps forgot.

try to remove the float tags.

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



Re : Re: help , IsPlayerInRangeOfPoint - morocco - 19.04.2013

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


Re : help , IsPlayerInRangeOfPoint - morocco - 19.04.2013

do you think i need Get Pos for this object ?


Re: help , IsPlayerInRangeOfPoint - zDivine - 19.04.2013

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.


Re: help , IsPlayerInRangeOfPoint - Pottus - 19.04.2013

Код:
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!


Re : Re: help , IsPlayerInRangeOfPoint - morocco - 19.04.2013

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


Re: help , IsPlayerInRangeOfPoint - mastermax7777 - 19.04.2013

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
..