SA-MP Forums Archive
[FilterScript] Textdraw Rule Box - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Textdraw Rule Box (/showthread.php?tid=510123)



Removed - ShaneOvSina - 29.04.2014

Removed


Re: Textdraw Rule Box - Patrick - 29.04.2014

Why in the world would you do this? Why are you people using a lot of variables when you could have shorten your code by using an array, also your code won't work if there is more than 1 player. I also suggest you use PlayerTextdraw instead of using GlobalTextdraws

pawn Код:
new
    PlayerText:Textdraw[ 25 ],
    bool:Showing[ MAX_PLAYERS ] //you could use y_bits as well.
;

public OnPlayerSpawn(playerid)
{
    /*
        use PlayerTextdraws instead of creating a GlobalTexdraws

        https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
        https://sampwiki.blast.hk/wiki/PlayerTextDrawBackgroundColor
        https://sampwiki.blast.hk/wiki/PlayerTextDrawLetterSize
        https://sampwiki.blast.hk/wiki/PlayerTextDrawColor
        https://sampwiki.blast.hk/wiki/PlayerTextDrawSetOutline
        https://sampwiki.blast.hk/wiki/PlayerTextDrawSetProportional
        https://sampwiki.blast.hk/wiki/PlayerTextDrawSetShadow
        https://sampwiki.blast.hk/wiki/PlayerTextDrawUseBox
        https://sampwiki.blast.hk/wiki/PlayerTextDrawBoxColor
        https://sampwiki.blast.hk/wiki/PlayerTextDrawTextSize

    */


    ShowPlayerRulesTextdraw(playerid);
    //rest of code.
    return true;
}

ShowPlayerRulesTextdraw(playerid)
{
    for(new i = 0; i != sizeof(Textdraw); ++i )
    {
        PlayerTextDrawShow(playerid, Textdraw[i]);
    }
    Showing[ playerid ] = true;
    return true;
}


HidePlayerRulesTextdraw(playerid)
{
    for(new i = 0; i != sizeof(Textdraw); ++i )
    {
        PlayerTextDrawHide(playerid, Textdraw[i]);
    }
    Showing[ playerid ] = false;
    return true;
}



Re: Textdraw Rule Box - ShaneOvSina - 29.04.2014

Works perfectly for me.
I'm still learning how to use text draws


Re: Textdraw Rule Box - Patrick - 29.04.2014

Quote:
Originally Posted by ShaneOvSina
Посмотреть сообщение
Works perfectly for me.
I'm still learning how to use text draws
The code will not work perfectly if there is another player online, trust me.


Re: Textdraw Rule Box - Yves - 29.04.2014

looks good better if the green was a light black color.


Re: Textdraw Rule Box - Pottus - 29.04.2014

Quote:
Originally Posted by Patrick_
Посмотреть сообщение
The code will not work perfectly if there is another player online, trust me.
It will work fine these are global textdraws that never change playertextdraws is a waste of slots and will result in a greater server load overall. However using loops as suggested is probably a good idea.


Re: Textdraw Rule Box - Patrick - 29.04.2014

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
It will work fine these are global textdraws that never change.
True but what's the purpose of Showing array? I kinda over-reacted I've seen 2 people today declaring vars like this


Re: Textdraw Rule Box - Pottus - 29.04.2014

True but what's the purpose of Showing array? I don't quite follow your question


Re: Textdraw Rule Box - Patrick - 29.04.2014

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
True but what's the purpose of Showing array? I don't quite follow your question
pawn Код:
Showing[ MAX_PLAYERS ];
Talking about this ^, I haven't seen any usage for this and its been used only in 1 function which is the HideTextdraws, or he forgot to finish the code xD

pawn Код:
ShowPlayerRulesTextdraw(playerid)
{
    if(Showing[playerid] == false)
    {
        for(new i = 0; i != sizeof(Textdraw); ++i )
        {
            PlayerTextDrawShow(playerid, Textdraw[i]);
        }
    }
    Showing[ playerid ] = true;
    return true;
}


HidePlayerRulesTextdraw(playerid)
{
    if(Showing[playerid] == true)
    {
        for(new i = 0; i != sizeof(Textdraw); ++i )
        {
            PlayerTextDrawHide(playerid, Textdraw[i]);
        }
    }
    Showing[ playerid ] = false;
    return true;
}



Re: Textdraw Rule Box - Pottus - 29.04.2014

Well yes that is the cleanest way to do it.