Is player near object
#1

I making robbank system,and i can't make if player enter in laser object,server give him wanted.
I make this system from my head,im boring about scripting and i don't have idea where i mistake..
I want if player in laser server give him wanted,cordinate i set into the system.
This system set me the wanted level if i long from the laser,and i can walk into the laser but nothing happen...
Код:
forward Laser(playerid);
public Laser(playerid)
{
	if(PlayerInfo[playerid][Admin] < 1) return 1;
	{
	    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 3
		|| IsAFreecop(playerid)) return 1;
	    for(new i; i < MAX_PLAYERS; i++)
		{
		    if(!IsPlayerInRangeOfPoint(i, 1, 1434.4858,-994.5456,983.6454))
			{
		    	SetTimer("redzone", 1000, 0);
  				WantedPoints[i] = 2;
    			SetPlayerCriminalEx(i,255, "You have wanted,bacause you enter in block zone !");
			}
		}
	}
	return 1;
}
Also this system spamm me the message that i have wanted..
Reply
#2

Remove the exclamation mark '!' from the IsPlayerInRangeOfPoint.

! means: "not" so in your case it checks if the player is not in range of the object.
pawn Код:
if(IsPlayerInRangeOfPoint(i, 1, 1434.4858,-994.5456,983.6454))
Reply
#3

nice
Reply
#4

@Schneider i try to remove ! but if i remove system not work never -.-
because i put !
Reply
#5

A better way of doing this would be getting the actual objects position. Example:

pawn Код:
new Float: pos[3];
GetObjectPos(LazerObject, pos[0], pos[1], pos[2]);
if(IsPlayerInRangeOfPoint(playerid, 3.0, pos[0], pos[1], pos[2]);
Note that 1 is a VERY small radius, and you may want to increase it.
Reply
#6

Quote:
Originally Posted by Abagail
Посмотреть сообщение
A better way of doing this would be getting the actual objects position. Example:

pawn Код:
new Float: pos[3];
GetObjectPos(LazerObject, pos[0], pos[1], pos[2]);
if(IsPlayerInRangeOfPoint(playerid, 3.0, pos[0], pos[1], pos[2]);
Note that 1 is a VERY small radius, and you may want to increase it.
Can i put under 1 like in minus ?
I make someting like 1.0 radius but,again if player in object nothing happen,only happen is player 3 meters of object..
I think its 3 meters..
Reply
#7

I make like this but if player is not in object this work.
If player in object again nothing happen..

Код:
new Float:x,Float:y,Float:z;
		GetObjectPos(laserobject[playerid],x,y,z);
		for(new i; i < MAX_PLAYERS; i++)
		if(!IsPlayerInRangeOfPoint(i,-1.0,x,y,z))
Reply
#8

"!" means NOT and as far as I know a distance of -1 is not possible.
so if you write
if(!IsPlayerInRangeOfPoint(i,1.0,x,y,z))

It checks if the player is not in range of that point.
Try:
if(IsPlayerInRangeOfPoint(i,3.0,x,y,z))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)