Radar gun, trying to display more than one result.
#1

pawn Код:
CMD:speed(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    new vehicles = 0, vehicid;
    if(Faction[playerid] != 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not a member of the police.");
    new string1[256], string2[512];
    for(new vehicleid =0; vehicleid<MAX_VEHICLES; vehicleid++)
    {
        new Float: vPosX, Float: vPosY, Float: vPosZ;
        GetVehiclePos(vehicleid, vPosX, vPosY, vPosZ);
        if(IsPlayerInRangeOfPoint(playerid, 50,vPosX, vPosY, vPosZ))
        {
            new Float: x, Float: y, Float: z;
            GetVehicleVelocity(vehicleid, x, y, z);
            if(floatround(floatsqroot(((x*x)+(y*y))+(z*z))*156.666667*0.641371192) > 0)
            {

                Vehicles[vehicleid][vid] = vehicleid;
                Vehicles[vehicleid][vmod] = GetVehicleModel(vehicleid) - 400;
                Vehicles[vehicleid][vspeed] = floatround(floatsqroot(((x*x)+(y*y))+(z*z))*156.666667*0.641371192);
                printf("1 vehicle");
                format(string1, sizeof(string1),""COL_WHITE"%s "COL_RED"%d MPH "COL_WHITE"("COL_GREEN"%s"COL_WHITE")", VehicleNames[Vehicles[vehicleid][vmod]],Vehicles[vehicid][vspeed], VehPlate[Vehicles[vehicid][vid]]);
                   
                /*else if(vehicles > 1)
                {
                    format(string2, sizeof(string2),"%s\nVEHICLE: "COL_GREEN"%s "COL_WHITE"SPEED: "COL_GREEN"%d MPH "COL_WHITE"LICENSE: "COL_GREEN"%s",string1, VehicleNames[Vehicles[vehicleid][vmod]],Vehicles[vehicled][vspeed], VehPlate[Vehicles[vehicleid][vid]]);
                    printf("format");
                }
                vehicles++;
                */

            }
        }
    }
        ShowPlayerDialog(playerid, DIALOG_SPEEDCHECK, DIALOG_STYLE_LIST, "VEHICLE SPEED RADAR", string1, "Close","");
    return 1;
}
I'm putting them into a list dialog, how would I get it to display more than one result, my commented areas are an attempt that didn't work.
Reply
#2

pawn Код:
format(string1, sizeof(string1),"%s"COL_WHITE"%s "COL_RED"%d MPH "COL_WHITE"("COL_GREEN"%s"COL_WHITE")\n",string1,VehicleNames[Vehicles[vehicleid][vmod]],Vehicles[vehicid][vspeed], VehPlate[Vehicles[vehicid][vid]]);
Remove string2.
Reply
#3

I didn't assume it was that simple, thank you.
Reply
#4

By the looks of it you're just using the command to display the speed of 'X' vehicles, but aren't you better off using something that calculates what the "Gun" is aiming at, then getting the Vehicles speed that way but its all upto you, just a suggestion.
Reply
#5

-Wrong post, I apologize-
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)