SA-MP Forums Archive
How to check if player is near object - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to check if player is near object (/showthread.php?tid=253299)



How to check if player is near object - BizzyD - 05.05.2011

Hello, I got a question. How do i check how near someone is a object. Because i wanna make a cook command. And they need to make a fire first. But how do i check if they are near the fire?


Re: How to check if player is near object - System64 - 05.05.2011

IsPlayerInRangeOfPoint use that function, you have it on wiki samp


Re: How to check if player is near object - BizzyD - 05.05.2011

I already tried that, I made it like this:

Код:
if(IsPlayerInRangeOfPoint(playerid, 2.0, fire[playerid]))
And i get this warnings:
Код:
warning 202: number of arguments does not match definition
Код:
warning 202: number of arguments does not match definition
Then i tried like this:

Код:
if(IsPlayerInRangeOfPoint(playerid, 2.0, fire))
Then i get this error:
Код:
error 035: argument type mismatch (argument 3)



Re: How to check if player is near object - Vince - 05.05.2011

GetObjectPos


Re: How to check if player is near object - BizzyD - 05.05.2011

Quote:
Originally Posted by Vince
Посмотреть сообщение
GetObjectPos
Код:
GetObjectPos(fire[playerid],x,y,z);
But what should i do next lol.


Re: How to check if player is near object - DRIFT_HUNTER - 05.05.2011

pawn Код:
new Float:X,Float:Y,Float:Z;
GetObjectPos(fire,X,Y,Z);
if(IsPlayerInRangeOfPoint(playerid, 2.0,X,Y,Z)
{
//bla bla bla....
}
replace fire with fire object id (NOT MODEL !)


Re: How to check if player is near object - System64 - 05.05.2011

lol you need coordinates

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint


Re: How to check if player is near object - alpha500delta - 05.05.2011

Quote:
Originally Posted by System64
Посмотреть сообщение
Ofcourse he does, he was just making an example -_-


Re: How to check if player is near object - System64 - 06.05.2011

Quote:
Originally Posted by alpha500delta
Посмотреть сообщение
Ofcourse he does, he was just making an example -_-
haha xD i'm noob, try with PlayerToPoint


Re: How to check if player is near object - BizzyD - 06.05.2011

I will try when i get home

Thanks for ur help