How to check if player is near object
#1

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

IsPlayerInRangeOfPoint use that function, you have it on wiki samp
Reply
#3

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

GetObjectPos
Reply
#5

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

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

lol you need coordinates

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
Reply
#8

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

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

I will try when i get home

Thanks for ur help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)