Problem whit ProxDetector
#1

I have problem whit this proxdetector someone know how to fix it?

here some command

Код:
if(strcmp(cmd, "/pheal", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Koristete: /pheal [ID/Ime na Igrac] ");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4)
			{
				if (ProxDetectorS(5.0, playerid, giveplayerid))
				{
                    if(IsPlayerConnected(playa))
			        {
			            if(playa != INVALID_PLAYER_ID)
			            {
                            ApplyAnimation(playerid,"MEDIC","CPR",4.0,0,0,0,0,0);
                            ApplyAnimation(playerid,"MEDIC","CPR",4.0,0,0,0,0,0);
						    SetPlayerHealth(playa, 100);
						    GivePlayerMoney(playa, -100);
					 	    SendClientMessage(playa, COLOR_GRAD1, " Vi dadov lek sega moze da stanete");
					    }
				    }
				 }
			     else
				 {
					SendClientMessage(playerid, COLOR_GRAD1, "  player is to far away.");
				 }
		    }
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   Ne ste doktor!");
			}
		}
		return 1;
	}
some time command work some time tell me player is to far away but he is not he is face to face whit me


have same problem whit other command...

any command work like /pay or something else and some command dosnt work
someone know how to fix this
?
Reply
#2

Use IsPlayerInRangeOfPoint instead of ProxDetector. I think ProxDetector is to send messages to nearby players like /b, IC chats etc.. So first get the player X,Y,Z and use IsPlayerInRangeOfPoint(id,px,py,pz);
Reply
#3

as same as admantis if theres no solution and u want this to work. use isplayerinrangeofpoint or make an own function like: IsPlayerNearPlayer but ProxDetector is used for messages just like admantis said but ProxDetectorS is used to check the range between two players: range = 5 check if: playerid is less then 5 meters away from giveplayerid.
Reply
#4

fixed

new Float, Float:y, Float:z;
GetPlayerPos(giveplayerid,x,y,z);


if(!IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
{
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)