Всем привет! Хотел бы задать вопрос насчет NPC. Возможно ли как-то посадить NPC в транспорт и что бы он вел его по заданному маршруту?
Страница 1 из 1
[ Pawn ]
NPC
#2
Отправлено 10 апреля 2025 - 21:26

Да, конечно.
Ищешь скрипт npc_record, садишься в транспорт, вводишь команду и едешь по своему маршруту. В конце маршрута останавливаешь запись. Далее, помещаешь маршрут в папку npc. Создаёшь скрипт на основе тех, которые есть. Далее в самом моде подключаешь NPC и выбираешь свой маршрут, как NPC подключается, сажаешь его в необходимый транспорт и он сразу начнёт движение
Ищешь скрипт npc_record, садишься в транспорт, вводишь команду и едешь по своему маршруту. В конце маршрута останавливаешь запись. Далее, помещаешь маршрут в папку npc. Создаёшь скрипт на основе тех, которые есть. Далее в самом моде подключаешь NPC и выбираешь свой маршрут, как NPC подключается, сажаешь его в необходимый транспорт и он сразу начнёт движение
#4
Отправлено 10 апреля 2025 - 21:51

M I S T E V (10 апреля 2025 - 21:26) писал:
Нажмите сюда, чтобы прочитать это сообщение. [Показать]
А вот если маршрут не хочет записываться? Что делать? Я все подключил но не робит
Цитата
//-------------------------------------------------
//
// Recording player data for NPC playback
// Kye 2009
//
//-------------------------------------------------
#pragma tabsize 0
#include <a_samp>
#include <core>
#include <float>
#include "../include/gl_common.inc"
//-------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(!IsPlayerAdmin(playerid)) return 0; // this is an admin only script
// Start recording vehicle data (/vrecord recording_name[])
// Find the recording_name[] file in /scriptfiles/
if(strcmp(cmd, "/vrecord", true) == 0) {
new tmp[512];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF0000FF,"Usage: /vrecord {name}");
return 1;
}
if(!IsPlayerInAnyVehicle(playerid)) {
SendClientMessage(playerid,0xFF0000FF,"Recording: Get in a vehicle.");
return 1;
}
StartRecordingPlayerData(playerid,PLAYER_RECORDING_TYPE_DRIVER,tmp);
SendClientMessage(playerid,0xFF0000FF,"Recording: started.");
return 1;
}
// Start recording onfoot data (/ofrecord recording_name[])
// Find the recording_name[] file in /scriptfiles/
if(strcmp(cmd, "/ofrecord", true) == 0) {
new tmp[512];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF0000FF,"Usage: /ofrecord {name}");
return 1;
}
if(IsPlayerInAnyVehicle(playerid)) {
SendClientMessage(playerid,0xFF0000FF,"Recording: Leave the vehicle and reuse the command.");
return 1;
}
StartRecordingPlayerData(playerid,PLAYER_RECORDING_TYPE_ONFOOT,tmp);
SendClientMessage(playerid,0xFF0000FF,"Recording: started.");
return 1;
}
// Stop recording any data
if(strcmp(cmd, "/stoprecord", true) == 0) {
StopRecordingPlayerData(playerid);
SendClientMessage(playerid,0xFF0000FF,"Recording: stopped.");
return 1;
}
return 0;
}
//-------------------------------------------------
// EOF
//
// Recording player data for NPC playback
// Kye 2009
//
//-------------------------------------------------
#pragma tabsize 0
#include <a_samp>
#include <core>
#include <float>
#include "../include/gl_common.inc"
//-------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(!IsPlayerAdmin(playerid)) return 0; // this is an admin only script
// Start recording vehicle data (/vrecord recording_name[])
// Find the recording_name[] file in /scriptfiles/
if(strcmp(cmd, "/vrecord", true) == 0) {
new tmp[512];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF0000FF,"Usage: /vrecord {name}");
return 1;
}
if(!IsPlayerInAnyVehicle(playerid)) {
SendClientMessage(playerid,0xFF0000FF,"Recording: Get in a vehicle.");
return 1;
}
StartRecordingPlayerData(playerid,PLAYER_RECORDING_TYPE_DRIVER,tmp);
SendClientMessage(playerid,0xFF0000FF,"Recording: started.");
return 1;
}
// Start recording onfoot data (/ofrecord recording_name[])
// Find the recording_name[] file in /scriptfiles/
if(strcmp(cmd, "/ofrecord", true) == 0) {
new tmp[512];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF0000FF,"Usage: /ofrecord {name}");
return 1;
}
if(IsPlayerInAnyVehicle(playerid)) {
SendClientMessage(playerid,0xFF0000FF,"Recording: Leave the vehicle and reuse the command.");
return 1;
}
StartRecordingPlayerData(playerid,PLAYER_RECORDING_TYPE_ONFOOT,tmp);
SendClientMessage(playerid,0xFF0000FF,"Recording: started.");
return 1;
}
// Stop recording any data
if(strcmp(cmd, "/stoprecord", true) == 0) {
StopRecordingPlayerData(playerid);
SendClientMessage(playerid,0xFF0000FF,"Recording: stopped.");
return 1;
}
return 0;
}
//-------------------------------------------------
// EOF
Сообщение отредактировал ArtemDeveloperLime: 10 апреля 2025 - 21:52
Поделиться темой:
Страница 1 из 1