Textdraw showing before login box.
#1

Hello. I was wondering if there was a way to show my textdraw before my login dialog. I am using y_ini for my account system. I use a 5 second timer to hide the textdraw. What happens is OnPlayerConnect, the textdraw shows for a second, then the dialog shows, and then the textdraw hides itself.
Reply
#2

Code ?
Reply
#3

pawn Код:
public OnPlayerConnect(playerid)
{
             TextDrawShowForPlayer(playerid, ConnectTD0);
    TextDrawShowForPlayer(playerid, ConnectTD1);
    TextDrawShowForPlayer(playerid, ConnectTD2);
    TextDrawShowForPlayer(playerid, ConnectTD3);
    TextDrawShowForPlayer(playerid, ConnectTD4);
    TextDrawShowForPlayer(playerid, ConnectTD5);
    TextDrawShowForPlayer(playerid, ConnectTD6);
    TextDrawShowForPlayer(playerid, ConnectTD7);
    TextDrawShowForPlayer(playerid, ConnectTD8);
    TextDrawShowForPlayer(playerid, ConnectTD9);
    TextDrawShowForPlayer(playerid, ConnectTD10);
    SetTimerEx("HideTDs",5*1000, 0, "i", playerid);

//other things
new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(fexist(Path(playerid)))
    {
        INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid,LOGIN_DIALOG,DIALOG_STYLE_INPUT,"Login","Enter Your Password Here","Login","Cancel");
    }
    else
    {
        ShowPlayerDialog(playerid,REGISTER_DIALOG,DIALOG_STYLE_INPUT,"Register","Register Your Account Here","Register","Quit");
        return 1;
    }
Reply
#4

It doesnt appear or doesnt hides?
Reply
#5

Quote:
Originally Posted by ikey07
Посмотреть сообщение
It doesnt appear or doesnt hides?
It does both like I want it too. It's that the dialog shows while the TD is showing. I want the TD to show first, then the dialog.
Reply
#6

So make timer for showing dialog.
Reply
#7

When you put a timer under OnPlayerConnect, it doesn't mean that you stopped the connection for a while. Here you go to make what you want:
pawn Код:
public OnPlayerConnect(playerid)
{
    for(new i = 0; i < 20; i ++)
    {
        ShowConnectTextDraws(playerid);
    }
    HideConnectTextDraws(playerid);

    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(fexist(Path(playerid)))
    {
        INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid,LOGIN_DIALOG,DIALOG_STYLE_INPUT,"Login","Enter Your Password Here","Login","Cancel");
    }
    else
    {
        ShowPlayerDialog(playerid,REGISTER_DIALOG,DIALOG_STYLE_INPUT,"Register","Register Your Account Here","Register","Quit");
        return 1;
    }
    return 1;
}

forward ShowConnectTextDraws(playerid);
public ShowConnectTextDraws(playerid)
{
    TextDrawShowForPlayer(playerid, ConnectTD0);
    TextDrawShowForPlayer(playerid, ConnectTD1);
    TextDrawShowForPlayer(playerid, ConnectTD2);
    TextDrawShowForPlayer(playerid, ConnectTD3);
    TextDrawShowForPlayer(playerid, ConnectTD4);
    TextDrawShowForPlayer(playerid, ConnectTD5);
    TextDrawShowForPlayer(playerid, ConnectTD6);
    TextDrawShowForPlayer(playerid, ConnectTD7);
    TextDrawShowForPlayer(playerid, ConnectTD8);
    TextDrawShowForPlayer(playerid, ConnectTD9);
    TextDrawShowForPlayer(playerid, ConnectTD10);
    return 1;
}

forward HideConnectTextDraws(playerid);
public HideConnectTextDraws(playerid)
{
    TextDrawHideForPlayer(playerid, ConnectTD0);
    TextDrawHideForPlayer(playerid, ConnectTD1);
    TextDrawHideForPlayer(playerid, ConnectTD2);
    TextDrawHideForPlayer(playerid, ConnectTD3);
    TextDrawHideForPlayer(playerid, ConnectTD4);
    TextDrawHideForPlayer(playerid, ConnectTD5);
    TextDrawHideForPlayer(playerid, ConnectTD6);
    TextDrawHideForPlayer(playerid, ConnectTD7);
    TextDrawHideForPlayer(playerid, ConnectTD8);
    TextDrawHideForPlayer(playerid, ConnectTD9);
    TextDrawHideForPlayer(playerid, ConnectTD10);
    return 1;
}
You can change the loop number from 20 to 50 as maximum to increase the timer interval, otherwise players will timeout on their connect.
Reply
#8

This solves your problem
pawn Код:
public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid, ConnectTD0);
    TextDrawShowForPlayer(playerid, ConnectTD1);
    TextDrawShowForPlayer(playerid, ConnectTD2);
    TextDrawShowForPlayer(playerid, ConnectTD3);
    TextDrawShowForPlayer(playerid, ConnectTD4);
    TextDrawShowForPlayer(playerid, ConnectTD5);
    TextDrawShowForPlayer(playerid, ConnectTD6);
    TextDrawShowForPlayer(playerid, ConnectTD7);
    TextDrawShowForPlayer(playerid, ConnectTD8);
    TextDrawShowForPlayer(playerid, ConnectTD9);
    TextDrawShowForPlayer(playerid, ConnectTD10);
    SetTimerEx("HideTDs",5*1000, 0, "i", playerid);
    return 1;
}
public HideTDs(playerid)
{
    TextDrawHideForPlayer(playerid, ConnectTD0);
    TextDrawHideForPlayer(playerid, ConnectTD1);
    TextDrawHideForPlayer(playerid, ConnectTD2);
    TextDrawHideForPlayer(playerid, ConnectTD3);
    TextDrawHideForPlayer(playerid, ConnectTD4);
    TextDrawHideForPlayer(playerid, ConnectTD5);
    TextDrawHideForPlayer(playerid, ConnectTD6);
    TextDrawHideForPlayer(playerid, ConnectTD7);
    TextDrawHideForPlayer(playerid, ConnectTD8);
    TextDrawHideForPlayer(playerid, ConnectTD9);
    TextDrawHideForPlayer(playerid, ConnectTD10);
    //other things
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(fexist(Path(playerid)))
    {
        INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid,LOGIN_DIALOG,DIALOG_STYLE_INPUT,"Login","Enter Your Password Here","Login","Cancel");
    }
    else
    {
        ShowPlayerDialog(playerid,REGISTER_DIALOG,DIALOG_STYLE_INPUT,"Register","Register Your Account Here","Register","Quit");
        return 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)