SA-MP Forums Archive
Textdraw hiding/showing - 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 hiding/showing (/showthread.php?tid=559255)



Textdraw hiding/showing - vassilis - 22.01.2015

Is there a more efficient way than this? i mean is there a shorter way than this to hide/show textdraws?
pawn Код:
stock HideWeaponShop(playerid)
{
    TextDrawHideForPlayer(playerid, WepShop[0]);
    TextDrawHideForPlayer(playerid, WepShop[1]);
    TextDrawHideForPlayer(playerid, WepShop[2]);
    TextDrawHideForPlayer(playerid, WepShop[3]);
    TextDrawHideForPlayer(playerid, WepShop[4]);
    TextDrawHideForPlayer(playerid, WepShop[5]);
    TextDrawHideForPlayer(playerid, WepShop[6]);
    TextDrawHideForPlayer(playerid, WepShop[7]);
    TextDrawHideForPlayer(playerid, WepShop[8]);
        TextDrawHideForPlayer(playerid, WepShop[9]);
        TextDrawHideForPlayer(playerid, WepShop[10]);
    TextDrawHideForPlayer(playerid, WepShop[11]);
       TextDrawHideForPlayer(playerid, WepShop[12]);
       TextDrawHideForPlayer(playerid, WepShop[13]);
    CancelSelectTextDraw(playerid);
    return 1;
}



Re: Textdraw hiding/showing - Schneider - 22.01.2015

pawn Код:
stock HideWeaponShop(playerid)
{
    for(new i; i<sizeof(WebShop); i++)
    {
        TextDrawHideForPlayer(playerid, WebShop[i]);
    }
    CancelSelectTextDraw(playerid);
    return 1;
}



Re: Textdraw hiding/showing - zT KiNgKoNg - 22.01.2015

Quote:
Originally Posted by Schneider
Посмотреть сообщение
pawn Код:
stock HideWeaponShop(playerid)
{
    for(new i; i<sizeof(WebShop); i++)
    {
        TextDrawHideForPlayer(playerid, WebShop[i]);
    }
    CancelSelectTextDraw(playerid);
    return 1;
}
This is just hiding the Textdraw, If i can read correctly He wanted a fast way to Show and Hide the textdraws (from the title), but you're on the right track.

Heres an example, actually its basically what I use, after pushing the function (under it) place 'CancelSelectTextDraw(playerid);', theres no need to include this in the Stock as you may not always be selecting from the WepShop (if you're just showing it without clicking, ect).

pawn Код:
stock HideTextdraw_WeaponShop(playerid, bool:show = true)
{
    if(show)
    {
        for(new i; i < sizeof(WepShop); i ++)
        {
            TextDrawShowForPlayer(playerid, WebShop[i]);
        }
    } else {
        for(new i; i < sizeof(WepShop); i ++)
        {
            TextDrawHideForPlayer(playerid, WebShop[i]);
        }
    }
}
An example of using this.

pawn Код:
public {some function}({some parameters})
{

       HideTextdraw_WeaponShop(playerid); // this will show it, as by default the Boolean is set to true and doesn't need a value.
       HideTextdraw_WeaponShop(playerid, false); // this will hide it, as by default the Boolean is set to true, and to hide it then it'll require a value of 'False'.
}



Re: Textdraw hiding/showing - vassilis - 22.01.2015

Quote:
Originally Posted by Schneider
Посмотреть сообщение
pawn Код:
stock HideWeaponShop(playerid)
{
    for(new i; i<sizeof(WebShop); i++)
    {
        TextDrawHideForPlayer(playerid, WebShop[i]);
    }
    CancelSelectTextDraw(playerid);
    return 1;
}
That's exactly what i want thanks +rep