NPC Dosn't Connect
#1

I did everything the tutorial said but the bot dosnt connect.
It just says "Incoming Connection"
Код:
    if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
    {
	    new npcname[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
	    if(!strcmp(npcname, "pilotX", true)) //Checking if the NPC's name is MyFirstNPC
	    {
	      print("PilotX Connected");
	    }
	    
    }
I have that in OnPlayerConnect
Reply
#2

Change it to OnPlayerSpawn
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) { //Checks if the player that just spawned is an NPC.
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
        if(!strcmp(npcname, "pilotX", true)) { //Checking if the NPC's name is MyFirstNPC
            print("PilotX Connected");
        }
        return 1;
    }
    //Other stuff for normal players goes here!
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)