[Include] td-helper - Deal with PlayerTextDraws easier
#1

After seeing the new PlayerTextDraw functions I felt it was very superfluous having two of all TextDraw functions when they essentially do the same thing.. Not only that, but also having to specify playerid every single time when it only could be one value.

Now, instead of doing this:
pawn Код:
new PlayerText:td = CreatePlayerTextDraw(playerid, 280.0, 240.0, "abc");

PlayerTextDrawUseBox(playerid, td, true);
PlayerTextDrawSetShadow(playerid, td, 0);
PlayerTextDrawAlignment(playerid, td, 1);
PlayerTextDrawSetOutline(playerid, td, 0);
PlayerTextDrawBoxColor(playerid, td, 0xFF000077);
PlayerTextDrawColor(playerid, td, 0);
PlayerTextDrawBackgroundColor(playerid, td, 0);
PlayerTextDrawTextSize(playerid, td, 356.18825, 0.0);
PlayerTextDrawLetterSize(playerid, td, 0.0, 7.81);

PlayerTextDrawShow(playerid, td);
You can now do this:
pawn Код:
new Text:td = CreatePlayerTextDraw(playerid, 280.0, 240.0, "abc");

TextDrawUseBox(td, true);
TextDrawSetShadow(td, 0);
TextDrawAlignment(td, 1);
TextDrawSetOutline(td, 0);
TextDrawBoxColor(td, 0xFF000077);
TextDrawColor(td, 0);
TextDrawBackgroundColor(td, 0);
TextDrawTextSize(td, 356.18825, 0.0);
TextDrawLetterSize(td, 0.0, 7.81);

TextDrawShowForPlayer(_, td);

Furthermore, OnPlayerClickPlayerTextDraw now leads towards OnPlayerClickTextDraw, so if you use OnPlayerClickPlayerTextDraw, change it to OnPlayerClickTextDraw.
Also change all "PlayerText" tags to "Text".

Viva la simplicity!


http://pastebin.com/kzsgS9NY
Reply
#2

Quote:

Viva la simplicity!

Ahum, you mean Viva laziness!
Reply
#3

Quote:
Originally Posted by milanosie
Посмотреть сообщение
Ahum, you mean Viva laziness!
Yes.

http://blogoscoped.com/archive/2005-08-24-n14.html

Quote:

Only a lazy programmer will avoid writing monotonous, repetitive code. The tools and processes inspired by laziness speed up production.

Reply
#4

Lawl, I think Im more lazy,

Redefined SendClientMessage to SCM, playerid to pl, calling everything str instead of string, made a callback just to send a player a predefined message, Giving every variable short names, redefined MAX_PLAYERS to players, etc...


Ya aint teaching me about laziness;p
Reply
#5

No offense but that's just dumb.
Reply
#6

Quote:
Originally Posted by Slice
Посмотреть сообщение
No offense but that's just dumb.
As your article said, good programmers are dumb
Got ya with your own link;p
Reply
#7

Obviously you didn't read it.
Reply
#8

Quote:
Originally Posted by Slice
Посмотреть сообщение
Obviously you didn't read it.
I just did, but I disagree with the writer.

EDIT: Your fucking signature made my samp forum in spanish :3
Reply
#9

Quote:
Originally Posted by Slice
Посмотреть сообщение
No offense but that's just dumb.
But then again, your link covers being dumb well enough, doesn't it?

EDIT: Before someone ends up getting offended, what I mean is that factoring what is useful or not is dumb. A lazy programmer makes a tool to do what he believes is boring or maybe even dumb work. The next guy questions if that was a smart idea. There can be a billion tools to simplify your life and there will always be people who don't need it.

EDIT2: Buttom left corner for changing the language.
Reply
#10

No Comprendre Espaniol Signor!

Lol jk, I found it;p
Reply
#11

It's funny your spanish, back to the topic, that would be very handy for me and I think for a ot of people. Thanks.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)