NPC + Spectate + OnPlayerConnect
#1

Hello SA-MP community!

I have a question for y'all. Basically, I'll start off by saying points.

-I have a NPC connecting to the server and (hopefully) doing the path I gave him
-I try to make us spectate the NPC (id: 0) when we are on the logging screen.

Here is the code of my filterscript:
pawn Код:
public OnPlayerConnect(playerid)
{
    if(!IsPlayerNPC(playerid))
    {
        TogglePlayerSpectating(playerid, 1);
        PlayerSpectatePlayer(playerid, 0);
        if ( !INI_Exist( pName( playerid ) ) )
        {
            ShowPlayerDialog( playerid, DIALOG_REG_REQ, DIALOG_STYLE_MSGBOX, "{FFFFFF}Password", "{FFFFFF}To play you must register an account!", "Ok", "");
        }
        else
        {
        ShowPlayerDialog( playerid, DIALOG_LOGIN, DIALOG_STYLE_MSGBOX, "{FFFFFF}Password", "{FFFFFF}Your name is registered, would you like to login?", "Yes", "No");
        }
    }
    return 1;
}
public OnPlayerRequestSpawn( playerid )
{
    if(!IsPlayerNPC(playerid))
    {
        TogglePlayerSpectating(playerid, 0);
        SetTimerEx("LoadFav", 200, false , "i" , playerid );
        SetPlayerPos(playerid, 2181.9321,1682.9525,11.0676);
        SetPlayerFacingAngle(playerid, 91.38);
        SetCameraBehindPlayer(playerid);
        SetPlayerVirtualWorld(playerid, 0);
    }
    return 1;
}
I made the "if(!IsPlayerNPC(playerid))" so the NPC doesn't spectate himself and doesn't go through the logging things. Is something missing so I get it working?

EDIT: Also, what is not working, is that I'm stuck on that logging "camera position" like when you connect to any server, you see the sky and all, I have the loggin things popping up and all, but, it stucks me there after I log in, I'm like not spawning.

The idea behind that is that I will put the NPC or Player in another virtualworld so he can't see the NPC. So, behind the logging screen, it will fly around.


Any help? Thanks!
Reply


Messages In This Thread
NPC + Spectate + OnPlayerConnect - by anumaz - 19.03.2011, 03:04

Forum Jump:


Users browsing this thread: 1 Guest(s)