Recent posts

#51
Scripting and Server Management / How to unload scripts?
Last post by PSL - Feb 21, 2024, 10:56 AM
I ran some function scripts using dofile, Now I want to deactivate the previous dofile script, what do I do?
#52
Community Plugins / Re: NPC/Bots implementation in...
Last post by PSL - Feb 19, 2024, 02:20 PM
Hi Habi, I am glad to know that you are traveling.  I wish you a fruitful journey and a pleasant and unforgettable trip.
#53
Community Plugins / Re: NPC/Bots implementation in...
Last post by habi2 - Feb 19, 2024, 07:22 AM
Hi PSL, i understand your server console is shutting down once you call ConnectMultipleNpcs function.
Unfortunately, i am on a travel and could not look at the problem.
#54
Script Showroom / Re: Ammunation Ready!
Last post by Hammam - Feb 18, 2024, 01:26 PM
WOOOOOOOOOOOOW
#55
Paste this on your class PlayerClass
=================================================================
class PlayerClass
{
Jlimit = 0;
}
// PASTE THIS ON FUNCTIONS.NUT (IF YOU HAVE) OR SOMEWHERE ELSE IN MAIN.NUT
function Jreset(player)
{
stats[player.ID].Jlimit = 0;
MessagePlayer("[#00FF00]You're now able to use [ [#FF0000]J [#00FF00] ] button!", player);
Announce("You can use J button now!", player, 1);
}
function onKeyDown( player, oldKeys, newKeys )
{
  if( key == J )
    {
      if (stats[player.ID].Jlimit == 3)
       {
        MessagePlayer("[#820000]You're unable to use [#820000][ [#FF0000]J [#820000]] button. Please wait for [#00FF00]5 [#820000]seconds in-order to re-use this key!", player);
return 0;
NewTimer("Jreset", 5000, 1, player.ID);
}
      if( player.Vehicle )
      {
        local vPos   = player.Vehicle.Pos;
        vPos.z = vPos.z * 1.5;
        stats[player.ID].Jlimit += 1;
      }
    return;
    }
  }
#56
Community Plugins / Re: NPC/Bots implementation in...
Last post by PSL - Feb 18, 2024, 06:06 AM
Hi Habi. I started recording perfectly fine, generating hrec and some rec files, and when I did ConnectMultipleNpcs, the main console just shut down.
Here is the link to the file: https://file.io/lWGmWVUgd8ea
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
    }
}
#57
Community Plugins / Re: NPC/Bots implementation in...
Last post by PSL - Feb 17, 2024, 04:24 PM
Hi Habi, I'll try this tomorrow. Thank you for your teaching. I already understand.
#58
Community Plugins / Re: NPC/Bots implementation in...
Last post by habi2 - Feb 17, 2024, 02:35 PM
Hi PSL, the two codes should not be used together. The correct way is
PutServerInRecordingMode("testfile",PLAYER_RECORDING_TYPE_ALL,REC_ALLNAME)
and
StopServerInRecordingMode()
This will automatically start recording data of all players.
Now when you call stop, it finishes recording. You will get testfile.hrec and n rec files, where n is the number of players who was in the server in between PutServerInRecordingMode and StopServerInRecordingMode.
Next use the plugin npc04relxx to start playback. Use
ConnectMultipleNpcs(testfile, "127.0.0.1",7);
which will connect the same 'n' npcs.
Notes
1. Use PutServerInRecordingMode (with flags
REC_ALLNAME) when server is empty. If this function is called when a players are already spawned, the npc when connected will have spawning problem.
#59
Community Plugins / Re: NPC/Bots implementation in...
Last post by PSL - Feb 17, 2024, 11:35 AM
Hi Habi,  I tested the recording option, I captured myself getting on and getting off, it was very successful, recdir 2 was great, the log files were perfectly recorded, there were problems when I tested all the players.
This is the code I did to query the wiki. I will use this feature to record multiplayer races.I will continue to explore the features of this version.I may not be very good at using this feature yet, believe me, I just need a simple example and will learn the additional features in no time.
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?
#60
Community Plugins / Re: NPC/Bots implementation in...
Last post by habi2 - Feb 17, 2024, 09:31 AM
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.
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
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.
Also,
QuoteCorrected API version to 1.6
Windows
Linux x64
Linux x86
rel004
Source-1.8-beta-zip
Setup (Installer)

What's New in v1.8 Beta?

From Release Notes on the wiki:

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.