Help with textdraws.
#1

Hi, I need help... I'm tired of trying make working this.
Let me explain you, I made this function.
PD: I know it seems long, but it's just about textdraws.

PHP код:
enum iText
{
    
Float:xTP,
    
Float:yTP
}
new 
infoT[MAX_PLAYERS][MAX_TEXTDRAWS][iText];
PlayerText:CreateTextDraw(textdrawidplayeridFloat:xFloat:ytext[])
{
    
CreatePlayerTextDraw(playeridxytext);
    
infoT[playerid][textdrawid][xTP] = x;
    
infoT[playerid][textdrawid][yTP] = y;
    
printf("%f %f %i",x,y,textdrawid);
    return;

And I'm creating this textdraws.
PHP код:
new PlayerText:Textdraw[MAX_PLAYERS][MAX_TEXTDRAWS];
public 
OnPlayerConnect(playerid)
{
    
Textdraw[playerid][0] = CreateTextDraw(0playerid359.319915243.331069"O");/*Textdraw[playerid][1] = */
    
PlayerTextDrawLetterSize(playeridTextdraw[playerid][0], 0.7956793.151572);
    
PlayerTextDrawAlignment(playeridTextdraw[playerid][0], 1);
    
PlayerTextDrawColor(playeridTextdraw[playerid][0], -1);
    
PlayerTextDrawSetShadow(playeridTextdraw[playerid][0], 0);
    
PlayerTextDrawSetOutline(playeridTextdraw[playerid][0], 0);
    
PlayerTextDrawBackgroundColor(playeridTextdraw[playerid][0], 51);
    
PlayerTextDrawFont(playeridTextdraw[playerid][0], 2);
    
PlayerTextDrawSetProportional(playeridTextdraw[playerid][0], 1);
    
Textdraw[playerid][1] = CreateTextDraw(1playerid359.439971224.784439"O"); //Textdraw[playerid][0] =
    
PlayerTextDrawLetterSize(playeridTextdraw[playerid][1], 0.7956793.151572);
    
PlayerTextDrawAlignment(playeridTextdraw[playerid][1], 1);
    
PlayerTextDrawColor(playeridTextdraw[playerid][1], -1);
    
PlayerTextDrawSetShadow(playeridTextdraw[playerid][1], 0);
    
PlayerTextDrawSetOutline(playeridTextdraw[playerid][1], 0);
    
PlayerTextDrawBackgroundColor(playeridTextdraw[playerid][1], 51);
    
PlayerTextDrawFont(playeridTextdraw[playerid][1], 2);
    
PlayerTextDrawSetProportional(playeridTextdraw[playerid][1], 1);
    return 
1;

But, when I try to show the textdraws, it only shows the one that is first in "OnPlayerConnect". For example, now it's first Textdraw[playerid][0](It only shows this one), but if I put first Textdraw[playerid][1] it will only shows Textdraw[playerid][1].
Between, I made this "desbug" commands

PHP код:
if(!strcmp(cmdtext,"/test3"))
    {
        for(new 
0MAX_TEXTDRAWSi++)
           {
            
PlayerTextDrawShow(playerid,Textdraw[playerid][i]);
           }
        return 
1;
    }
    if(!
strcmp(cmdtext,"/test4"))
    {
    
Textdraw[playerid][1] = CreateTextDraw(1playerid359.439971224.784439"O"); //Textdraw[playerid][0] =
    
PlayerTextDrawLetterSize(playeridTextdraw[playerid][1], 0.7956793.151572);
    
PlayerTextDrawAlignment(playeridTextdraw[playerid][1], 1);
    
PlayerTextDrawColor(playeridTextdraw[playerid][1], -1);
    
PlayerTextDrawSetShadow(playeridTextdraw[playerid][1], 0);
    
PlayerTextDrawSetOutline(playeridTextdraw[playerid][1], 0);
    
PlayerTextDrawBackgroundColor(playeridTextdraw[playerid][1], 51);
    
PlayerTextDrawFont(playeridTextdraw[playerid][1], 2);
    
PlayerTextDrawSetProportional(playeridTextdraw[playerid][1], 1);
    return 
1;
    } 
But It didn't work... In the console, when I use CreateTextDraw it send the message(printf) fine, making me think the problem isn't there.
I'll rep the one who help.
Reply
#2

Still need help.
Reply
#3

Can u show us u'r max_textdraw define?
Reply
#4

I did it like this
PHP код:
#define MAX_TEXTDRAWS 54 
Reply
#5

well, look at your "CreateTextDraw" function.
you use it like...
PHP код:
Textdraw[playerid][1] = CreateTextDraw(1,........... 
so, obviously, you expect it to return something
but you don't return anything, it'll always be "0"
in Textdraw[playerid][0] and Textdraw[playerid][1]

this is your function
PHP код:
PlayerText:CreateTextDraw(textdrawidplayeridFloat:xFloat:ytext[])
{
    
CreatePlayerTextDraw(playeridxytext);
    
infoT[playerid][textdrawid][xTP] = x;
    
infoT[playerid][textdrawid][yTP] = y;
    
printf("%f %f %i",x,y,textdrawid);
    return;
//you should return something here... textdrawid? you have to know its your function

Reply
#6

Ignore this, It worked... Thanks both, repped.
Reply
#7

Quote:
Originally Posted by Whillyrez
Посмотреть сообщение
So, What I should return? I try to return
PHP код:
CreatePlayerTextDraw(playeridxytext); 
But it didn't work
how do you not know something like this yourself?

well, im not you so i don't know why you're creating the textdraws like this
but who am i to decide what's good or bad.

anyways, like i suggested in the comment behind the return,
try your textrawid variable... but idk why you're setting the id's yourself.
i mean "CreatePlayerTextDraw" already returns the actual id so why do dis?

//EDIT: alright, good that you got it to work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)