Radar Command Sending Wrong Message
#1

pawn Код:
CMD:radar(playerid, params[])
{
    if(IsPlayerPolice(playerid))
    {
        new v, Float: x, Float: y, Float: z;

        while(++v < MAX_VEHICLES)
        {
            if(GetVehiclePos(v, x, y, z) && IsPlayerInRangeOfPoint(playerid, 30.0, x, y, z))
            {

                if(v != 0)
                {
                    if(v == GetPlayerVehicleID(playerid)) continue;
                    new Float:speed_x, Float:speed_y, Float:speed_z, Float:final_speed, final_speed_int;
                    new str[64];

                    GetVehicleVelocity(v,speed_x,speed_y,speed_z);
                    final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*90;
                    final_speed_int = floatround(final_speed,floatround_round);

                    if(final_speed_int > 0)
                    {
                        format(str, sizeof(str), "(RADAR) %s: %i mph", GetVehicleName(v), final_speed_int);
                        SendClientMessage(playerid, COLOR_YELLOW, str);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_YELLOW, "(RADAR) No vehicles in range.");
                        print("final_speed_int > 0");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "(RADAR) No vehicles in range.");
                }
            }
        }
    }
    return 1;
}
This command is detecting the right amount of cars in the given radius, but it sends the "No vehicles in range" string under "if(final_speed_int > 0)" instead of the message that shows their speed. What did I do wrong?
Reply


Messages In This Thread
Radar Command Sending Wrong Message - by austin070 - 01.09.2014, 04:48
Re: Radar Command Sending Wrong Message - by SickAttack - 01.09.2014, 04:59
Re: Radar Command Sending Wrong Message - by austin070 - 01.09.2014, 05:01
Re: Radar Command Sending Wrong Message - by SickAttack - 01.09.2014, 05:21

Forum Jump:


Users browsing this thread: 2 Guest(s)