vehicle speed not showing
#1

Alright so I have made a vradar but it does not display the speed of the vehicle in front and the model that it is, it does show the textdraws tho.

Код:
     new string[128], vehicleid;
     vehicleid = GetClosestVehicle(playerid, 20);
     TextDrawShowForPlayer(playerid, RadarHud);
     TextDrawShowForPlayer(playerid, RadarHud1);
     // Vehicle Speed
     new speed = GetVehicleSpeed(vehicleid, 20);
     format(string, sizeof(string), "Speed: %d KM/H", speed);
     TextDrawSetString(RadarHud2, string);
     TextDrawShowForPlayer(playerid, RadarHud2);
     // Vehicle Model
     new vehmd = GetVehicleModel(vehicleid);
     format(string, sizeof(string), "Vehicle: %s", RVN(vehmd));
     TextDrawSetString(RadarHud3, string);
     TextDrawShowForPlayer(playerid, RadarHud3);
Reply
#2

Код:
stock GetVehicleSpeed(vehicle) {
	if(IsVehicleSpawned(vehicle)) {
		new Float:X,
		    Float:Y,
		    Float:Z;

	    GetVehicleVelocity(vehicle, X, Y, Z);
		return floatround((floatsqroot(((X * X) + (Y * Y)) + (Z * Z)) * 100) * 1.6);
	}
	
	return 0;
}
Reply
#3

Where is that code placed?
Reply
#4

in a CMD:vradar
Reply
#5

Well, I think you have to place it in a repeatedly called timer to show correct speed because speed changes very frequently. Search for speedometer scripts and see how they're done internally, understand the basics and then fix your mistakes!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)