function onScriptLoad()
{
PutServerInRecordingMode("testfile",PLAYER_RECORDING_TYPE_ALL,REC_ALLNAME); //This code will be commented when the file is generated
}
function onPlayerPart(player,reason)
{
StopServerInRecordingMode(); //This code will be commented when the file is generated
}
function onPlayerCommand(player,cmd,text)
{
if(cmd=="test2")
{
ConnectMultipleNpcs("testfile","127.0.0.1",7); // Create a recording file and run this command
}
}
PutServerInRecordingMode("testfile",PLAYER_RECORDING_TYPE_ALL,REC_ALLNAME)
andStopServerInRecordingMode()
This will automatically start recording data of all players.ConnectMultipleNpcs(testfile, "127.0.0.1",7);
which will connect the same 'n' npcs.PutServerInRecordingMode("testfile",3,REC_ALLNAME);
StartRecordingPlayerData(PLAYER_RECORDING_TYPE_ALL,60,false); //error in here AN ERROR HAS OCCURED [The recname parameter must be string]
//Should the two codes be used together?
Quote from: PSL on Feb 17, 2024, 04:02 AMI found a problem in testing this version. When I hide an NPC's console, the NPC doesn't join the server.This issue has been fixed. It was related to npc creating logfiles. Logfiles can now be found in folder npcscripts/logs whenever ConnectNPC is called with console parameter false.
ConnectNPC("[NPC]Jack","npcplayback.nut",false,"127.0.0.1","rpclib z-finder"); //Not Join
ConnectNPC("[NPC]Jack","npcplayback.nut",true,"127.0.0.1","rpclib z-finder"); //Join
QuoteCorrected API version to 1.6Windows
Quote
- New Recording Type: Introducing PLAYER_RECORDING_TYPE_ALL for StartRecordingPlayerData, eliminating the need to specify whether the player is on foot or in a vehicle.
- Captured Events: PLAYER_RECORDING_TYPE_ALL now supports capturing various events, including player updates, death, pickup events, checkpoint events, object touch/shot events, player chat, player command, private messages, and ClientScriptData.
- StartRecordingAllPlayerData: A unified function to start recording on all players, including those who may join later.
- Server Recording: Similar to StartRecordingAllPlayerData, but produces an hrec file with player join times and corresponding rec files for replay. Connected players act as NPCs, replicating player actions.
- ConnectMultipleNpcs: Connects multiple NPCs from an hrec file produced by PutServerInRecordingMode.
- recdir Configuration: Introduce recdir 2 in server.cfg to save playback recordings to npcscripts/recordings, with recdir 1 as the default.
- Npcs with Strings: Npcs can now be called with strings, allowing for custom actions like "function OnNPCSpawn(){SendChat("I have spawned");}".
- Logfiles: Each NPC now writes logfiles in the npcscripts folder.
- New NPC Functions: Various new functions added for use by npcscripts, including Suicide, SetMyHealth, GetMyHealth, LookAtPos, LookAtPlayer, GetMyClass, RequestClassAbs, AmISpawned, GetMySkin, GetMyTeam, GetMyArmour, SendPrivMsg, SetConfig, GetPlayerColor, IsPlaybackRunning, IsPlaybackPaused, IsServerInRecordingMode.
- Additional npc04relxx Plugin Functions: KickAllNPC, IsPlayerRecording, StartRecordingAllPlayerData, StopRecordingAllPlayerData, PutServerInRecordingMode, StopServerInRecordingMode, IsServerInRecordingMode.
- Configurable max_npc: Added max_npc in server.cfg, optional and limits the number of NPCs in the server (values: 0 to 100, -1 for any number).
- Console Notifications: Npcs now print their names in the console upon connection, e.g., "Connected. ID: 03 Name: John".
- Bug Fixes: Fixed issues with NPC getting kicked, not holding weapons on spawn, and incorrect angles for newly streamed players.
- Private Messages: NPCs can now send private messages.