[Tutorial] Text draw tips
#41

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?
Reply
#42

Aside of TextDrawShowForPlayer(playerid ,txt); Use TextDrawShowForAll(txt);
Reply
#43

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

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).
Reply
#45

sigh, i was hoping there was a default function.
Reply
#46

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 ?
Reply
#47

Anyone have idea how to create Progress bar with textdraw??
Reply
#48

Quote:
Originally Posted by SpiderWalk
View Post
Anyone have idea how to create Progress bar with textdraw??
Use three textdraws
  • The first is the border
  • The second one would be the whole bar just a bit darker as the real bar
  • And the last would be the real bar
As 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);
Reply
#49

Thank you for this, today i made my first textdraw
Reply
#50

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

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

Reply
#52

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

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

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
Reply
#55

Nice, this tutorial helped me a lot
GJ
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)