Start NPC on command.
#1

hello.
I am new so sorry if this is easy.
I have created a npc and he is working.
Now i want if i type for example "start" that the npc will start whit driving.
I have now idea how i should fix that. If you now, can you please help me than.
Thank you.

Code in fs:
Код:
#include <a_samp>
#define COLOR_GREEN 0x33AA33AA

new fast_ls_lv;

public OnGameModeInit()
{

	ConnectNPC ("fast_ls_lv","fast_ls_lv");
//
	fast_ls_lv = AddStaticVehicle(405,2044.8854,1473.2106,10.4494,181.3339,1,0);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	if(!strcmp(playername,"fast_ls_lv",true)) {
	    SetSpawnInfo( playerid, 0, 228, 1958.33, 1343.12, 15.36, 269.15, 31, 1000, 0, 0, 0, 0 );
		PutPlayerInVehicle(playerid, fast_ls_lv, 0);
		SetPlayerColor(playerid,0x494543FF);
		new Text3D:PTD1 = Create3DTextLabel("NPC_fast_ls_lv(ID:17)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	return 1;
}
Code in npc folder:
Код:
#define RECORDING "fast_ls_lv"
#define RECORDING_TYPE 1

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCExitVehicle() StopRecordingPlayback();
EDIT; sorry for my bad english.
Reply
#2

ok that is very simple

just make your start command and under that put

pawn Код:
//your command and under that command put this
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"your recorded file name");// ON_FOOT for on foot npc's
Reply
#3

Like this?
Код:
    if(strcmp(cmdtext, "/start", true) == 0)
    {
        StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"fast_ls_lv");
        SendClientMessageToAll(COLOR_MBLUE, "[NPC] NPC fast_ls_lv is leaving.");
        return 1;
    }
I will test, thank you.
EDIT; if i compile it is says: "error 017: undefined symbol "StartRecordingPlayback" "
I have at the top of my gamemode <a_npc>.
And do you now, how can show always the 'target (place of npc on map' ?
Reply
#4

put it under callback onplayer spawn
pawn Код:
if (IsPlayerNPC(playerid))
{
SetPlayerColor(playerid, color);// to find npc set their color to unused color in game
}
Reply
#5

Quote:
Originally Posted by jiwan
Посмотреть сообщение
put it under callback onplayer spawn
pawn Код:
if (IsPlayerNPC(playerid))
{
SetPlayerColor(playerid, color);// to find npc set their color to unused color in game
}
Allride, and that error? Do you now how to fix it?
Reply
#6

which error ??

if any post here!
Reply
#7

Quote:
Originally Posted by jiwan
Посмотреть сообщение
which error ??

if any post here!
Код:
C:\Program Files (x86)\Rockstar Games\GTA Server\gamemodes\v1.6.pwn(445) : error 017: undefined symbol "StartRecordingPlayback"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#8

have you done #include a_npc
Reply
#9

Quote:
Originally Posted by jiwan
Посмотреть сообщение
have you done #include a_npc
I did, my code:
Код:
#include <a_samp>
#include <a_npc>
#include <core>
#include <float>
//----------------------------------------------------------

#define COLOR_WHITE 		0xFFFFFFFF
#define COLOR_NORMAL_PLAYER 0xFF4444FF

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/start", true) == 0)
    {
        StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"fast_ls_lv");
        SendClientMessageToAll(COLOR_WHITE, "[NPC] NPC fast_ls_lv is leaving.");
        return 1;
    }
	return 0;
}
My error
Код:
C:\Program Files (x86)\Rockstar Games\GTA Server\npc.pwn(14) : error 017: undefined symbol "StartRecordingPlayback"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#10

update your includes(maybe)

it works for me fine
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)