[FilterScript] Textdraw Rule Box
#1

Removed
Reply
#2

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/PlayerTex...roundColor
        https://sampwiki.blast.hk/wiki/PlayerTextDrawLetterSize
        https://sampwiki.blast.hk/wiki/PlayerTextDrawColor
        https://sampwiki.blast.hk/wiki/PlayerTextDrawSetOutline
        https://sampwiki.blast.hk/wiki/PlayerTex...oportional
        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;
}
Reply
#3

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

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.
Reply
#5

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

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.
Reply
#7

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
Reply
#8

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

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;
}
Reply
#10

Well yes that is the cleanest way to do it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)