SA-MP Forums Archive
Moving a speedo box & Text - 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: Moving a speedo box & Text (/showthread.php?tid=442261)



Moving a speedo box & Text - OpticKiller - 06.06.2013

hi guys am trying to move the speedo box on the right an side i can get the box on the rigth an side but the text saying fuel and speed i cant move it

here is a photo anyways http://i.imgur.com/Tkq8Nbq.jpg

well here is the code if you have any ideas what can i do?


Код:
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);

			strcat(string, "~n~~b~~h~health: ~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));

			strcat(string, "        ~b~~h~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));
			TextDrawSetString(SpeedoText[i], string);
		}
	}
}


Код:
        SpeedoText[playerid] = TextDrawCreate(180.000, 362.000," ");
	TextDrawAlignment(SpeedoText[playerid], 1);
	TextDrawFont(SpeedoText[playerid],2);
	TextDrawLetterSize(SpeedoText[playerid], 0.310, 1.400);
	TextDrawSetShadow(SpeedoText[playerid],0);
	TextDrawUseBox(SpeedoText[playerid], 1);
	TextDrawBoxColor(SpeedoText[playerid], 0x99);
	TextDrawTextSize(SpeedoText[playerid], 520.000, 0.000);



Re: Moving a speedo box & Text - park4bmx - 06.06.2013

maybe there are in 1 textdraw just with formatted string ?


Re: Moving a speedo box & Text - Goldilox - 06.06.2013

Play with the numbers I've made bold.

SpeedoText[playerid] = TextDrawCreate(180.000, 362.000," ");

Those are X and Y coordinates. The first is X which deals with left and right and Y which deals with up and down.

+ rep if helped!


Re: Moving a speedo box & Text - OpticKiller - 06.06.2013

i try and mess around with it so the speedotext is the one with the letters ?


Re: Moving a speedo box & Text - Goldilox - 06.06.2013

Oh you want the "MPH" to move to the right?

I can't find MPH on the code above, make sure you send me all of the code containing the speed.