SA-MP Forums Archive
NPC Compatibility - 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: NPC Compatibility (/showthread.php?tid=367124)



NPC Compatibility - Muhamed.pwn - 08.08.2012

I've made a NPC walking down the street ...

It works but when I try to login it won't show the Login Dialog , also with Registering.

On RequestClass and OnPlayerConnect I Have
pawn Код:
IsPlayerNPC(playerid) return 1;
and it still don't work.


Respuesta: NPC Compatibility - [DOG]irinel1996 - 08.08.2012

The dialog doesn't show for you, or what do you mean, for the NPC or you? xD
Because it shouldn't show for the NPC.


Re: NPC Compatibility - Muhamed.pwn - 08.08.2012

It doesn't show for me


Respuesta: NPC Compatibility - [DOG]irinel1996 - 08.08.2012

May you show me the part where the script shows the dialog, OnPlayerConnect or what else.


Re: NPC Compatibility - Muhamed.pwn - 09.08.2012

On OnPlayerConnect it calls a timer to show the dialog:

pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    if(fexist(UserPath(playerid)))
    {
        ClearChatbox(playerid, 10);
        LoginIntro(playerid);
                IntroTimer = SetTimer("IntroLog",3000,1);
    }
    else
    {
        ClearChatbox(playerid, 10);
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"{F81414}                      Register","Upisi sifru da se registrujeљ.","Register","Odustani");
    }
    return 1;
}
Here is the Timer:
pawn Код:
public IntroLog(playerid)
{
    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","Upisi lozinku da nastavis sa igrom.","Login","Odustani");
    KillTimer(IntroTimer);
    return 1;
}



Re: NPC Compatibility - Muhamed.pwn - 09.08.2012

small bump need help


Respuesta: NPC Compatibility - [DOG]irinel1996 - 09.08.2012

pawn Код:
//---Global variable.
new IntroTimer[MAX_PLAYERS];

//---OnPlayerConnect.
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    if(fexist(UserPath(playerid)))
    {
        ClearChatbox(playerid, 10);
        LoginIntro(playerid);
                IntroTimer[playerid] = SetTimerEx("IntroLog",3000,false,"i",playerid);
    }
    else
    {
        ClearChatbox(playerid, 10);
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"{F81414}                      Register","Upisi sifru da se registrujeљ.","Register","Odustani");
    }
    return 1;
}

//---Callback called.
public IntroLog(playerid)
{
    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); //I don't know if this is correct, never used Y_INI.
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","Upisi lozinku da nastavis sa igrom.","Login","Odustani");
    return 1;
}