IsPlayerInRangeOfPoint
#1

I have create a speed radar but the script does not read when a car passes a cop.

Here is the script

Code:
forward SpeedVehicle();
public SpeedVehicle()
{
	foreach(Player, i)
	{
		if(GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsPlayerNPC(i))
		{
		    if(RadarON[i] == 1)
		    {
		        new Float:x1,Float:y1,Float:z1;
				GetPlayerPos(i,x1,y1,z1);
				new string[256];
			 	for(new o = 0; o<= MAX_PLAYERS; o++)
			  	{
			   		if(IsPlayerConnected(o))
			     	{
						if(o != i)// && !IsPlayerNPC(i))
						{
				     		if(IsACop(o) && IsPlayerInRangeOfPoint(o,30.0, x1,y1,z1))
				      		{
				      		    new Float:Viteza = GetVehicleSpeed_P(o);
								if(Viteza > 100 && GetPlayerState(o) == PLAYER_STATE_DRIVER)
								{
						            new Float:x2,Float:y2,Float:z2;
						            GetPlayerPos(o,x2,y2,z2);
						            SetPlayerCameraPos(o, x2,y2,z2);
						    		SetPlayerCameraLookAt(o, x1,y1,z1);
			        				TextDrawShowForPlayer(o,TextdrawRadar01);
								    TextDrawShowForPlayer(o,TextdrawRadar02);
								    TextDrawShowForPlayer(o,TextdrawRadar03);
								    TextDrawShowForPlayer(o,TextdrawRadar04);
								    format(string, sizeof(string), " Radar: %s driving with %f KPH", GetPlayerNameEx(o), Viteza);
		      			 			SendClientMessage(i, COLOR_YELLOW, string);
		      			 			format(string, sizeof(string), "You were caught by %s with %f KPH",GetPlayerNameEx(i),Viteza);
		      			 			SendClientMessage(o, COLOR_LIGHTRED, string);
		      			 			SetTimerEx("DestroyRadar", 500, false, "i", o);
								}
							}
						}
			   		}
				}
		    }
	    }
	 }
	return 1;
 }
forward DestroyRadar(playerid);
public DestroyRadar(playerid)
{
    if(IsPlayerConnected(playerid))
   	{
	    TextDrawHideForPlayer(playerid, Text:TextdrawRadar01);
	    TextDrawHideForPlayer(playerid, Text:TextdrawRadar02);
	    TextDrawHideForPlayer(playerid, Text:TextdrawRadar03);
	    TextDrawHideForPlayer(playerid, Text:TextdrawRadar04);
	    SetCameraBehindPlayer(playerid);
	}
	return 1;
}
Code:
if (strcmp(cmd, "/radar", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(RadarON[playerid] == 1)
			{
			    format(string, sizeof(string), "%s dropped the radar", GetPlayerNameEx(playerid));
				SendRadioMessage(1, COLOR_DBLUE, string);
			    RadarON[playerid] = 0;
			    return 1;
			}
            if(PlayerInfo[playerid][pLider] != 1 && PlayerInfo[playerid][pMembru] != 1)
            {
                SendClientMessage(playerid, COLOR_WHITE, "You are not a cop!");
				return 1;
            }
            if(!IsACopCar(GetPlayerVehicleID(playerid)))
            {
				SendClientMessage(playerid, COLOR_WHITE, "You are not in a police car!");
				return 1;
            }
            if(OnDuty[playerid] != 1)
			{
			    SendClientMessage(playerid, COLOR_LIGHTGREEN, "You are not on duty!");
			    return 1;
			}
			RadarON[playerid] = 1;
		 	format(string, sizeof(string), "** %s is on the prowl with radar **", GetPlayerNameEx(playerid));
			SendRadioMessage(1, COLOR_DBLUE, string);
			return 1;
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)