SA-MP Forums Archive
TextDraw doesn't show - 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)
+--- Thread: TextDraw doesn't show (/showthread.php?tid=618829)



TextDraw doesn't show - NeXoR - 10.10.2016

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.666687, 29.037025, "~y~Welcome to~n~~b~MILLITARY ~w~VS ~r~REBELS~n~~w~%s");
    
TextDrawLetterSize(OP5, 0.449999, 1.600000);
    
TextDrawAlignment(OP5, 2);
    
TextDrawColor(OP5, 0);
    
TextDrawSetShadow(OP5, 0);
    
TextDrawSetOutline(OP5, 0);
    
TextDrawBackgroundColor(OP5, 51);
    
TextDrawFont(OP5, 2);
    
TextDrawSetProportional(OP5, 1); 
PHP код:
public OnPlayerConnect(playerid)
{
    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);
    
ShowOpeningTD(playerid);
    return 
1;
} 



Re: TextDraw doesn't show - Ronaldo1234 - 10.10.2016

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



Re: TextDraw doesn't show - NeXoR - 10.10.2016

Still not working


Re: TextDraw doesn't show - ChristolisTV - 10.10.2016

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) 



Re: TextDraw doesn't show - NeXoR - 10.10.2016

Still not working


Re: TextDraw doesn't show - Vince - 10.10.2016

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(playerid, OP1); 
    
TextDrawShowForPlayer(playerid, OP2); 
    
TextDrawShowForPlayer(playerid, OP3); 
    
TextDrawShowForPlayer(playerid, OP4); 
    
TextDrawShowForPlayer(playerid, OP5);
} 
For cleanliness sake you might also want to use an array.


Re: TextDraw doesn't show - NeXoR - 10.10.2016

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(playerid, OP1); 
    
TextDrawShowForPlayer(playerid, OP2); 
    
TextDrawShowForPlayer(playerid, OP3); 
    
TextDrawShowForPlayer(playerid, OP4); 
    
TextDrawShowForPlayer(playerid, OP5);
} 
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


Re: TextDraw doesn't show - NeXoR - 10.10.2016

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(playerid, OP1); 
    
TextDrawShowForPlayer(playerid, OP2); 
    
TextDrawShowForPlayer(playerid, OP3); 
    
TextDrawShowForPlayer(playerid, OP4); 
    
TextDrawShowForPlayer(playerid, OP5);
} 
For cleanliness sake you might also want to use an array.
I used
PHP код:
TextDrawShowForPlayer(playerid, OP1); 
    
TextDrawShowForPlayer(playerid, OP2); 
    
TextDrawShowForPlayer(playerid, OP3); 
    
TextDrawShowForPlayer(playerid, OP4); 
    
TextDrawShowForPlayer(playerid, OP5); 
inside OnPlayerConnect Directly


Re: TextDraw doesn't show - Vince - 10.10.2016

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.


Re: TextDraw doesn't show - NeXoR - 10.10.2016

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.