SA-MP Forums Archive
[Tutorial] Text draw tips - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Text draw tips (/showthread.php?tid=2867)

Pages: 1 2 3


Re: Text draw tips - Intoxicated - 14.08.2011

My textdraw in my FS and my textdraw in my gamemode seem to collide, the string in the filterscript uses the textdrawcreate from the main gamemode, what is causing this?


Re: Text draw tips - ModianO - 14.08.2011

Aside of TextDrawShowForPlayer(playerid ,txt); Use TextDrawShowForAll(txt);


Re: Text draw tips - Shadow_ - 24.02.2012

Is there a way i can TextDrawSetString but for a particular player ...


Re: Text draw tips - T0pAz - 24.02.2012

Quote:
Originally Posted by Shadow_
View Post
Is there a way i can TextDrawSetString but for a particular player ...
Yes, you can but you need to assign it to a variable or make your own method(function).


Re: Text draw tips - Shadow_ - 24.02.2012

sigh, i was hoping there was a default function.


Re: Text draw tips - Universal Member - 20.04.2012

Nice tutorail but i have some problem .I am using the following code !
pawn Code:
EclipseBlue[ 0 ] = TextDrawCreate(587.000000, 392.000000, "~b~F~b~~h~r~b~e~b~r~b~~h~o~b~a~b~m~n~~b~M~b~~h~a~b~k~b~~h~e~b~~h~r~b~s");
    TextDrawAlignment(EclipseBlue[ 0 ], 2);
    TextDrawBackgroundColor(EclipseBlue[ 0 ], 255);
    TextDrawFont(EclipseBlue[ 0 ], 0);
    TextDrawLetterSize(EclipseBlue[ 0 ], 0.819998, 1.899999);
    TextDrawColor(EclipseBlue[ 0 ], 255);
    TextDrawSetOutline(EclipseBlue[ 0 ], 1);
    TextDrawSetProportional(EclipseBlue[ 0 ], 1)
but it is showing me as
Code:
Freroams Maers
the ~k is not showing up for me But why ? How to code this ?


Re: Text draw tips - SpiderWalk - 14.05.2012

Anyone have idea how to create Progress bar with textdraw??


AW: Re: Text draw tips - Nero_3D - 14.05.2012

Quote:
Originally Posted by SpiderWalk
View Post
Anyone have idea how to create Progress bar with textdraw??
Use three textdrawsAs the original bars from gta-sa (health bar as example) -> IMAGE

The calculation is the easiest thing
pawn Code:
new
    Float: health
;
GetPlayerHealth(playerid, health);
/*
    100 hp = 50 px // 50 is the size of the bar
    health = x px // x would be the calculated size

    x = health * 50 / 100 = health * 0.5 = health / 2
*/

TextDrawTextSize(
    textdraw,
    150.0 + (health / 2), // 150.0 is start position of the textdraw
    3.6
); // TextDrawTextSize doesnt update the textdraw, so we show it again to the player
TextDrawShowForPlayer(playerid, textdraw);



Re: Text draw tips - SampLoverNo123 - 10.06.2012

Thank you for this, today i made my first textdraw


Re: Text draw tips - im - 05.08.2012

Do I have to use TextDrawDestroy on OnPlayerDisconnect? What happens if I don't?


Re: Text draw tips - Virus. - 10.11.2012

Whts wrong??

Quote:

new speedo[80];
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new Float:X,Float:Y,Float:Z;
new speed=GetVehicleVelocity(GetPlayerVehicleID(player id),X,Y,Z);
format(speedo,sizeof(speedo),"Speed : %i %i %i",X,Y,Z);
TextDrawUseBox(TextDrawCreate(10.0, 100.0, speedo),1)
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
TextDrawHideForPlayer(playerid, speedo);
return 1;
}




Re: Text draw tips - Virus. - 11.11.2012

Quote:
Originally Posted by Y_Less
View Post
The problem is probably that you never show the TD to anyone.
Lol... Thnxx for that


Re: Text draw tips - NoahF - 11.11.2012

Thanks for the tutorial, Betamaster. I'm not too good with TextDraws so this helped!


Respuesta: Re: Text draw tips - xblade2k10 - 18.01.2013

Quote:
Originally Posted by Mauzen
View Post
sry for a noob question again, but why does this code not work?

Code:
public carhealth() {
	new Float:tmp;
	new tmpp[256];
	new tmppp[256];
	for(new i = 0; i < MAX_PLAYERS; i ++) {

		if(IsPlayerInAnyVehicle(i)) {
			GetVehicleHealth(GetPlayerVehicleID(i), tmp);
			format(tmpp,255,"%f",tmp / 10);
			valstr(tmppp,strval(tmpp));
			TextDrawDestroy(carhp[i]);
			carhpshown[i] = 0;
			format(tmpp,255,"%d km/h~n~%s%",kmph[i], tmppp);
			carhp[i] = TextDrawCreate(500, 380, tmpp);
			TextDrawUseBox(carhp[i], 1);
			TextDrawBoxColor(carhp[i], 0x88888877);
			TextDrawShowForPlayer(i, carhp[i]);
			carhpshown[i] = 1;
		} else {
			if(carhpshown[i] == 1) {
				TextDrawDestroy(carhp[i]);
				carhpshown[i] = 0;
			}
		}
 	}
}
It should display the speed and health of a car to players, but its the same like before, when more than one player is in a car, it is only visible for the player with the highest id.
I used arrays as said here, but i still cant find the error.
sorry for revive topic but i have the same problem, when other player connect textdraw are only visibles in the most hight ID.

any solution?, thanks


Re: Text draw tips - qazwsx - 19.07.2013

Nice, this tutorial helped me a lot
GJ