SA-MP Forums Archive
Little problem with Textdraw - 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: Little problem with Textdraw (/showthread.php?tid=568711)



Little problem with Textdraw [+REP] - Nenzittow - 24.03.2015

Hey guys,

I have a little problem with my time/date Textdraw.

So, as you can see, the date textdraw background is green and i want it with black color, as the time textdraw background.

Someone can help me pls?

Screen:




Code:

pawn Код:
Date = TextDrawCreate(503.500000,4.000000,"--");
    TextDrawFont(Date,3);
    TextDrawLetterSize(Date,0.499999,1.800000);
    TextDrawSetOutline(Date, 1);
    TextDrawColor(Date,0xFFFFFFFF);
    TextDrawBackgroundColor(Date, 0x000000FF);
    SetTimer("settime",1000, true);

    Time = TextDrawCreate(546.000000,28.000000,"--");
    TextDrawFont(Time,3);
    TextDrawLetterSize(Time,0.550000,1.750000);
    TextDrawSetOutline(Time, 1);
    TextDrawColor(Time,0xFFFFFFFF);
    TextDrawBackgroundColor(Time, 0x000000FF);
    SetTimer("settime",1000, true);
Sorry for the bad english, i didn't used ****** Translator


Re: Little problem with Textdraw - fuckingcruse - 24.03.2015

For that ..


Код:
Date = TextDrawCreate(503.500000,4.000000,"--"); 
TextDrawFont(Date,3); TextDrawLetterSize(Date,0.499999,1.800000); 
TextDrawSetOutline(Date, 1); TextDrawColor(Date,0xFFFFFFFF); 
TextDrawBackgroundColor(Date, 0x000000AA ); 
SetTimer("settime",1000, true);

Time = TextDrawCreate(546.000000,28.000000,"--"); 
TextDrawFont(Time,3); 
TextDrawLetterSize(Time,0.550000,1.750000);
TextDrawSetOutline(Time, 1); 
TextDrawColor(Time,0xFFFFFFFF); 
TextDrawBackgroundColor(Time, 0x000000AA ); 
SetTimer("settime",1000, true);
Try this


Re: Little problem with Textdraw - Nenzittow - 24.03.2015

@fuckingcruse: It doesn't work...

I don't know what is wrong there... Can anyone help me pls?


Re: Little problem with Textdraw - Nenzittow - 24.03.2015

UP!

Can someone help me pls?


Re: Little problem with Textdraw - n0minal - 24.03.2015

They have same identical hex number, but why are you setting the same time 2 times? And please, post the settime public content.


Re: Little problem with Textdraw - Nenzittow - 24.03.2015

So... I will post here the full date/time system

pawn Код:
new Text:Time, Text:Date;

forward settime(playerid);

public OnGameModeInit()
{
    Date = TextDrawCreate(503.500000,4.000000,"--");
    TextDrawFont(Date,3);
    TextDrawLetterSize(Date,0.499999,1.800000);
    TextDrawSetOutline(Date, 1);
    TextDrawColor(Date,0xFFFFFFFF);
    TextDrawBackgroundColor(Date, 0x000000AA );
    SetTimer("settime",1000, true);

    Time = TextDrawCreate(546.000000,28.000000,"--");
    TextDrawFont(Time,3);
    TextDrawLetterSize(Time,0.550000,1.750000);
    TextDrawSetOutline(Time, 1);
    TextDrawColor(Time,0xFFFFFFFF);
    TextDrawBackgroundColor(Time, 0x000000AA );
    SetTimer("settime",1000, true);

    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid, Time);
    TextDrawShowForPlayer(playerid, Date);
    StopAudioStreamForPlayer(playerid);
    return 1;
}

