SA-MP Forums Archive
Spawn Textdraw - 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: Spawn Textdraw (/showthread.php?tid=557088)



Spawn Textdraw - lanix - 12.01.2015

I made TextDraw and placed it under each OnPlayerSapwn.
There is problem,every time when player dies TextDraw shows again I would like to show only the first time a player spawn,anybody knows a solution Sorry for bad english.


Re: Spawn Textdraw - Ahmad45123 - 12.01.2015

Quote:
Originally Posted by lanix
Посмотреть сообщение
I made TextDraw and placed it under each OnPlayerSapwn.
There is problem,every time when player dies TextDraw shows again I would like to show only the first time a player spawn,anybody knows a solution Sorry for bad english.
Create a var like "IsPlayerLoggedIn[MAX_PLAYERS]".
And when showing the textdraw check if the variable is 1 and if not make it 1 and show the textdraw.


Re: Spawn Textdraw - RedFusion - 12.01.2015

You might want to use a boolean for this, example:

pawn Код:
new bool: g_IsPlayerTDShown[MAX_PLAYERS char];

public OnPlayerSpawn(playerid)
{
    if(g_IsPlayerTDShown{playerid} == false)
    {
        // show textdraw
        g_IsPlayerTDShown{playerid} = true;
    }
}

public OnPlayerDisconnect(playerid, reason)
{
    g_IsPlayerTDShown{playerid} = false;
}
If you were to show the textdraw at connection, then you wouldn't need a variable for checking if the textdraw has been shown before, though..