create bots with this plugin

Started by habi, May 11, 2020, 12:49 PM

Previous topic - Next topic

Eva


Sebastian

Happy Birthday @habi !!
Wish you the best!

habi

Quote from: Eva on May 18, 2020, 05:35 AMHappy Birthday habi!
thank you Eva

Quote from: Sebastian on May 18, 2020, 01:16 PMHappy Birthday @habi !!
Wish you the best!
thank you Sebastian

umar4911

RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

habi

#34
Post deleted.

habi

hey guys not working for anybody?
You have to put double \\ sometimes.

Also, I will post the source code soon

MEGAMIND

Quote from: habi on May 20, 2020, 12:32 PMhey guys not working for anybody?
You have to put double \\ sometimes.

Also, I will post the source code soon
hey @habi sometimes videos help alot why not a quick video?

habi

hi friends, i am back.

Between i found a way to record player actions.i will be posting it these days.

First, to make this work, we must remove anticheat 0 in server.cfg

Then you need to download EasyHook64.dll and place in server directory( same folder as server.exe and NOT inside plugins folder )

When you want to record player actions, you hook the server, get data, write to file.

Later, while playing we not need to hook server, since hooking server everytime leads to crashing it.

I am working on the codes and the codes are working.

Sebastian

Personally,  simply spawning an actor by using a function is all I need.  Don't know about the others need though
But (again,  personally) since I can apply anims to it,  teleport it where i want,  put it in a car,  I have all I need.
:)

MoveTo function would be something,  but i believe it's harder than it sounds,  since you are struggling with this packets recording

So,  all I can say is: Bravo!

MEGAMIND


habi

#40
Quote from: Sebastian on May 29, 2020, 03:51 PMPersonally,  simply spawning an actor by using a function is all I need.  Don't know about the others need though
But (again,  personally) since I can apply anims to it,  teleport it where i want,  put it in a car,  I have all I need.
MoveTo function would be something,  but i believe it's harder than it sounds,  since you are struggling with this packets recording

So,  all I can say is: Bravo!
hi seby, thanks for the reply.
however, we can't put bots in vehicle now.

Move to function is difficult, but it is in my to-do list( which do not exists :P )


Now, i am releasing linux version of our same old module ( which has been a dream )
Linux 64 bit actor64.so
Linux 32 bit actor32.so
Source code ( a little updated ) https://github.com/habi498/linux-actor

Quote(from first page of this topic)Now, the functions               

create_actor("john");

create_actor("kevin",5); will spawn a medic with name 'kevin'

create_actor("Edward",1,-656,756,11.2,0); will spawn a cop at downtown facing north.

Also, set_port( 8193 ); // if your port is not 8192, but 8193. Note that linux version has no quotes like "8193".

i myself has a linux system and needed this. so created this plugin for linux.

Sebastian


habi



habi

#44
here it is  actor64.dll

The module has few inbuilt commands.

Add the plugin into the 'plugins' folder, run the server and join the game. Go to the beach or whatever place you like and type /rec.
A message will come that 'Recording started'.
When you are done, type /x. The recording will be stopped and saved automatically.

Where can i see the recorded file?
Now you can see a file in your server directory. name of the file == your name.

Save the file( rename or something ). I have renamed one of my recording to pcj stunt, because it was the pcj ramp jump near malibu club.

Ok. How do i play the recording?
You can play recording just after you recorded. ( later also possible if the file exists there)
juse type the command /play

Do i have to script your commands /play, etc?
No, i have scripted it inside the module

What were the commands?
/rec, /x and /play

I have multiple recordings, which file /play takes?
The last one. the last recording. ( technically the recorded file with the name of player who types the command /play)

It crashed my server during recording.
I have recorded a dozen times and once in a while just after you type /rec, a small crash happens. Just restart the server and you will be fine for long. It is a problem with /rec command, which i will try to fix soon.

Functions
create_actor ( you know the parameters. see my first post in the topic )
set_actor_angle( integer actor id, float angle ); // -3.14 < angle < 3.14
set_port( string port )
PlayFile( string recordedFileName, integer actor id ); // an actor must be created first.
GetPlayerIDActor( integer actor id );

Callbacks
function onPlayingCompleted( string recordedFileName, integer actor id )
{
}
this functions is made to call if you use PlayFile function.

Limits
I don't know using bots will affect your server, server ping etc. Just for fun.

Notes
So far with my experiments with these bots, i understood the following things.
1. Player have health 68. You send a packet with health 100, then server not update health.
2. When a player joins the server, the server give him some weapons. Server give the player weapons also through our SetWeapon function. So if we send a packet with weapon id none of these, the player does not acquire the weapon. the server won't give it.
Solution
Before  sending packet with health 100, do player.Health=100;
before sending packet with new weapon, do player.SetWeapon( , )

So what is this packets to do with the recordings?
I just explained the way it works. You might record something with minigun and it might now work. So give the player minigun ( by player.SetWeapon )before playing the recordings.

3. Entering vehicle
If you plan to do some recording with the vehicles, ( you can record stunts, jumps etc. somebody once requested this in forum )
start the recording before entering the vehicle itself. ( we need the vehicle enter event, that is why )
if you start recording after entering the vehicle, it will record. but results are unexpected. the player will fly through roads.
4. vehicle distance and id.
the vehicle must be near the player when playing. Otherwise it is seen that player run( at superman speed ) to the vehicle, open the door get inside and comesback (in a fraction of second) with the vehicle.
I find that vehicle Ids are saved in recordings. So the recorded files contain only ID of vehicle, no other details. if the id is 161, the player grabs the vehicle with id 161. (we can't see the ids)

The server is kicking the player
If you have anticheat enabled, the server watches for health increase, ammo increase, armour increase, new weapon detect etc.
So if between recordings there is a change of health and you are playing it again, then health increase happens and server kicks.
If the problem is serious you can use the onPlayingCompleted callback cleverly. Just put Set Health, SetWeapon functions inside it.

Some cool things
1. Record driving a vehicle. Play it. the bot will drive the vehicle. you can enter inside, and he will drive you through vice city
2. Stunts/ Jumps/ All crazy things can be recorded
3. Shootings with weapon
4. I was thinking the otherday, a pickup is placed somewhere say near bank. player enters the pickup, you know when he enters it, tell an actor to shoot him!

source code c++         hooking thanks

Linux version( without record ) new

Here you cannot record, but can play a recorded file using PlayFile.

actor32.so

actor64.so

for the linux version, port setting takes integer parameter, eg. set_port( 8193 ) if your port is 8193. default port is 8192.