SA-MP Forums Archive
Textdraw help. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Textdraw help. (/showthread.php?tid=181713)



Textdraw help. - zack3021 - 06.10.2010

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


Re: Textdraw help. - Kitten - 06.10.2010

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


Re: Textdraw help. - Tee - 06.10.2010

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;
}



Re: Textdraw help. - LarzI - 06.10.2010

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


Re: Textdraw help. - bigcomfycouch - 06.10.2010

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);



Re: Textdraw help. - zack3021 - 06.10.2010

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.


Re: Textdraw help. - zack3021 - 06.10.2010

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


Re: Textdraw help. - LarzI - 07.10.2010

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


Re: Textdraw help. - Toni - 07.10.2010

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.


Re: Textdraw help. - Retardedwolf - 07.10.2010

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.