Switching TextDraw string..
#2

pawn Код:
new joinorder = 0;
new JoinText[4][38];

public OnPlayerConnect(playerid)
{
    if(joinorder == 3)
    {
        for(new i = 2; i >= 0; i --)
        {//descending loop starting from 2.
        //This will put whatever it was in 2 at 3, 1 at 2 and 0 at 1.
            TextDrawSetString(JoinPart[i+1], JoinText[i]);
            format(JoinText[i+1], 38, "%s", JoinText[i]);
        }
        joinorder = 0; //reset variable.
       
    }

    format(JoinText[joinorder],38,"~G~JOIN: ~w~%s.", PlayerName(playerid)); //assuming you've got this stock, otherwise create it.
    TextDrawSetString(JoinPart[joinorder], JoinText[joinorder]);
    joinorder ++;

    return 1;
}

public OnPlayerDisconnect(playerid)
{
    if(joinorder == 3)
    {
        for(new i = 2; i >= 0; i --)
        {//descending loop starting from 2.
        //This will put whatever it was in 2 at 3, 1 at 2 and 0 at 1.
            TextDrawSetString(JoinPart[i+1], JoinText[i]);
            format(JoinText[i+1], 38, "%s", JoinText[i]);
        }
        joinorder = 0; //reset variable.

    }

    format(JoinText[joinorder],38,"~r~PART: ~w~%s.", PlayerName(playerid)); //assuming you've got this stock, otherwise create it.
    TextDrawSetString(JoinPart[joinorder], JoinText[joinorder]);
    joinorder ++;

    return 1;
}
You've got to store somewhere each line's text and the text order. When a player connect it sets the first line (Textdraw ID stored at [0]) and then raises the internal order count. The next player that connects will get it at [1] and so on until it reaches the third array ([3]). If that happens then a descending loop will move whatever it was from line 2 to line 3, from line 1 to line 2 and from line 0 to line 1. Then it'll proceed to put the new text on line 0. I haven't tested this.
Reply


Messages In This Thread
Switching TextDraw string.. - by Tayab - 05.02.2014, 03:20
Re: Switching TextDraw string.. - by CuervO - 05.02.2014, 11:50
Re: Switching TextDraw string.. - by Tayab - 06.02.2014, 04:01

Forum Jump:


Users browsing this thread: 1 Guest(s)