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;
}
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.
|
It will work fine these are global textdraws that never change.
|
True but what's the purpose of Showing array? I don't quite follow your question
![]() |
Showing[ MAX_PLAYERS ];
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;
}