Posts: 248
Threads: 40
Joined: Feb 2015
how could I do like, I have an object (box) and wanted when the player was on top of her, pressing the button "Y / Yes" show player dialag, if you were not on top of this object, do not open this dialag.
Could someone help me? function in samp wiki?
Posts: 248
Threads: 40
Joined: Feb 2015
I have a box, I want when I'm near this box and press the button "y" to open a dialog, if I'm not near of this box, the dialog will not open.
Posts: 1,733
Threads: 20
Joined: Nov 2010
Reputation:
0
If your box would be 2x2x2 meters in size, and the box is at coordinates 10, 15, 3 (x, y, z), you could check if the player is in range of the center of the box (10, 15) and 1 meter higher than the position of the box (this would be the top-plane of the box).
For this given box, you check if the player is in range of 10, 15, 4 with a small range (1m for this box since it's only 1 meter from box-center to a side of the box).
So the player must be on top of the box for the range-check to trigger.
It could still fail if the player is standing at the corner of the box, since a corner is 1.41m from the center.
You could still use a range of 1.41m to include the corners of the box.
Posts: 248
Threads: 40
Joined: Feb 2015
Quote:
Originally Posted by PowerPC603
If your box would be 2x2x2 meters in size, and the box is at coordinates 10, 15, 3 (x, y, z), you could check if the player is in range of the center of the box (10, 15) and 1 meter higher than the position of the box (this would be the top-plane of the box).
For this given box, you check if the player is in range of 10, 15, 4 with a small range (1m for this box since it's only 1 meter from box-center to a side of the box).
So the player must be on top of the box for the range-check to trigger.
It could still fail if the player is standing at the corner of the box, since a corner is 1.41m from the center.
You could still use a range of 1.41m to include the corners of the box.
|
I know more what I want to know the function to check if the player is close to her.
Thanks for the tutorial.
Posts: 248
Threads: 40
Joined: Feb 2015
Quote:
Originally Posted by BleverCastard
That's a good thing actually. I'm glad not much people are just handing code to people!
|
Lol, I'm saying that I want the name of the function that checks if the player is near of any object. Do not you understand? I want the function name "link samp wiki". do not be posting what you want why not this your home.
Posts: 248
Threads: 40
Joined: Feb 2015
Thanks powerpc, +rep, but i trying it:
pawn Код:
else if(newkeys == KEY_FIRE){
if(IsPlayerInRangeOfPoint(playerid, 2.4, 1343.5695,-210.2208,14.1484))
{
new str[86];
format(str, sizeof(str), "AirDrop","{ffffff}Med Kit\n{ffffff}Binoculars\n{ffffff}Bandage\n{0000FF}AK-47\n{0000FF}M4\n{fff700}Map\n{ff0000}Water Bootle");
ShowPlayerDialog(playerid, DialogBoxEx, DIALOG_STYLE_MSGBOX, "Supply Drop", str, "Ok", "Ok");
}
return 1;
}
i set currently pos, i press the key fire and not show the dialog, anyone can help?