The npcs fall from their vehicles and respawn back into the vehicles i need help
Код:
//
// A Driver NPC that goes around a path continuously
// Kye 2009
//
#include <a_npc>
#define NUM_PLAYBACK_FILES 3
new gPlaybackFileCycle=0;
//------------------------------------------
main(){}
//------------------------------------------
NextPlayback()
{
// Reset the cycle count if we reach the max
if(gPlaybackFileCycle==NUM_PLAYBACK_FILES) gPlaybackFileCycle = 0;
if(gPlaybackFileCycle==0) {
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"haloplane");
}
else if(gPlaybackFileCycle==1) {
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"haloplane");
}
else if(gPlaybackFileCycle==2) {
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"haloplane");
}
gPlaybackFileCycle++;
}
//------------------------------------------
public OnRecordingPlaybackEnd()
{
NextPlayback();
}
//------------------------------------------
public OnNPCEnterVehicle(vehicleid, seatid)
{
NextPlayback();
}
//------------------------------------------
public OnNPCExitVehicle()
{
StopRecordingPlayback();
gPlaybackFileCycle = 0;
}
//------------------------------------------
Код:
#pragma tabsize 0
#include <a_samp>
new haloplane;
public OnFilterScriptInit()
{
ConnectNPC("Transporter","transporter");
ConnectNPC("haloplane","haloplane");
haloplane = CreateVehicle(511, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}
//-------------------------------------------------
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid)) {
new ip_addr_npc[64+1];
new ip_addr_server[64+1];
GetServerVarAsString("bind",ip_addr_server,64);
GetPlayerIp(playerid,ip_addr_npc,64);
if(!strlen(ip_addr_server)) {
ip_addr_server = "127.0.0.1";
}
if(strcmp(ip_addr_npc,ip_addr_server,true) != 0) {
printf("NPC: Got a remote NPC connecting from %s and I'm kicking it.",ip_addr_npc);
Kick(playerid);
return 0;
}
printf("NPC: Connection from %s is allowed.",ip_addr_npc);
}
return 1;
}
//-------------------------------------------------
public OnPlayerRequestClass(playerid, classid)
{
if(!IsPlayerNPC(playerid)) return 0;
new playername[64];
GetPlayerName(playerid,playername,64);
if(!strcmp(playername,"Transporter",true)) {
SetSpawnInfo(playerid,69,255,1462.0745,2630.8787,10.8203,0.0,-1,-1,-1,-1,-1,-1);
}
else if(!strcmp(playername,"haloplane",true)) {
SetSpawnInfo(playerid,69,255,-1942.7950,168.4164,27.0006,0.0,-1,-1,-1,-1,-1,-1);
}
return 0;
}
//-------------------------------------------------
public OnPlayerSpawn(playerid)
{
if(!IsPlayerNPC(playerid)) return 1;
new playername[64];
GetPlayerName(playerid,playername,64);
if(!strcmp(playername,"Transporter",true)) {
PutPlayerInVehicle(playerid,1,0);
SetPlayerColor(playerid,0xFFFFFFFF);
}
else if(!strcmp(playername,"haloplane",true)) {
PutPlayerInVehicle(playerid, haloplane, 0);
SetPlayerColor(playerid,0xFFFFFFFF);
}
return 1;
}