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)
+--- Thread: NPC problem (/showthread.php?tid=524766)



NPC problem - vannesenn - 08.07.2014

Hi guys,
I have a problem. When the NPC connect to a server, the server doesn't put him in the vehicle. I see red color of NPC at coords 0.0, 0.0, 0.0


OnPlayerSpawn
Код:
	if(IsPlayerNPC(playerid)) //UKOLIKO JE PRIJAVLJENI IGRAC BOT
	{
	    if(!strcmp(name, "Vozac_Tramvaja", true)) //UKOLIKO JE BOT KOJI VOZI TRAMVAJ
	    {
     		SetPlayerColor(playerid, 0xF00000FF);
     		SetPlayerSkin(playerid, 61);
     		PutPlayerInVehicle(playerid, bot_vozilo, false);
	    }
	    else //UKOLIKO JE TO NEKI DRUGI BOT
	    {
			Ban(playerid);
		}
	}
OnGameModeInit
Код:
	//KREIRANJE BOTOVA
	bot_vozilo = CreateVehicle(449, 0.0, 0.0, 5.0, 0.0, 3, 3, 3600);
	ConnectNPC("Vozac_Tramvaja","tramvaj");
NPC script
Код:
#define RECORDING 				"tramvaj"
#define RECORDING_TYPE 			1

#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



Re: NPC problem - KayJ - 08.07.2014

OnPlayerSpawn
pawn Код:
if(IsPlayerNPC(playerid)) //UKOLIKO JE PRIJAVLJENI IGRAC BOT
{
    if(!strcmp(name, "Vozac_Tramvaja", true)) //UKOLIKO JE BOT KOJI VOZI TRAMVAJ
    {
    SetPlayerColor(playerid, 0xF00000FF);
    SetPlayerSkin(playerid, 61);
        PutPlayerInVehicle(playerid, Vehicle name, 0); // Change Vehicle Name
    }
    else //UKOLIKO JE TO NEKI DRUGI BOT
    {
    Ban(playerid);
    }
   } // Remove if errors
  return 1; //Remove if errors
}//Remove if errors
+rep if helped
Untested



Re: NPC problem - vannesenn - 08.07.2014

That won't help, bot_vozilo tagging train...


Re: NPC problem - AIped - 08.07.2014

might be weird but it worked for me once;

use addstaticvehicle instead of createvehicle


Re: NPC problem - vannesenn - 08.07.2014

Not working... Same problem


Re: NPC problem - AIped - 08.07.2014

is it only vehicle npc's or dont onfoot npcs spawn either ?

if they all dont

put this under onplayerspawn

[pawn]if(!IsPlayerNPC(playerid)) return 1;[pawn]

at onplayerrequestclass use setplayerspawninfo for the npc


Re: NPC problem - vannesenn - 08.07.2014

Still nothing...
My NPC is connected and vehicle is spawned but server isn't put NPC in vehicle(bot_vozilo or bot_vehicle[eng])


Re: NPC problem - vannesenn - 09.07.2014

Someone?


Re: NPC problem - Wizzy951 - 09.07.2014

Quote:
Originally Posted by kc
Посмотреть сообщение
My NPC just stands at the spawnpoint
Go back, and re-do the OnPlayerSpawn part of the tutorial.
You seem to have followed this tutorial, do it exactly the way this guy had explained it.
I used to experience the same problem and re-doing it helped.


Re: NPC problem - vannesenn - 09.07.2014

Doesn't work again.... I don't Know where is a problem