SA-MP Forums Archive
[Include] td-helper - Deal with PlayerTextDraws easier - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] td-helper - Deal with PlayerTextDraws easier (/showthread.php?tid=353630)



td-helper - Deal with PlayerTextDraws easier - Slice - 23.06.2012

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


Re: td-helper - Deal with PlayerTextDraws easier - milanosie - 23.06.2012

Quote:

Viva la simplicity!

Ahum, you mean Viva laziness!


Re: td-helper - Deal with PlayerTextDraws easier - Slice - 23.06.2012

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.




Re: td-helper - Deal with PlayerTextDraws easier - milanosie - 23.06.2012

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


Re: td-helper - Deal with PlayerTextDraws easier - Slice - 23.06.2012

No offense but that's just dumb.


Re: td-helper - Deal with PlayerTextDraws easier - milanosie - 23.06.2012

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


Re: td-helper - Deal with PlayerTextDraws easier - Slice - 23.06.2012

Obviously you didn't read it.


Respuesta: Re: td-helper - Deal with PlayerTextDraws easier - milanosie - 23.06.2012

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


Re: td-helper - Deal with PlayerTextDraws easier - Extremo - 23.06.2012

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.


Re: td-helper - Deal with PlayerTextDraws easier - milanosie - 23.06.2012

No Comprendre Espaniol Signor!

Lol jk, I found it;p


Respuesta: td-helper - Deal with PlayerTextDraws easier - CaptainMactavish - 24.06.2012

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.