SA-MP Forums Archive
NPC problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: NPC problem (/showthread.php?tid=102594)



NPC problem - ModEddo - 16.10.2009

I posted this on the NPC tutorial thread but it seems that you dont even check it so I'll do it again

I have this problem that the NPC does not even show up.
I dont got any anti cheat or login since I did it on a blank script.
It compiles without a problem. I've checked the server logs and see it has not even connected
I have changed the NPC ammount in the server.cfg but still it does not work.
Any help?
I have read the whole tutorial more than once so dont post anything that read it again, ok?


Re: NPC problem - V1ceC1ty - 16.10.2009

no you havent read the whole of the tutorial.

put the files in the right folders. that means the .rec files in the god damn recordings file.


Re: NPC problem - ModEddo - 16.10.2009

Now I know how you did get your post count.
Reading it does not help me, I do exactly as it is and it still does not work.
Stop the bs about reading it again, thats not helping me at all

Also, read my message. Obviously you havn't
Quote:

I have read the whole tutorial more than once so dont post anything that read it again, ok?

Can someone who actually can help? Answer me


Re: NPC problem - V1ceC1ty - 16.10.2009

wiki.sa-mp.com, read the tutorial it works i used it.


Re: NPC problem - ModEddo - 16.10.2009

Read this, read that, read again...

Now I think the problem is that howto attach the NPC script to the gamemode script
Spare me for "Read the tutorial" since I have


Re: NPC problem - thuron - 16.10.2009

Be sure you have
Код:
if(IsPlayerNPC(playerid)) return 1;
on every line that the npc uses. so onplayerconnect,onplayerspawn and all those. like this:
Код:
public OnPlayerConnect(playerid)
	{
	if(IsPlayerNPC(playerid)) return 1;
//And here the rest of ur stuff
i hope it helped.


Re: NPC problem - V1ceC1ty - 16.10.2009

pawn Код:
public OnGameModeInit()
{
  print("my gamemode");
  ConnectNPC("MyFirstNPC","mynpc");
  return 1;
}
Or, if you are adding the NPC into a filterscript...

pawn Код:
public OnFilterScriptInit()
{
  print("my filterscript");
  ConnectNPC("MyFirstNPC","mynpc");
  return 1;
}



Re: NPC problem - ModEddo - 16.10.2009

Quote:
Originally Posted by thuron
Be sure you have
Код:
if(IsPlayerNPC(playerid)) return 1;
on every line that the npc uses. so onplayerconnect,onplayerspawn and all those. like this:
Код:
public OnPlayerConnect(playerid)
	{
	if(IsPlayerNPC(playerid)) return 1;
//And here the rest of ur stuff
i hope it helped.
READ THE FIRST POST.
I clearly say that no anti cheat or login system

But I shall post it here so you may try to help

Код:
new MyFirstNPCVehicle; //Global variable!
public OnGameModeInit()
{
  print("my gamemode");
  ConnectNPC("ekanpc","auto");
  MyFirstNPCVehicle = CreateVehicle(596, 0.0, 0.0, 5.0, 0.0, 0, 1, 5000);
	// Don't use these lines if it's a filterscript
	AddPlayerClass (280,1546.4946,-1669.2950,13.5667,89.9685,22,9999,25,9999,28,9999); //
	AddPlayerClass (281,1552.4883,-1675.6952,16.1953,86.2085,23,9999,26,9999,29,9999); //
	AddPlayerClass (283,1547.4001,-1681.6907,13.5590,93.1879,24,9999,27,9999,30,9999); //
	AddPlayerClass (111,1513.4779,-1670.4403,14.0469,269.1342,22,9999,25,9999,28,9999); //
	AddPlayerClass (112,1513.0527,-1675.1556,14.0469,282.4823,23,9999,26,9999,29,9999); //
	AddPlayerClass (113,1512.9187,-1679.9777,14.0469,260.4861,24,9999,27,9999,30,9999); //
	AddStaticVehicle (596,1536.0159,-1668.4324,13.3828,359.5500,0,1);
  return 1;
}
This is my OnGameModeInit

Код:
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, "ekanpc", true)) //Checking if the NPC's name is MyFirstNPC
    {
      PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
    }
    return 1;
  }
  //Other stuff for normal players goes here!
  return 1;
}
And this is OnPlayerSpawn
I do have a rec file called auto which on he should drive a car but should a NPC be seed on the score list?
If so whats the problem?


Re: NPC problem - V1ceC1ty - 16.10.2009

NPC's do not show up in the player menu, they do however take up a slot in your server so if you had one npc it would show e.g 0/499


Re: NPC problem - ModEddo - 16.10.2009

Quote:
Originally Posted by √№ceC№ty
NPC's do not show up in the player menu, they do however take up a slot in your server so if you had one npc it would show e.g 0/499
Somethings definetly wrong then, I got 0/5.
Could you take alook in the code if theres a problem?