Vice City: Multiplayer

Server Development => Community Plugins => Topic started by: habi on May 11th, 2020, 01:49 PM

Title: create bots with this plugin
Post by: habi on May 11th, 2020, 01:49 PM
This is a squirrel plugin to create bots in the server.
Quote
(https://i.imgur.com/hUrcdoN.png)
Download plugins

actor32.dll(https://drive.google.com/file/d/1OHjTU2tuxVMTn5fnevnHG_e_CwLKmry-/view?usp=sharing)

actor64.dll(https://drive.google.com/file/d/1jCuL_K1SuxUyqgmLUviB02WjzIT_zBMy/view?usp=sharing)

Installation  ( very easy )

Copy the actor64.dll into plugins folder. Open server.cfg find the line plugins, add 'actor64' to the last. see pic below

(https://i.imgur.com/Liq09aJ.jpg)
(https://i.imgur.com/lYArFKR.jpg)
Functions
Only two functions now,
create_actor(name, skinId, x, y, z, angle), set_actor_angle

Examples
Code: [Select]
function onScriptLoad()
{
create_actor( "medic", 5, -656, 756, 11.2, 1.5 );  //5 == ambulance man
create_actor( "emma", 65, -660, 758, 11.2, -1.5 ); 
}

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.

setport("8193"); ( in case your port is not 8192, but 8193 );

Notes
1. actorid and playerid are different.
2. create_actor returns an integer which is 0 for 1st bot, 1 for 2nd bot and so on. We can call it actor id. 
3. create_actor function will take a little time to create bots.
4. If your server has registration system, you must add the bots name to database. Otherwise the bots cannot spawn.

For detailed documentation, see click Source code below and view readme file.

Note: This project was built with Visual Studio 2019.           Source code(https://github.com/habi498/actor-plugin)


Linux Version

64 bit  actor64.so(https://drive.google.com/file/d/16yIFZ7KWuQk7DnuWS18J_6mJJ6gdlUSG/view?usp=sharing)

32 bit  actor32.so(https://drive.google.com/file/d/118kaSJEGPBAYe5Vbs8cisaGqFhX5bFNd/view?usp=sharing)

Source code(https://github.com/habi498/linux-actor)

Functions are same except set_port. The parameter inside set_port must be integer. eg. set_port( 8193 ). Default is 8192.
Title: Re: create bots with this plugin
Post by: habi on May 11th, 2020, 02:37 PM
The bots will have ping 1 or 2.
Title: Re: create bots with this plugin
Post by: MEGAMIND on May 11th, 2020, 02:45 PM
perfection implemented feels like samp bots but with no anims, Finally vcmp is somewhat going towards implementation of bots, nice work habi
Title: Re: create bots with this plugin
Post by: MEGAMIND on May 11th, 2020, 03:33 PM
@habi when anims? or any procedure to make them do anything as we want such as performing a drift on a track which makes bot do it repeatedly such as loop?, would be a greate feature ik its too early to ask but was a great possibility in nodejs :)..Good luck
Title: Re: create bots with this plugin
Post by: habi on May 11th, 2020, 03:46 PM
i think anims already there  megamind. These actors are actually players. Just do player.SetAnim
Title: Re: create bots with this plugin
Post by: habi on May 11th, 2020, 03:55 PM
https://youtu.be/rGWaiE5bh-U
Title: Re: create bots with this plugin
Post by: Sebastian on May 11th, 2020, 04:06 PM
(https://i.imgur.com/7RaZHlu.png)

(https://i.imgur.com/FZWo47f.png)

Yep, they work indeed.
Looks great, @habi !

PS: Now it is posible to make some good looking videos
Title: Re: create bots with this plugin
Post by: habi on May 11th, 2020, 04:09 PM
Quote
Yep, they work indeed.
Looks great, @habi !
Thanks, mate
Title: Re: create bots with this plugin
Post by: Eva on May 11th, 2020, 05:27 PM
How does this work? i have it so far the actor connects but then it times out and my console spammed :D
Title: Re: create bots with this plugin
Post by: habi on May 11th, 2020, 05:36 PM
Quote from Eva on May 11th, 05:27 PM
How does this work? i have it so far the actor connects but then it times out and my console spammed
Eva, post a screenshot
Title: Re: create bots with this plugin
Post by: Eva on May 11th, 2020, 06:29 PM
i did set_port("2005");
then create_actor("Edward",1,-656,756,11.2,0);

(https://i.imgur.com/50dPfrW.png)
Title: Re: create bots with this plugin
Post by: habi on May 11th, 2020, 06:41 PM
Oh. there is a case I avoided, because of some reasons. Your server is pushing this case. Try on blank server for time being.
Title: Re: create bots with this plugin
Post by: Razor. on May 12th, 2020, 05:16 AM
Good work!
Title: Re: create bots with this plugin
Post by: Alpays on May 12th, 2020, 01:01 PM
Quote from Eva on May 11th, 06:29 PM
i did set_port("2005");
then create_actor("Edward",1,-656,756,11.2,0);

(https://i.imgur.com/50dPfrW.png)
Happened to me moved store folder and fixed but Bot didnt spawned deleted some of my codes and bot spawned
Title: Re: create bots with this plugin
Post by: MEGAMIND on May 12th, 2020, 02:39 PM
Quote from Alpays on May 12th, 01:01 PM
Quote from Eva on May 11th, 06:29 PM
i did set_port("2005");
then create_actor("Edward",1,-656,756,11.2,0);

(https://i.imgur.com/50dPfrW.png)
Happened to me moved store folder and fixed but Bot didnt spawned deleted some of my codes and bot spawned
Idk where and what your guy are trying to do but for a basic server or ur server why not try using
Code: [Select]
//commands
case "npc":
{
        create_actor("Edward",45,-656,756,11.2,0);
        set_port("5192");
FindPlayer(1).SetAnim(0,2);
}
        break;
first create the actor then set ports and do whatever u like well this works for me
Title: Re: create bots with this plugin
Post by: habi on May 12th, 2020, 05:34 PM
This problem is finally fixed. New file in main post.
Quote from Alpays on May 12th, 01:01 PM
Quote from Eva on May 11th, 06:29 PM
i did set_port("2005");
then create_actor("Edward",1,-656,756,11.2,0);
Happened to me moved store folder and fixed but Bot didnt spawned deleted some of my codes and bot spawned
yes, the store had something to do with it. fixed now.

Also, Thanks to Eva's Server, which was used for testing.

Title: Re: create bots with this plugin
Post by: MEGAMIND on May 12th, 2020, 10:53 PM
hey what ever skin i try it just doesnt work, it just load my first skin in server which is philcasdy, how do i assign it a playermodel or skin?, ive tried changing skin to custom skin values too but it just loadsup philcasy
Title: Re: create bots with this plugin
Post by: habi on May 13th, 2020, 05:43 AM
Quote from MEGAMIND on May 12th, 10:53 PM
hey what ever skin i try it just doesnt work, it just load my first skin in server which is philcasdy, how do i assign it a playermodel or skin?, ive tried changing skin to custom skin values too but it just loadsup philcasy
Okay megamind do you have x64 system. I made some changes to fix skin, here is 64 bit plugin
actor64(https://drive.google.com/file/d/1jCuL_K1SuxUyqgmLUviB02WjzIT_zBMy/view?usp=sharing)

Try and tell me if it works.
Title: Re: create bots with this plugin
Post by: Eva on May 13th, 2020, 07:32 AM
Here now it connects but it stays in spawnscreen position and is invisible
Title: Re: create bots with this plugin
Post by: habi on May 13th, 2020, 07:39 AM
I will PM you the secret :D
Title: Re: create bots with this plugin
Post by: habi on May 13th, 2020, 09:23 AM
it was because the server won't allow actor to spawn without registering. I had hidden a command in module. it is used to send a command to server ( /cmd text).
So he can use send_cmd( 0, "register pass" ) to make the actor with id 0, registered.
Title: Re: create bots with this plugin
Post by: MEGAMIND on May 13th, 2020, 10:38 AM
Quote from habi on May 13th, 05:43 AM
Quote from MEGAMIND on May 12th, 10:53 PM
hey what ever skin i try it just doesnt work, it just load my first skin in server which is philcasdy, how do i assign it a playermodel or skin?, ive tried changing skin to custom skin values too but it just loadsup philcasy
Okay megamind do you have x64 system. I made some changes to fix skin, here is 64 bit plugin
actor64(https://drive.google.com/file/d/1jCuL_K1SuxUyqgmLUviB02WjzIT_zBMy/view?usp=sharing)

Try and tell me if it works.
yes im using x64 plugin and tried this plugin too same nothing changed
Title: Re: create bots with this plugin
Post by: habi on May 13th, 2020, 11:50 AM
megamind, i updated it
actor64(https://drive.google.com/file/d/1jCuL_K1SuxUyqgmLUviB02WjzIT_zBMy/view?usp=sharing)
Try it.
PS: Is your server online
Title: Re: create bots with this plugin
Post by: MEGAMIND on May 13th, 2020, 12:09 PM
Quote from habi on May 13th, 11:50 AM
megamind, i updated it
actor64(https://drive.google.com/file/d/1jCuL_K1SuxUyqgmLUviB02WjzIT_zBMy/view?usp=sharing)
Try it.
PS: Is your server online
server is online & npc skin still hasnt changed
To connect with me in a more freindly environment catch-me-up on Discord MEGAMIND#8033
Title: Re: create bots with this plugin
Post by: Eva on May 14th, 2020, 06:17 PM
vcmp peds/bots(https://www.youtube.com/watch?v=gpiu2VKTqWA)
Title: Re: create bots with this plugin
Post by: habi on May 15th, 2020, 12:19 PM
nice Eva :) let us see if we can reduce their health
Title: Re: create bots with this plugin
Post by: Xmair on May 15th, 2020, 12:41 PM
Quote from habi on May 15th, 12:19 PM
nice Eva :) let us see if we can reduce their health
That would be pretty hard to be implemented honestly, if you know how the sync in VCMP works. You will have to use the script to decrease it.
Title: Re: create bots with this plugin
Post by: habi on May 17th, 2020, 09:15 PM
@ Xmair, we will discuss that later.

Now something

https://youtu.be/gNMDxUgg06E

It is recording and replay. I have been working on this past 4 days.

I will post the details very soon.( Need to sleep)

btw, today is my birthday !  Thanks.
Title: Re: create bots with this plugin
Post by: MEGAMIND on May 17th, 2020, 10:17 PM
Quote from habi on May 17th, 09:15 PM
@ Xmair, we will discuss that later.

Now something

https://youtu.be/gNMDxUgg06E

It is recording and replay. I have been working on this past 4 days.

I will post the details very soon.( Need to sleep)

btw, today is my birthday !  Thanks.
@habi Happy birthday..
Title: Re: create bots with this plugin
Post by: Gulk2 on May 18th, 2020, 01:11 AM
Nice. Very nice. GOOD STUFF HABI
Title: Re: create bots with this plugin
Post by: Eva on May 18th, 2020, 06:35 AM
Happy Birthday habi!
Title: Re: create bots with this plugin
Post by: Sebastian on May 18th, 2020, 02:16 PM
Happy Birthday @habi !!
Wish you the best!
Title: Re: create bots with this plugin
Post by: habi on May 18th, 2020, 03:46 PM
Quote from Eva on May 18th, 06:35 AM
Happy Birthday habi!
thank you Eva
Quote from Sebastian on May 18th, 02:16 PM
Happy Birthday @habi !!
Wish you the best!
thank you Sebastian
Title: Re: create bots with this plugin
Post by: umar4911 on May 18th, 2020, 04:43 PM
Happy Birthday @habi
Title: Re: create bots with this plugin
Post by: habi on May 19th, 2020, 07:03 PM
Post deleted.
Title: Re: create bots with this plugin
Post by: habi on May 20th, 2020, 01:32 PM
hey guys not working for anybody?
You have to put double \\ sometimes.

Also, I will post the source code soon
Title: Re: create bots with this plugin
Post by: MEGAMIND on May 20th, 2020, 02:30 PM
Quote from habi on May 20th, 01:32 PM
hey 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?
Title: Re: create bots with this plugin
Post by: habi on May 29th, 2020, 04:01 PM
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.
Title: Re: create bots with this plugin
Post by: Sebastian on May 29th, 2020, 04:51 PM
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!
Title: Re: create bots with this plugin
Post by: MEGAMIND on May 29th, 2020, 05:13 PM
awsome
Title: Re: create bots with this plugin
Post by: habi on June 1st, 2020, 07:28 PM
Quote from Sebastian on May 29th, 04:51 PM
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!
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(https://drive.google.com/file/d/16yIFZ7KWuQk7DnuWS18J_6mJJ6gdlUSG/view?usp=sharing)
Linux 32 bit actor32.so(https://drive.google.com/file/d/118kaSJEGPBAYe5Vbs8cisaGqFhX5bFNd/view?usp=sharing)
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.
Title: Re: create bots with this plugin
Post by: Sebastian on June 2nd, 2020, 04:01 PM
Quote from habi on June 1st, 07:28 PM
however, we can't put bots in vehicle now.
Quote from Sebastian on May 11th, 04:06 PM
(https://i.imgur.com/FZWo47f.png)
We can FindPlayer( bot ).Vehicle=somevehicle
Title: Re: create bots with this plugin
Post by: habi on June 3rd, 2020, 10:37 AM
Quote from Sebastian on June 2nd, 04:01 PM
Quote from habi on June 1st, 07:28 PM
however, we can't put bots in vehicle now.
Quote from Sebastian on May 11th, 04:06 PM
(https://i.imgur.com/FZWo47f.png)
We can FindPlayer( bot ).Vehicle=somevehicle
cool.  I thought we could not.
Title: Re: create bots with this plugin
Post by: habi on June 7th, 2020, 11:42 AM
90% completed.
https://youtu.be/dFDqhqHZwT4
Title: Re: create bots with this plugin
Post by: habi on June 8th, 2020, 05:12 PM
here it is  actor64.dll(https://drive.google.com/file/d/1m_csnuqSzkYCjF-3kAN3jb_Odfk7d9gJ/view?usp=sharing)

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.
(https://i.imgur.com/OZZk7ha.jpg)
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++(https://github.com/habi498/Recording-player-actions)         hooking thanks(https://stackoverflow.com/a/62174895/13496065)

Linux version( without record ) new

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

actor32.so(https://drive.google.com/file/d/1Sihe2u_tHlVoreCfnLTJMdyWv2Y6-U_-/view?usp=sharing)

actor64.so(https://drive.google.com/file/d/1YbHfSwdWLSunGq41UOLiRucvoOCQ2P_r/view?usp=sharing)

for the linux version, port setting takes integer parameter, eg. set_port( 8193 ) if your port is 8193. default port is 8192.
Title: Re: create bots with this plugin
Post by: EnForcer on June 8th, 2020, 06:07 PM
Great work keep it up
Using it we can make an army of players and let them fight with each other :D
Title: Re: create bots with this plugin
Post by: Anish87 on June 8th, 2020, 06:13 PM
Superb work habi! I like your work a lot. Another supreme dev for VCMP.
Title: Re: create bots with this plugin
Post by: DizzasTeR on June 9th, 2020, 06:37 AM
Since nobody has said it so far, I'll be the rude one

What you are doing is great sure, but its only great in the sense that VCMP does not have NPC support yet, what you are doing is something people have done before, specifically Shadow with his zombie server if anyone even remembers that.

My point: This plugin will die the moment vcmp gets a new update, sure its all fun and cool for now but unless VCMP stays dead from updates like it was for a decade like in 0.3zR2, all of you are just throwing yourselves in a pit of disappointment later on when this breaks.

It was fine till the just connect the bot part, but it seems like many of the people at this point just want to simulate NPC feature and I'd love seeing the tears later.

TL;DR
Don't work on this too much, this will break upon updates and future security enhancements updates and you are all getting yourself used to a "fake" NPC feature that won't last for too long.
Title: Re: create bots with this plugin
Post by: Xmair on June 9th, 2020, 06:49 AM
Quote from DizzasTeR on June 9th, 06:37 AM
...
To add to this, the reason this will most probably badly break upon updates is because the netcode is changed drastically (as per update logs). It'll be up to you to re-do all of the plugin.
Title: Re: create bots with this plugin
Post by: MEGAMIND on June 9th, 2020, 08:02 AM
Awsome work habi... & i hope u will be able to re-code this plugin after vcmp announces the new update
Title: Re: create bots with this plugin
Post by: Athanatos on June 9th, 2020, 11:23 AM
@DizzasTeR @Xmair Many modern codebases are vulnerable to future requirements ( futureproofing). So that's a normal thing.
Title: Re: create bots with this plugin
Post by: habi on June 11th, 2020, 02:55 PM
Quote from DizzasTeR on June 9th, 06:37 AM
Since nobody has said it so far, I'll be the rude one
No problem.
Quote from DizzasTeR on June 9th, 06:37 AM
What you are doing is great sure, but its only great in the sense that VCMP does not have NPC support yet, what you are doing is something people have done before, specifically Shadow with his zombie server if anyone even remembers that.
Shadow did not make a plugin i think. He made a server and client. I had read that topic before. due to some raknet issues or so, the project was abandoned.

We will see what we can do when updates come. Many cool features can be added.
Title: Re: create bots with this plugin
Post by: habi on June 21st, 2020, 01:43 PM
New functions added-
1. kill_actor( int actorid, int reason, int killer_id, int body_part, bool showanim)
(https://i.imgur.com/Uay5RiF.png)
Examples
(click to show/hide)
kill_actor( actor id );
( equalent to /kill. actor will fell down. and server will show actor  felled to death )

kill_actor( actor id, reason ) ;
same, but you can give server a reason also. like explosion, suicide= reason 70, etc

kill_actor( actorid, reason, killer_id, body_part );
this will tell the server some player killed the actor. head =6, left arm =2, right arm= 3, left leg= 4,
right leg =5, torso= 1, body =0
//reason is a wep id. see weapon(http://wiki.thijn.ovh/index.php?title=Weapons) ids on vcmp wiki
eg. explosion = 41. reason.
kill_actor( actorid, reason, killer_id, body_part, false )
means no animations like headshot. actor will just fell down.


2. spawn_actor( actor id );
After an actor has been killed, use this command to spawn him. He will be spawned where he was last seen.

3. correct_actor_pos( actor id, float x, float y, float z );//use this before set_actor_health to show change in actor position.

4. set_actor_health( actorid, int new health );

if new health is greater than old health, before calling
this function, do player.Health=new health;

new function onActorDeath( actorid )
this gets called when an actor gets killed.
You can do something like this

Code: [Select]
function onActorDeath( actorid )
{
spawn_actor( actorid );
}

actor64.dll ( new )(https://drive.google.com/file/d/1jYwwZsiQfKsUUiXeV1aZrpMTlMtJWT0B/view?usp=sharing)

You can use client side scripting, as i did in killing them.
Title: Re: create bots with this plugin
Post by: Athanatos on June 21st, 2020, 06:11 PM
Lovely.
Title: Re: create bots with this plugin
Post by: Alpays on June 22nd, 2020, 12:48 PM
My server crashes tried in blank server too
Title: Re: create bots with this plugin
Post by: habi on June 22nd, 2020, 04:04 PM
Hi Alpays, could you try this new dll file

actor64.dll(https://drive.google.com/file/d/1gPK1ztyNsM-vL96uZ1v-J8KXVTzsJzlb/view?usp=sharing)

I have disabled certain functions, which interacts with server code.

List of available functions
Code: [Select]
create_actor( ... )
set_actor_angle( ... )
kill_actor(...)
spawn_actor(...)
set_port("..")
PlayFile("filename",actorid)
GetPlayerIDActor( actorid )
IsActor( int playerid )
GetActorID( int playerid )
correct_actor_pos
set_actor_health( int actorid, int newhealth )
Title: Re: create bots with this plugin
Post by: Alpays on June 22nd, 2020, 04:13 PM
Quote from habi on June 22nd, 04:04 PM
Hi Alpays, could you try this new dll file

actor64.dll(https://drive.google.com/file/d/1gPK1ztyNsM-vL96uZ1v-J8KXVTzsJzlb/view?usp=sharing)

I have disabled certain functions, which interacts with server code.

List of available functions
Code: [Select]
create_actor( ... )
set_actor_angle( ... )
kill_actor(...)
spawn_actor(...)
set_port("..")
PlayFile("filename",actorid)
GetPlayerIDActor( actorid )
IsActor( int playerid )
GetActorID( int playerid )
correct_actor_pos
set_actor_health( int actorid, int newhealth )
Thanks you very much working now
Title: Re: create bots with this plugin
Post by: KadirYigit on July 13th, 2020, 07:00 PM
(https://i.hizliresim.com/YjJ6cV.png)



ScriptLoad
|
(click to show/hide)
create_actor( "Barmen", 65, 466.788, -54.2886, 11.4837, 2.3 );
create_actor( "Jale", 22, 475.09, -66.3728, 9.98375, 2.3 );
create_actor( "Asli", 24, 474.805, -64.6814, 9.98375, 3.1 );
create_actor( "Mehmet", 33, 480.05, -63.8481, 9.98375, 2.1 );
create_actor( "Taksici_1", 28, 480.05, -63.8481, 9.98375, 2.1 );
Title: Re: create bots with this plugin
Post by: habi on July 16th, 2020, 02:58 PM
we need to give some time after each create_actor function.

one second delay.

See how i fixed the problem

Code: [Select]
function onScriptLoad()
{
    // server info is printed in the console
    print( "------------------------------------" );
    print( "Server name: " + SRV_NAME );
    if( SRV_PASS != "" ) print( "Password: " + SRV_PASS );
    print( "------------------------------------" );
NewTimer("myfunction",1000,1, "Barmen", 65, 466.788, -54.2886, 11.4837, 2.3 );
NewTimer( "myfunction",2000,1,"Jale", 22, 475.09, -66.3728, 9.98375, 2.3 );
NewTimer( "myfunction",3000,1, "Asli", 24, 474.805, -64.6814, 9.98375, 3.1 );
NewTimer( "myfunction",4000,1, "Mehmet", 33, 480.05, -63.8481, 9.98375, 2.1 );
NewTimer( "myfunction",5000,1, "Taksici_1", 28, 480.05, -63.8481, 9.98375, 2.1 );
}
function myfunction(a,b,c,d,e,f)
{
create_actor(a,b,c,d,e,f);
}

and now..
i have(https://i.imgur.com/CnswiAM.png)
Title: Re: create bots with this plugin
Post by: Athanatos on August 4th, 2020, 03:32 PM
@habi Request permission to write a Squirreil `library` to allow object oriented programming with your library.
Title: Re: create bots with this plugin
Post by: habi on August 4th, 2020, 04:41 PM
Granted.
Title: Re: create bots with this plugin
Post by: gtacheng on August 12th, 2020, 03:40 PM
Hello, how do robots work in other worlds?
Title: Re: create bots with this plugin
Post by: KrooB on August 12th, 2020, 04:19 PM
Quote from GTA-Cheng on August 12th, 03:40 PM
Hello, how do robots work in other worlds?
i think you are trying to set bot's world, just find bot with FindPlayer then set his world
example,
Code: [Select]
if ( cmd == "changeworld" )
{
local plr = FindPlayer(Your ro-bots' nick or id);
plr.World = 512;
}
Title: Re: create bots with this plugin
Post by: SHy^ on August 13th, 2020, 08:27 AM
Quote from KrooB on August 12th, 04:19 PM
Quote from GTA-Cheng on August 12th, 03:40 PM
Hello, how do robots work in other worlds?
i think you are trying to set bot's world, just find bot with FindPlayer then set his world
example,
Code: [Select]
if ( cmd == "changeworld" )
{
local plr = FindPlayer(Your ro-bots' nick or id);
plr.World = 512;
}
btw won't a string will require " in FindPlayer?
e.g FindPlayer("Alex") , correct me if I'm wrong..
Title: Re: create bots with this plugin
Post by: gtacheng on August 29th, 2020, 04:51 AM
How to dance? Not through CMD

 :-\
Title: Re: create bots with this plugin
Post by: habi on August 29th, 2020, 06:43 AM
Code: [Select]
function onScriptLoad()
{
create_actor("emma",65,-688.015, 471.75, 11.0886,0.4);
create_actor("adam",66,-692.949, 471.876, 10.9233,-1.4);
create_actor("mike",74,-691.347, 478.043, 10.9226,-2.7);
}
Code: [Select]
function dance()
{
local plr=FindPlayer(0);
if(plr)plr.SetAnim(28,228);
plr=FindPlayer(1);
if(plr)plr.SetAnim(28,228);
plr=FindPlayer(2);
if(plr)plr.SetAnim(28,228);
}
function onPlayerSpawn(player)
{
dance();
}
the player.SetAnim must be called when each player spawns, otherwise he cannot see them dance.

(https://i.imgur.com/oZe4e0C.png)
Title: Re: create bots with this plugin
Post by: gtacheng on August 29th, 2020, 02:19 PM
Maybe I can think of a way to make the robot walk, which may be very good

Title: Re: create bots with this plugin
Post by: gtacheng on August 29th, 2020, 02:20 PM
I love this robot, he added a lot of fun to my server

:XD
Title: Re: create bots with this plugin
Post by: SHy^ on August 29th, 2020, 02:49 PM
Quote from gtacheng on August 29th, 02:19 PM
Maybe I can think of a way to make the robot walk, which may be very good
Code: [Select]
player.SetAnim
Title: Re: create bots with this plugin
Post by: gtacheng on August 29th, 2020, 04:46 PM
Hello :-\ :-\ :-\
Why does my console crash :-[
Title: Re: create bots with this plugin
Post by: Athanatos on August 29th, 2020, 08:58 PM
Quote from gtacheng on August 29th, 04:46 PM
Hello :-\ :-\ :-\
Why does my console crash :-[
Do you even provide the crash memory adresses: error code atleast?
Title: Re: create bots with this plugin
Post by: gtacheng on August 30th, 2020, 12:37 AM
Exception code c0000005
Title: Re: create bots with this plugin
Post by: gtacheng on August 30th, 2020, 12:51 AM

When I tried to open server64, it crashed. I tried to use it on a blank server, but it still crashed. The exception code is c0000005
 :(

Question signature:

Problem event name: AppCrash

Application Name: Doomsday 64 bit launcher.exe

Application version: 0.0.0.0

Application timestamp: 5b3484ee

Fault module name: actor64.dll

Fault module version: 0.0.0.0

Fault module time stamp: 5ef0c10f

Exception code: c0000005

Anomaly migration: 0.000 million 4896

OS version: 6.1.7601.2.1.0.144.8

Locale ID: 2052

Other information 1: 786a

Other information 2: 786ae44addc7ceabe62209252c44be7c

Other information 3: 842d

Other information 4: 842dfb2743b553716ea2e6d37d96dfa8
 :-[
Title: Re: create bots with this plugin
Post by: gtacheng on August 30th, 2020, 01:55 AM
I'm on the test platform

win 7

win10

The server server 64.exe cannot be opened normally

Open it up and crash again
Title: Re: create bots with this plugin
Post by: habi on August 30th, 2020, 02:56 AM
there is a problem with actor64.dll. it crashes sometimes. I tried to fix it, but couldn't.
I think it is related to 'hooking vcmp server for recvfrom' function.

I will see if i can fix it.

Title: Re: create bots with this plugin
Post by: gtacheng on August 30th, 2020, 03:50 AM
Thank you ! ;D ;D ;D
Title: Re: create bots with this plugin
Post by: habi on September 10th, 2020, 08:01 PM
fixed the bug
Quote from gtacheng on August 29th, 04:46 PM
Hello :-\ :-\ :-\
Why does my console crash :-[
Download
actor64.dll(https://drive.google.com/file/d/1jYwwZsiQfKsUUiXeV1aZrpMTlMtJWT0B/view?usp=sharing)
Title: Re: create bots with this plugin
Post by: MEGAMIND on September 11th, 2020, 07:40 AM
@habi is it yet possible for npc to drive around or make them do a bank rob something relative yet?
Title: Re: create bots with this plugin
Post by: habi on September 11th, 2020, 01:49 PM
megamind, the player actions can be recorded and applied on npc.
Title: Re: create bots with this plugin
Post by: MEGAMIND on September 12th, 2020, 02:49 PM
@habi any resolve to this?
Code: [Select]
-847 function onPlayingCompleted( recordedFileName, actor id )
-848 {
-849 PlayFile(MEGAMIND, 1);
-850 }
(https://cdn.discordapp.com/attachments/710104189665280020/754244096931135528/bandicam_2020-09-12_12-36-25-680.jpg)
theres someproblem with the
Code: [Select]
onPlayingCompleted( recordedFileName, actor id )
actor id, if you dont leave a space then the server runs okay but the file isnt played, ive tried putting an underscore like actor_id and even tried actorid but still file doesnt play so any other method, or if em doing wrong pls provide the full example thanks
Title: Re: create bots with this plugin
Post by: habi on September 12th, 2020, 03:09 PM
it is actually actorid. but for understandability i put the space there as actor id. I will change it.
Full example is like this.
Code: [Select]
function onPlayingCompleted(file,actorid)
{
PlayFile(file, actorid);
}
The parameter names like file not matter. Whichever name can be used.

Also
PlayFile("MEGAMIND", 0); can be used somewhere else if there is a recorded file with your name and one bot available.

I hope this helps
Title: Re: create bots with this plugin
Post by: MEGAMIND on September 12th, 2020, 04:54 PM
Code: [Select]
case "mega":
{
PlayFile("MEGAMIND", 0);
}
        break;
Code: [Select]
function onPlayingCompleted( recordedFileName, actorid )
{
PlayFile("MEGAMIND", 0);
}

working this thing repeats itself, awsome, this can be done with pickups on player cords and active function like in mission
Title: Re: create bots with this plugin
Post by: habi on September 12th, 2020, 05:04 PM
btw, i had made a video.

https://youtu.be/X_lrHyKzQ-0

actor64.dll(https://drive.google.com/file/d/1m_csnuqSzkYCjF-3kAN3jb_Odfk7d9gJ/view?usp=sharing)           actor32.dll(https://drive.google.com/file/d/1KB6TToWk_lqPj4Sj_gHCekZXuNOb_c8v/view?usp=sharing)

Commands: /rec -->start recording

/x ----> Stop recording

/play  -----> play last recording.

output will be saved as a file with name=player name in server directory.
Title: Re: create bots with this plugin
Post by: MEGAMIND on September 12th, 2020, 05:18 PM
i tried puttin the playfile function in onscriptload but its doesnt work until i type /mega to play it :P
Title: Re: create bots with this plugin
Post by: Xmair on September 12th, 2020, 06:48 PM
Quote from MEGAMIND on September 12th, 05:18 PM
i tried puttin the playfile function in onscriptload but its doesnt work until i type /mega to play it :P
Code: [Select]
-847 function onPlayingCompleted( recordedFileName, actor id )
-848 {
-849 PlayFile(MEGAMIND, 1); <---- HERE
-850 }
MEGAMIND isn't defined as a variable or constant anywhere, use "MEGAMIND" (string)
Title: Re: create bots with this plugin
Post by: MEGAMIND on September 12th, 2020, 07:44 PM
Quote from Xmair on September 12th, 06:48 PM
Quote from MEGAMIND on September 12th, 05:18 PM
i tried puttin the playfile function in onscriptload but its doesnt work until i type /mega to play it :P
Code: [Select]
-847 function onPlayingCompleted( recordedFileName, actor id )
-848 {
-849 PlayFile(MEGAMIND, 1); <---- HERE
-850 }
MEGAMIND isn't defined as a variable or constant anywhere, use "MEGAMIND" (string)
Quote from MEGAMIND on September 12th, 04:54 PM
Code: [Select]
case "mega":
{
PlayFile("MEGAMIND", 0);
}
        break;
Code: [Select]
function onPlayingCompleted( recordedFileName, actorid )
{
PlayFile("MEGAMIND", 0);
}

working this thing repeats itself, awsome, this can be done with pickups on player cords and active function like in mission
already done that part
Title: Re: create bots with this plugin
Post by: SHy^ on September 13th, 2020, 11:39 AM
Quote from habi on September 12th, 05:04 PM
btw, i had made a video.

https://youtu.be/X_lrHyKzQ-0

actor64.dll(https://drive.google.com/file/d/1m_csnuqSzkYCjF-3kAN3jb_Odfk7d9gJ/view?usp=sharing)
Commands: /rec -->start recording
/x ----> Stop recording

/play  -----> play last recording.

output will be saved as a file with name=player name in server directory.
That's awsome! :D
Title: Re: create bots with this plugin
Post by: SHy^ on September 13th, 2020, 11:56 AM
After I completed the recording and wrote the command '/play' it returned me nothing but a error on the console:
recv failed with error: 10054
recv failed with error: 10054
recv failed with error: 10054

Although the file is saved, I also tried using exec and onPlayingCompleted function but nothing happened expec for the error codes. Can you tell the solution? @habi

edit: Nenvermind, it just worked only on a blank server.
Title: Re: create bots with this plugin
Post by: habi on September 13th, 2020, 12:59 PM
The port,.. Port of the server. Is it 8192?

Or you have to set it by 'set_port'
Title: Re: create bots with this plugin
Post by: SHy^ on September 13th, 2020, 02:04 PM
Quote from habi on September 13th, 12:59 PM
The port,.. Port of the server. Is it 8192?

Or you have to set it by 'set_port'
It was 8194 but in different (32 bit folder with 64 plugins) folder where the port was 8192 and it did work. Also there's another priblem the server kicks players by reason 'acquired weapon' or ammu increased from 984 to 999. Even if I replay. I also  tried adding 'anticheat 0' in server.cfg but same situation and also the weps were not custom..
Title: Re: create bots with this plugin
Post by: habi on September 13th, 2020, 02:31 PM
(https://i.imgur.com/4Jpsmpf.jpg)
Using anticheat 0 is working for me. First the server kicked the player when health increases from 95 to 100 (during replay..100-->95, 100-->95,..cycle). But after adding 'anticheat 0', the server is not kicking player. I tried with weapons like m4, stubby etc.

check any spelling errors or spaces.
Title: Re: create bots with this plugin
Post by: SHy^ on September 13th, 2020, 02:39 PM
Alright, I'll check the spellings again, there might be problem with spellings. Also do bots only join servers with port 8192?
Title: Re: create bots with this plugin
Post by: habi on September 13th, 2020, 03:02 PM
hi, the plugin use 8192 by default. you can change it by set_port("8193") for example.
Title: Re: create bots with this plugin
Post by: SHy^ on September 13th, 2020, 03:42 PM
Ops my bad, I found the problem, it was actually 'anitcheat 0' so I corrected it :p thanks and ok I'll do it :P
Title: Re: create bots with this plugin
Post by: SHy^ on September 14th, 2020, 05:37 AM
@habi , I found some sort of bug? I tried talking in the chat and the bot did actually the same but if you do repeat with /play , the bot performs same actions but doesn't talk. It only does talk on first play.
Title: Re: create bots with this plugin
Post by: longhackmc on September 14th, 2020, 10:34 AM
Does actor32.dll support the above functions? Or just 64bit. tks
Title: Re: create bots with this plugin
Post by: habi on September 14th, 2020, 01:41 PM
Quote from longhackmc on September 14th, 10:34 AM
Does actor32.dll support the above functions? Or just 64bit. tks
Only 64 bit support it now.
Quote from Shy on September 14th, 05:37 AM
@habi , I found some sort of bug? I tried talking in the chat and the bot did actually the same but if you do repeat with /play , the bot performs same actions but doesn't talk. It only does talk on first play.
I will check
Title: Re: create bots with this plugin
Post by: habi on September 14th, 2020, 06:18 PM
found and fixed
actor64.dll(https://drive.google.com/file/d/1PDN75GI3yaCsxRQoJWCdo8mhFjlh_nxO/view?usp=sharing)     actor32.dll(https://drive.google.com/file/d/1KB6TToWk_lqPj4Sj_gHCekZXuNOb_c8v/view?usp=sharing)

found that each chat message is send with its index number. So while looping( replaying..), the index was starting again from 0. But server is waiting for some index 10 or 11. fixed

current source code(https://github.com/habi498/actor-plugin/blob/master/SQFuncs.cpp)
thanks
Title: Re: create bots with this plugin
Post by: SHy^ on September 14th, 2020, 07:24 PM
Anytime.

P.S: Update the first post with fresh dll file ;D
Title: Re: create bots with this plugin
Post by: longhackmc on September 15th, 2020, 07:11 PM
how to dmg bot?
i tried but the bot was like player.Immunity = 3;
tks for answer.
Title: Re: create bots with this plugin
Post by: Athanatos on September 15th, 2020, 07:54 PM
You need to sync the health in the server's code. Take the onPlayerShot client side function (or whatever it was) send a `damage` packet to the server and then sync the health manually. That's kinda the only way.