public settime(playerid)
{
        new string[256], year, month, day, hours, minutes;
        getdate(year, month, day), gettime(hours, minutes);
        format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
        TextDrawSetString(Date, string);
        format(string, sizeof string, "%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes);
        TextDrawSetString(Time, string);
}



Re: Little problem with Textdraw - n0minal - 24.03.2015

Remove the first SetTimer("settime",1000, true);

About the color, theres 2 things more which you made wrong on your code, first of them you need to hide the clock, sencond is that you have to check the color format of TextDrawBackGroundColor if its RGBA or ARGB, try this and post results.


Re: Little problem with Textdraw - Nenzittow - 24.03.2015

Quote:
Originally Posted by ipsLeon
Посмотреть сообщение
Remove the first SetTimer("settime",1000, true);

About the color, theres 2 things more which you made wrong on your code, first of them you need to hide the clock, sencond is that you have to check the color format of TextDrawBackGroundColor if its RGBA or ARGB, try this and post results.
I removed the timer and the clock too. The problem remains...

Code:

pawn Код:
new Text:Time, Text:Date;

forward settime(playerid);

public OnGameModeInit()
{
    Date = TextDrawCreate(503.500000,4.000000,"--");
    TextDrawFont(Date,3);
    TextDrawLetterSize(Date,0.499999,1.800000);
    TextDrawSetOutline(Date, 1);
    TextDrawColor(Date,0xFFFFFFFF);
    TextDrawBackgroundColor(Date, 0x000000AA );

    Time = TextDrawCreate(546.000000,28.000000,"--");
    TextDrawFont(Time,3);
    TextDrawLetterSize(Time,0.550000,1.750000);
    TextDrawSetOutline(Time, 1);
    TextDrawColor(Time,0xFFFFFFFF);
    TextDrawBackgroundColor(Time, 0x000000AA );
   
    SetTimer("settime",1000, true);

    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
       TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid, Time);
    TextDrawShowForPlayer(playerid, Date);
    StopAudioStreamForPlayer(playerid);
    return 1;
}

public settime(playerid)
{
        new string[256], year, month, day, hours, minutes;
        getdate(year, month, day), gettime(hours, minutes);
        format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
        TextDrawSetString(Date, string);
        format(string, sizeof string, "%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes);
        TextDrawSetString(Time, string);
}

Quote:

Second is that you have to check the color format of TextDrawBackGroundColor if its RGBA or ARGB

I don't understand what are you saying with that... can you correct the code and send me pls? I would greatly appreciate it.

PS: I'll give +REP to all who help me!


Re: Little problem with Textdraw - n0minal - 24.03.2015

TextDrawBackgroundColor(Date, 0x000000FF );


RGBA:

red: 00 (empty/black)
green:00 (empty/black)
blue: 00 (empty/black)
alpha (transparency): FF (full)

ARGB:

alpha: 00 (empty)
red: 00 (empty)
green: 00 (empty)
blue: FF (full)

by the way if it used to be ARGB it would result in blue not green... Its strange.


Re: Little problem with Textdraw - Nenzittow - 24.03.2015

So now I have changed this:

pawn Код:
Date = TextDrawCreate(503.500000, 4.000000,"--");
    TextDrawFont(Date,3);
    TextDrawLetterSize(Date,0.499999,1.800000);
    TextDrawSetOutline(Date, 1);
    TextDrawColor(Date,White);
    TextDrawBackgroundColor(Date, Black);

        Time = TextDrawCreate(546.000000, 28.000000,"--");
    TextDrawFont(Time,3);
    TextDrawLetterSize(Time,0.550000,1.750000);
    TextDrawSetOutline(Time, 1);
    TextDrawColor(Time,White);
    TextDrawBackgroundColor(Time, Black);

To this:


pawn Код:
Time = TextDrawCreate(546.000000, 28.000000,"--");
    TextDrawFont(Time,3);
    TextDrawLetterSize(Time,0.550000,1.750000);
    TextDrawSetOutline(Time, 1);
    TextDrawColor(Time,White);
    TextDrawBackgroundColor(Time, Black);

    Date = TextDrawCreate(503.500000, 4.000000,"--");
    TextDrawFont(Date,3);
    TextDrawLetterSize(Date,0.499999,1.800000);
    TextDrawSetOutline(Date, 1);
    TextDrawColor(Date,White);
    TextDrawBackgroundColor(Date, Black);

And the result was this:




So yeah... I just changed the order of the things and now is the reverse... It's too strange... Can anyone help me pls?