Quote from: PSL on May 16, 2024, 09:14 AMI'm glad to see WIKI is back.me too.
https://wiki.vc-mp.org/
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: PSL on May 16, 2024, 09:14 AMI'm glad to see WIKI is back.me too.
https://wiki.vc-mp.org/
QuoteThis will return a function object which can be used as if it is the remote function itself.(except of return values)So r will always be true.
npclist<-array(100, false);
function RegisterNPC(playerid, isnpc)
{
npclist[playerid]=isnpc;
}
function OnPlayerStreamIn(playerid)
{
print("I see the " GetPlayerName(playerid) " enter my field of view, and his ID is: " playerid ".");
local r=npclist[playerid];
if(r)print(" He is an npc\n");
}
//--server side//when a new player joins inform all npcs if the player is PC(Playable Character) or NPC(Non Playable Character).
function onPlayerJoin(player)
{
local plr;
for(local i=0;i<GetMaxPlayers();i )
{
plr = FindPlayer(i);
if(plr && plr.IsNPC)
{
//Send information
RFC(i, "RegisterNPC")(player.ID, player.IsNPC);
}
}
//When an npc joins the server send information about all existing Characters (Playable or Non Playable) to it.
if(player.IsNPC)
{
for(local i=0;i<GetMaxPlayers();i++)
{
plr= FindPlayer(i);
if(plr)
RFC(player.ID, "RegisterNPC")(i, plr.IsNPC);
}
}
}
1. IsNPC or IsNPC()
QuoteFixed Npc not able to enter into shipsNow patch1 available for download:
Fixed Server crashing when calling ConnectMultipleNpcs.
Quote from: PSL on Feb 18, 2024, 06:06 AMHi Habi. I started recording perfectly fine, generating hrec and some rec files, and when I did ConnectMultipleNpcs, the main console just shut down.By main console, i assume that you mean the console of npc which opens up was shutdown. The ConnectMultipleNpcs will connect npcs with same name as those players when hrec file was recorded. So from your file, the npc will have name pq. So if your game-name is also pq, those npcs fail to be connected.
Here is the link to the file: https://file.io/lWGmWVUgd8eafunction onPlayerCommand(player,cmd,text)
{
if(cmd=="test2")
{
ConnectMultipleNpcs("testfile","127.0.0.1",7); // Create a recording file and run this command
}
}
QuoteKicking connecting player at ID 1, name already in use.
StartRecordingPlayback(3,"cartest",PLAY_IGNORE_VEHICLEID)
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.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.