All pastes #758134 Raw Edit

Something

public text v1 · immutable
·published 2007-11-01 22:49 UTC
rendered paste body
new cRadar[MAX_PLAYERS];
//
//
//
//
//
cRadar[playerid] = 1;
//
//
//
//
//
//
	if(strcmp(cmd, "/radar", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
			if(gTeam[playerid] == 2 || IsACop(playerid))
			{
			    if(IsPlayerInAnyVehicle(playerid))
			    {
			        if(!IsACopCar(playerid))
					{
						if (cRadar[playerid] == 1)
 						{
							cRadar[playerid] = 2;
							GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~w~Radar ~g~on", 5000, 5);
							PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
						}
						else if (cRadar[playerid] == 2)
						{
							cRadar[playerid] = 1;
							GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~w~Radar ~r~off", 5000, 5);
							PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD2, "   You are not in a Police Vehicle !");
						return 1;
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "   You are not in a Car!");
				}
			}
   			else
			{
				SendClientMessage(playerid, COLOR_GREY, "   You are not a Cop / FBI!");
			}
		}
		return 1;
	}

//
//
//
//
//

	if(strcmp(cmd, "/checkspeed", true) ==0 || strcmp(cmd, "/cs", true) == 0)
	{
		if (cRadar[playerid] == 2)
   		{
  			if(IsPlayerConnected(playerid))
  			{
   				new suspect = GetClosestPlayer(playerid);
   				if(IsPlayerConnected(suspect))
   				{
   				    if(IsPlayerInAnyVehicle(playerid))
   				    {
						if(GetDistanceBetweenPlayers(playerid,suspect) < 100)
    					{
    				    	if(IsPlayerInAnyVehicle(suspect))
    				    	{
    				    		if(GetPlayerState(suspect) == 2)
		    					{
									GetPlayerPos(suspect, TelePos[suspect][3], TelePos[suspect][4], TelePos[suspect][5]);
									if(TelePos[suspect][5] > 550.0)
									{
										TelePos[suspect][0] = 0.0;
										TelePos[suspect][1] = 0.0;
									}
									if(TelePos[suspect][0] != 0.0)
									{
			    						new Float:xdist = TelePos[suspect][3]-TelePos[suspect][0];
										new Float:ydist = TelePos[suspect][4]-TelePos[suspect][1];
										new Float:sqxdist = xdist*xdist;
										new Float:sqydist = ydist*ydist;
										new Float:distance = (sqxdist+sqydist)/31;
       									GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
		        						format(string, 256, "Radar: [%d]%s %.0f mph",suspect,giveplayer,distance);
			    	    				SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
									}
								}
							}
							return 1;
						}
						else
						{
							SendClientMessage(playerid, COLOR_GREY, "   No one near you !");
							return 1;
						}
					}
				}
  			}
  			return 1;
		}
  		else
		{
  			SendClientMessage(playerid, COLOR_GREY, "   Turn the radar on /radar");
		}
 	}