I can't see my NPC
#1

Hi guys!

This problem, haunts me hours ago.

I add my NPC normally (as I will explain later), but it seems that I was in another virtualworld when I spotted it.

I tried to assign a virtualworld with "SetPlayerVirtualWorld" but it does not work.

Here's my code:

npcmodes/test.pwn
Code:
#define RECORDING "Police_Man" //I have this file in the folder npcmodes/records.
#define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot. (in this case, my NPC going in car)

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
gamemodes/mygm.pwn

Code:
public OnGameModeInit()
{
        ConnectNPC("Police_Man", "test"); 
	NPC_Veh = CreateVehicle(602, 0.0, 0.0, 0.0, 0.0, -1, -1, 5000);  // This variable is declared higher in my code (new NPC_Veh;)
}
Code:
public OnPlayerSpawn(playerid) {
    if(IsPlayerNPC(playerid)) 
	{
	    new npcname[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, npcname, MAX_PLAYER_NAME);
	    if(!strcmp(npcname, "Police_Man", true)) 
	    {
	      SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 0);
	      SetPlayerVirtualWorld(playerid, 0);
	      SetPlayerTeam(playerid, 1);
	      PutPlayerInVehicle(playerid, NPC_Veh, 0); 
	      
	    }
	    return 1;
	}

   // more code..
}
Code:
public OnPlayerConnect(playerid){
      if(IsPlayerNPC(playerid)) return 1;

// more code..
}
Code:
public OnPlayerRequestClass(playerid, classid)
{
        if(IsPlayerNPC(playerid)) return 1;

// more code..
}
server.cfg:

maxnpc 2 Enough since it is a single NPC.

The NPC connects to the server, but as I explained it looks like it's in another virtualworld.
Reply


Messages In This Thread
I can't see my NPC - by alexis2210 - 23.01.2017, 02:00
Re: I can't see my NPC - by Nate4 - 23.01.2017, 04:10
Respuesta: I can't see my NPC - by alexis2210 - 23.01.2017, 19:49
Respuesta: I can't see my NPC - by alexis2210 - 23.01.2017, 20:07

Forum Jump:


Users browsing this thread: 1 Guest(s)