Is player near object -
bigboy81 - 19.01.2015
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..
Re: Is player near object -
Schneider - 19.01.2015
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))
Re: Is player near object -
Ozer2635 - 19.01.2015
nice
Re: Is player near object -
bigboy81 - 19.01.2015
@Schneider i try to remove ! but if i remove system not work never -.-
because i put !
Re: Is player near object -
Abagail - 19.01.2015
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.
Re: Is player near object -
bigboy81 - 20.01.2015
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..
Re: Is player near object -
bigboy81 - 20.01.2015
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))
Re: Is player near object -
Schneider - 20.01.2015
"!" 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))