TextDraw doesn't show
#1

Hey guys, what's wrong here ?
I am trying to make an intro, what's the problem
I have 5 Textdraws, they all show except this one
PHP код:
#define ShowOpeningTD(%1) TextDrawShowForPlayer(%1, OP1); TextDrawShowForPlayer(%1, OP2); TextDrawShowForPlayer(%1, OP3); TextDrawShowForPlayer(%1, OP4); TextDrawShowForPlayer(%1, OP5) 
PHP код:
    OP5 TextDrawCreate(312.66668729.037025"~y~Welcome to~n~~b~MILLITARY ~w~VS ~r~REBELS~n~~w~%s");
    
TextDrawLetterSize(OP50.4499991.600000);
    
TextDrawAlignment(OP52);
    
TextDrawColor(OP50);
    
TextDrawSetShadow(OP50);
    
TextDrawSetOutline(OP50);
    
TextDrawBackgroundColor(OP551);
    
TextDrawFont(OP52);
    
TextDrawSetProportional(OP51); 
PHP код:
public OnPlayerConnect(playerid)
{
    new 
string[128];
    
format(stringsizeof(string), "~y~Welcome to~n~~b~MILLITARY ~w~VS ~r~REBELS~n~~w~%s"RPN(playerid));
    
TextDrawSetString(OP5string);
    
ShowOpeningTD(playerid);
    return 
1;

Reply
#2

try to use this one

Код:
new string[128];
format(string, sizeof(string), "~y~Welcome to~n~~b~MILLITARY ~w~VS ~r~REBELS~n~~w~%s", RPN(playerid));
TextDrawSetString(OP5, string);
TextDrawShowForPlayer(playerid, OP5);
Reply
#3

Still not working
Reply
#4

PHP код:
#define ShowOpeningTD(%0) TextDrawShowForPlayer(%0, OP1)
#define ShowOpeningTD2(%0) TextDrawShowForPlayer(%0, OP2)
#define ShowOpeningTD3(%0) TextDrawShowForPlayer(%0, OP3)
#define ShowOpeningTD4(%0) TextDrawShowForPlayer(%0, OP4)
#define ShowOpeningTD5(%0) TextDrawShowForPlayer(%0, OP5) 
Reply
#5

Still not working
Reply
#6

Start using functions instead of cramming everything into an unreadable macro. Macros are meant for small things, not entire function bodies.
PHP код:
ShowOpeningTD(playerid)
{
    
TextDrawShowForPlayer(playeridOP1); 
    
TextDrawShowForPlayer(playeridOP2); 
    
TextDrawShowForPlayer(playeridOP3); 
    
TextDrawShowForPlayer(playeridOP4); 
    
TextDrawShowForPlayer(playeridOP5);

For cleanliness sake you might also want to use an array.
Reply
#7

Quote:
Originally Posted by Vince
Посмотреть сообщение
Start using functions instead of cramming everything into an unreadable macro. Macros are meant for small things, not entire function bodies.
PHP код:
ShowOpeningTD(playerid)
{
    
TextDrawShowForPlayer(playeridOP1); 
    
TextDrawShowForPlayer(playeridOP2); 
    
TextDrawShowForPlayer(playeridOP3); 
    
TextDrawShowForPlayer(playeridOP4); 
    
TextDrawShowForPlayer(playeridOP5);

For cleanliness sake you might also want to use an array.
I have read some code optimization thread claiming regular vars are way better and faster than arrays, that's why
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
Start using functions instead of cramming everything into an unreadable macro. Macros are meant for small things, not entire function bodies.
PHP код:
ShowOpeningTD(playerid)
{
    
TextDrawShowForPlayer(playeridOP1); 
    
TextDrawShowForPlayer(playeridOP2); 
    
TextDrawShowForPlayer(playeridOP3); 
    
TextDrawShowForPlayer(playeridOP4); 
    
TextDrawShowForPlayer(playeridOP5);

For cleanliness sake you might also want to use an array.
I used
PHP код:
TextDrawShowForPlayer(playeridOP1); 
    
TextDrawShowForPlayer(playeridOP2); 
    
TextDrawShowForPlayer(playeridOP3); 
    
TextDrawShowForPlayer(playeridOP4); 
    
TextDrawShowForPlayer(playeridOP5); 
inside OnPlayerConnect Directly
Reply
#9

Quote:
Originally Posted by NeXoR
Посмотреть сообщение
I have read some code optimization thread claiming regular vars are way better and faster than arrays, that's why
While this is true, it decreases readability and most importantly maintainability. I would always use x, y and z over pos[3], but once I need 4 or more similar variables I will generally use an array.
Reply
#10

Quote:
Originally Posted by Vince
Посмотреть сообщение
While this is true, it decreases readability and most importantly maintainability. I would always use x, y and z over pos[3], but once I need 4 or more similar variables I will generally use an array.
Alright thanks I'll try it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)