Textdraw help.
#1

I made a speedometer but the problem is, the car speed and health takes the color of the word health and speed.

Example
This is what happens, the speed (24) takes the color of the word Speed and any other color i put it in. How can i have the word speed and the cars speed in different colors?

Speed: 24 mph
Health: 1000.0


How to make it look like this:


Speed: 24 mph
Health: 1000.0
Reply
#2

i cant help you show your code so i can see what you did wrong
Reply
#3

Here is a code i use for health.

pawn Код:
public OnPlayerUpdate(playerid)
{
    new string[128],Float:health;
    GetVehicleHealth(GetPlayerVehicleID(playerid), health);
     format(string, sizeof(string), "Health: %.1f", health);
     TextDrawSetString(Textdraw3, string);
    return 1;
}
Reply
#4

If you're using textdraws, just make 2 textdraws instead of 1 (or 4 instead of 2 if you're using 2)
and color them differently
Reply
#5

pawn Код:
new
    Float:vhp;
GetVehicleHealth(GetPlayerVehicle(playerid), vhp);
format(string, sizeof (string), "~r~Speed: ~w~%i mph~n~~r~Health: ~w~%.1f", YOUR_SPEED_FUNC, vhp);
Reply
#6

Quote:
Originally Posted by Tee
Посмотреть сообщение
Here is a code i use for health.

pawn Код:
public OnPlayerUpdate(playerid)
{
    new string[128],Float:health;
    GetVehicleHealth(GetPlayerVehicleID(playerid), health);
     format(string, sizeof(string), "Health: %.1f", health);
     TextDrawSetString(Textdraw3, string);
    return 1;
}
That is the same code i use but i will try the one from the guy above.
Reply
#7

Quote:
Originally Posted by bigcomfycouch
Посмотреть сообщение
pawn Код:
new
    Float:vhp;
GetVehicleHealth(GetPlayerVehicle(playerid), vhp);
format(string, sizeof (string), "~r~Speed: ~w~%i mph~n~~r~Health: ~w~%.1f", YOUR_SPEED_FUNC, vhp);
Thanks it worked but now i need you to tell me why did it put" ~r~" infront of Speed and "~w~" infront of %.1f
Reply
#8

Lol, shame on me.
Forgot that textdraw use the same thing as gametext ... Silly me.

Look here for answer, zack3021: https://sampwiki.blast.hk/wiki/GameTextStyle
Reply
#9

Quote:
Originally Posted by Tee
Посмотреть сообщение
Here is a code i use for health.

pawn Код:
public OnPlayerUpdate(playerid)
{
    new string[128],Float:health;
    GetVehicleHealth(GetPlayerVehicleID(playerid), health);
     format(string, sizeof(string), "Health: %.1f", health);
     TextDrawSetString(Textdraw3, string);
    return 1;
}
I wouldn't recommend setting a TextDraw string about 37 times per second.
Reply
#10

Quote:
Originally Posted by The Toni
Посмотреть сообщение
I wouldn't recommend setting a TextDraw string about 37 times per second.
+1.


I would only run it on a 1second timer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)