hi i have a probleme with npc
#1

Hello when I add an NPC who drives a vehicle when I start my server I connect the bot to spawn and reproduce, but not in the vehicle in which he must be the spawn place it in the sky and the sky does not move..

Pic




Код:
#include <a_samp>

new test; // this name in order to find if vou have a bot of 30 in the same script!
public OnGameModeInit()
{

	// NPCS
	ConnectNPC("bot_1","test"); // Connection of your bot, bot_1 is the name and test the name of your bot folder npcmodes!

 	test =	AddStaticVehicle(420,1191.0925,-1325.0585,13.2580,359.6439,6,1); // To create the vehicle to the starting position of the recording taking the position in the savedpositions when you made / save!

	return 1;
}

public OnPlayerSpawn(playerid)
{
    if(!IsPlayerNPC(playerid)) return 0; // We deal only in NPC script will not add any other !!!

	new playername[64];
	GetPlayerName(playerid,playername,64);

 	if(!strcmp(playername,"test",true)) { //Name your recording
        PutPlayerInVehicle(playerid, test, 0); // Idem
        SetSpawnInfo( playerid, 0, 255, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 ); // Leave this default will not change unless you want ^ ^
        ShowPlayerMarkers(0);
	}
    return 1;
}
Reply
#2

Try reading this:

https://sampforum.blast.hk/showthread.php?tid=95034
Reply
#3

with that forum my npc dont connect
Reply
#4

That's because you connect the NPC before you spawn the vehicle.
pawn Код:
public OnGameModeInit()
{
    test =  AddStaticVehicle(420,1191.0925,-1325.0585,13.2580,359.6439,6,1);
    ConnectNPC("bot_1","test");
    return 1;
}
Reply
#5

my bot is in a filterscript not in my game mode
Reply
#6

this should work since its connecting the NPC on spawn first.

pawn Код:
public OnPlayerSpawn(playerid)
{
    ConnectNPC("bot_1","test");
    if(!IsPlayerNPC(playerid)) return 0;          // We deal only in NPC script will not add any other !!!

    new playername[64];
    GetPlayerName(playerid,playername,64);

    if(!strcmp(playername,"test",true)) {         //Name your recording
        PutPlayerInVehicle(playerid, test, 0);    // Idem
                                                  // Leave this default will not change unless you want ^ ^
        SetSpawnInfo( playerid, 0, 255, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
        ShowPlayerMarkers(0);
    }
    return 1;
}
Reply
#7

i put that in fs?
Reply
#8

Quote:
Originally Posted by rive-sud
Посмотреть сообщение
my bot is in a filterscript not in my game mode
pawn Код:
public OnFilterScriptInit()
{
    test =  AddStaticVehicle(420,1191.0925,-1325.0585,13.2580,359.6439,6,1);
    ConnectNPC("bot_1","test");
    return 1;
}
Simple?
Reply
#9

no not work
Reply
#10

pawn Код:
if(!strcmp(playername,"bot_1",true)) { //Name your recording
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)