2 Problems with clickable textdraws (+ 7 REP)
#1

The first problem: When i type /radio and press the ESC key while in the selectable show, the textdraw doesn't dissapear. Is there anyway to fix it?

The second problem: When i put my mouse on a word, why all others under it becomes the same color?

Here a pic
Reply
#2

Each TextdDraw of style of music has different ID?
Reply
#3

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Each TextdDraw of style of music has different ID?
yes
,

pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(_:clickedid != INVALID_TEXT_DRAW)
    {
        if(clickedid == techno)
        {
            PlayAudioStreamForPlayer(playerid, "http://listen.technobase.fm/dsl.pls");
        }
        else if(clickedid == hard)
        {
            PlayAudioStreamForPlayer(playerid, "http://listen.hardbase.fm/dsl.pls");
        }
        else if(clickedid == house)
        {
            PlayAudioStreamForPlayer(playerid, "http://listen.housetime.fm/dsl.pls");
        }
        else if(clickedid == dubstep)
        {
            PlayAudioStreamForPlayer(playerid, "http://dubstep.fm/listen.pls");
        }
        else if(clickedid == trance)
        {
            PlayAudioStreamForPlayer(playerid, "http://listen.trancebase.fm/dsl.pls");
        }
        else if(clickedid == stop)
        {
            StopAudioStreamForPlayer(playerid);
        }
        TextDrawHideForPlayer(playerid, radiobox0);
        TextDrawHideForPlayer(playerid, radiobox1);
        TextDrawHideForPlayer(playerid, radiobox2);
        TextDrawHideForPlayer(playerid, radiobox3);
        TextDrawHideForPlayer(playerid, radiobox4);
        TextDrawHideForPlayer(playerid, techno);
        TextDrawHideForPlayer(playerid, hard);
        TextDrawHideForPlayer(playerid, house);
        TextDrawHideForPlayer(playerid, dubstep);
        TextDrawHideForPlayer(playerid, trance);
        TextDrawHideForPlayer(playerid, stop);
        CancelSelectTextDraw(playerid);
    }
    return 1;
}
Reply
#4

How are you using SelectTextDraw?
Reply
#5

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
How are you using SelectTextDraw?
in a command

pawn Код:
command(radio, playerid, params[])
{
    #pragma unused params
    TextDrawShowForPlayer(playerid, radiobox0);
    TextDrawShowForPlayer(playerid, radiobox1);
    TextDrawShowForPlayer(playerid, radiobox2);
    TextDrawShowForPlayer(playerid, radiobox3);
TextDrawShowForPlayer(playerid, radiobox4);
    TextDrawShowForPlayer(playerid, techno);
    TextDrawShowForPlayer(playerid, hard);
    TextDrawShowForPlayer(playerid, house);
    TextDrawShowForPlayer(playerid, dubstep);
    TextDrawShowForPlayer(playerid, trance);
    TextDrawShowForPlayer(playerid, stop);
    SelectTextDraw(playerid, 0xA3B4C5FF);
    return 1;
}
Reply
#6

To be honest I have not tested this.
At the moment I'm working, when I get home I'll do some tests to try help you.
Reply
#7

Quote:
Originally Posted by Dripac
Посмотреть сообщение
The first problem: When i type /radio and press the ESC key while in the selectable show, the textdraw doesn't dissapear. Is there anyway to fix it?

The second problem: When i put my mouse on a word, why all others under it becomes the same color?
For the first problem, hide them when OnPlayerClickTextDraw gets called with clickedid 65535 (INVALID_TEXT_DRAW)

pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(_:clickedid != INVALID_TEXT_DRAW)
    {
        if(clickedid == techno)
        {
            PlayAudioStreamForPlayer(playerid, "http://listen.technobase.fm/dsl.pls");
        }
        else if(clickedid == hard)
        {
            PlayAudioStreamForPlayer(playerid, "http://listen.hardbase.fm/dsl.pls");
        }
        else if(clickedid == house)
        {
            PlayAudioStreamForPlayer(playerid, "http://listen.housetime.fm/dsl.pls");
        }
        else if(clickedid == dubstep)
        {
            PlayAudioStreamForPlayer(playerid, "http://dubstep.fm/listen.pls");
        }
        else if(clickedid == trance)
        {
            PlayAudioStreamForPlayer(playerid, "http://listen.trancebase.fm/dsl.pls");
        }
        else if(clickedid == stop)
        {
            StopAudioStreamForPlayer(playerid);
        }
        TextDrawHideForPlayer(playerid, radiobox0);
        TextDrawHideForPlayer(playerid, radiobox1);
        TextDrawHideForPlayer(playerid, radiobox2);
        TextDrawHideForPlayer(playerid, radiobox3);
        TextDrawHideForPlayer(playerid, radiobox4);
        TextDrawHideForPlayer(playerid, techno);
        TextDrawHideForPlayer(playerid, hard);
        TextDrawHideForPlayer(playerid, house);
        TextDrawHideForPlayer(playerid, dubstep);
        TextDrawHideForPlayer(playerid, trance);
        TextDrawHideForPlayer(playerid, stop);
        CancelSelectTextDraw(playerid);
    }
    else
    {
        TextDrawHideForPlayer(playerid, radiobox0);
        TextDrawHideForPlayer(playerid, radiobox1);
        TextDrawHideForPlayer(playerid, radiobox2);
        TextDrawHideForPlayer(playerid, radiobox3);
        TextDrawHideForPlayer(playerid, radiobox4);
        TextDrawHideForPlayer(playerid, techno);
        TextDrawHideForPlayer(playerid, hard);
        TextDrawHideForPlayer(playerid, house);
        TextDrawHideForPlayer(playerid, dubstep);
        TextDrawHideForPlayer(playerid, trance);
        TextDrawHideForPlayer(playerid, stop);
        //Do not use CancelSelectTextDraw here!!!
    }
    return 1;
}
For the second problem, change the sizes with TextDrawTextSize. Try different sizes until you find one that works perfectly
Reply
#8

Quote:
Originally Posted by OPremium
Посмотреть сообщение
For the first problem, hide them when OnPlayerClickTextDraw gets called with clickedid 65535 (INVALID_TEXT_DRAW)

pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(_:clickedid != INVALID_TEXT_DRAW)
    {
        if(clickedid == techno)
        {
            PlayAudioStreamForPlayer(playerid, "http://listen.technobase.fm/dsl.pls");
        }
        else if(clickedid == hard)
        {
            PlayAudioStreamForPlayer(playerid, "http://listen.hardbase.fm/dsl.pls");
        }
        else if(clickedid == house)
        {
            PlayAudioStreamForPlayer(playerid, "http://listen.housetime.fm/dsl.pls");
        }
        else if(clickedid == dubstep)
        {
            PlayAudioStreamForPlayer(playerid, "http://dubstep.fm/listen.pls");
        }
        else if(clickedid == trance)
        {
            PlayAudioStreamForPlayer(playerid, "http://listen.trancebase.fm/dsl.pls");
        }
        else if(clickedid == stop)
        {
            StopAudioStreamForPlayer(playerid);
        }
        TextDrawHideForPlayer(playerid, radiobox0);
        TextDrawHideForPlayer(playerid, radiobox1);
        TextDrawHideForPlayer(playerid, radiobox2);
        TextDrawHideForPlayer(playerid, radiobox3);
        TextDrawHideForPlayer(playerid, radiobox4);
        TextDrawHideForPlayer(playerid, techno);
        TextDrawHideForPlayer(playerid, hard);
        TextDrawHideForPlayer(playerid, house);
        TextDrawHideForPlayer(playerid, dubstep);
        TextDrawHideForPlayer(playerid, trance);
        TextDrawHideForPlayer(playerid, stop);
        CancelSelectTextDraw(playerid);
    }
    else
    {
        TextDrawHideForPlayer(playerid, radiobox0);
        TextDrawHideForPlayer(playerid, radiobox1);
        TextDrawHideForPlayer(playerid, radiobox2);
        TextDrawHideForPlayer(playerid, radiobox3);
        TextDrawHideForPlayer(playerid, radiobox4);
        TextDrawHideForPlayer(playerid, techno);
        TextDrawHideForPlayer(playerid, hard);
        TextDrawHideForPlayer(playerid, house);
        TextDrawHideForPlayer(playerid, dubstep);
        TextDrawHideForPlayer(playerid, trance);
        TextDrawHideForPlayer(playerid, stop);
        //Do not use CancelSelectTextDraw here!!!
    }
    return 1;
}
For the second problem, change the sizes with TextDrawTextSize. Try different sizes until you find one that works perfectly
Problem solved, +rep!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)