English bot select knife when there are no enemies nearby

4 replies
Goto Page
To the start Previous 1 Next To the start
Up
khaled1968
User
Offline Off
Hi, I was trying to make bots select knife when there are no enemies nearby them, to make bots performance better ofc, so I used this code...

Code:
1
2
3
4
5
6
7
8
9
10
addhook("second","enemycheck")
function enemycheck()
for id=1,32 do
if player(id,"exists") and player(id,"bot") then
if ai_findtarget(id)==0 then
ai_selectweapon(id,50)
end
end
end
end


But the problem is that bots are putting knife ONLY in first time when they spawn, after that, if they faced an enemy they just put there weapons and never bring the knife back again! The code activate only for one time and idk why!
edited 1×, last 07.08.22 02:18:03 am
07.08.22 06:47:29 am
Up
mrc
User
Offline Off
IMG:https://cs2d.com.br/wp-content/uploads/2021/07/cs2dbr.png
07.08.22 10:14:32 am
Up
Gaios
Security Supporter
Offline Off
07.08.22 01:10:07 pm
Up
khaled1968
User
Offline Off
@user mrc: Can you show me an example of it? because it didn't work with me...

@user Gaios: These scripts doesn't have the feature I want.
edited 1×, last 09.08.22 11:27:03 am
07.08.22 03:46:26 pm
Up
LoaderFRA
User
Offline Off
I use this in Standard IA.lua
Code:
1
2
3
4
5
if vai_mode[id]==0 then
          -- ############################################################ 0: IDLE -> decide what to do next
          vai_timer[id]=0; vai_smode[id]=0
          ai_selectweapon(id,50)
          fai_decide(id)
To the start Previous 1 Next To the start