Spawn Textdraw
#1

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)