Police Radar
#1

Does Anyone Have A Radar Command That Would Allow The Police To Tell How Fast The Vehicles Are Going Around Them.
Reply
#2

You could do something like that pretty simple.
There are obviously more sophisticated ways.

ClosestPlayerVehicleSpeed

playerid,
Floatpeed returns speed,
otherplayer(optional) if you want to specify a player

returns player that it got speed for or -1 for no player

pawn Код:
stock ClosestPlayerVehicleSpeed(playerid, &Float:speed, otherplayer=-1)
{
  new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    new closest = -1, Float:dist = 200.0;
    if(closest == otherplayer)
    {
      for(new pid=0; pid<GetMaxPlayers(); pid++)
      {
            if(!IsPlayerConnected(pid) || GetPlayerState != PLAYER_STATE_DRIVER || !IsPlayerInRangeOfPoint(pid,dist-1.0, X, Y, Z) || pid == playerid) continue;
            //here we know we have someone closer
            closese = pid;
            new Float:pX, Float:Py, Float:Pz;
            GetPlayerPos(pid, pX, Py, Pz);
            distance = floatsqroot(floatpower(floatabs(pX-X),2)+floatpower(floatabs(pY-Y),2)+floatpower(floatabs(pZ-z),2));
      }
    }else if(IsPlayerConnected(pid) && GetPlayerState == PLAYER_STATE_DRIVER && IsPlayerInRangeOfPoint(otherplayer, dist, X, Y, Z) closest = otherplayer;
    speed = GetVehicleVelocity(GetPlayerVehicleID(closest));
    return closest;
}
Reply
#3

How i can use this stock in my comand to show cops the speed...?

This is my command:

if(strcmp(cmd, "/radar", true) ==0 )
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
{
if(OnDuty[playerid] == 1)
{

}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not working!");
return 1;
}

}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)