SA-MP Forums Archive
Speedo Fuel Health. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Speedo Fuel Health. (/showthread.php?tid=493051)



Speedo Fuel Health. - Yves - 06.02.2014

Hello i have made a textdraw for fuel speed health etc, i cannot get it in the right spot i put ~n~ witch means new line but still won't get in that area were i want it.

Код:
public Speedometer()
{
	new vehicleid, Float:health;
	new engine, lights, alarm, doors, bonnet, boot, objective;
	new fstring[32], string[512];

	for(new i=0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
		{
			vehicleid = GetPlayerVehicleID(i);
			GetVehicleHealth(vehicleid, health);
			GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);

			// Speedo.
			strcat(string, "~b~", sizeof(string));
			if(GetPVarInt(i, "Speedo")) format(fstring,sizeof(fstring),"mph: ~w~%d", GetPlayerSpeed(i, false));
			else format(fstring,sizeof(fstring),"kph: ~w~%d", GetPlayerSpeed(i, true));
			strcat(string, fstring, sizeof(string));

			// Fuel
			strcat(string, "~b~fuel: ~g~", sizeof(string));
			fstring = "iiiiiiiiii";
			if(Fuel[vehicleid] > 100.0) strins(fstring, "~r~", 10, sizeof(fstring));
			else if(Fuel[vehicleid] < 0.0) strins(fstring, "~r~", 0, sizeof(fstring));
			else strins(fstring, "~r~", floatround(Fuel[vehicleid]/10.0), sizeof(fstring));
			strcat(string, fstring, sizeof(string));

			// Health
			strcat(string, "~n~~n~~n~~n~~b~ ~g~", sizeof(string));
			fstring = "iiiiiiiiii";
			if(health > 1000.0) strins(fstring, "~r~", 10, sizeof(fstring));
			else if(health < 0.0) strins(fstring, "~r~", 0, sizeof(fstring));
			else strins(fstring, "~r~", floatround(health/100.0), sizeof(fstring));
			strcat(string, fstring, sizeof(string));

			TextDrawSetString(SpeedoText[i], string);
		}
	}
}
Photo of the speedo fuel etc,
http://i.imgur.com/hQKm885.png


Re: Speedo Fuel Health. - Hostskool - 06.02.2014

Replace strcat(string, "~b~fuel: ~g~", sizeof(string));
to
Код:
strcat(string, "~n~~b~fuel: ~g~", sizeof(string));
To put the Fuel at next line.


Re: Speedo Fuel Health. - Yves - 06.02.2014

Quote:
Originally Posted by Hostskool
Посмотреть сообщение
Replace strcat(string, "~b~fuel: ~g~", sizeof(string));
to
Код:
strcat(string, "~n~~b~fuel: ~g~", sizeof(string));
To put the Fuel at next line.
Just fixed it anyways as you commented might as well give yea rep for helping out.