Making bots aim for the head

Please post any questions about developing your plugin here. Please use the search function before posting!
lemeshovich
Junior Member
Posts: 8
Joined: Mon Mar 19, 2018 9:32 pm

Re: Making bots aim for the head

Postby lemeshovich » Fri Mar 23, 2018 2:17 am

thanks for your help especially for comments in code
but my server is crashing now when bots see each other:/
User avatar
Kami
Global Moderator
Posts: 264
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Re: Making bots aim for the head

Postby Kami » Fri Mar 23, 2018 5:05 pm

I just tested my code and it seems to run fine on windows. Not sure why it would crash on linux, sorry :(
lemeshovich
Junior Member
Posts: 8
Joined: Mon Mar 19, 2018 9:32 pm

Re: Making bots aim for the head

Postby lemeshovich » Fri Mar 23, 2018 11:12 pm

i just tested on windows and its working there aswell
but i need that for linux:(
I'm not sure, but it seems to me that the problem is in random.py for linux
but thank you anyway
User avatar
Ayuto
Project Leader
Posts: 2197
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Making bots aim for the head

Postby Ayuto » Fri Mar 23, 2018 11:31 pm

No, it's probably player.view_entity, which is pretty much the same like this issue:
https://github.com/Source-Python-Dev-Te ... issues/233
lemeshovich
Junior Member
Posts: 8
Joined: Mon Mar 19, 2018 9:32 pm

Re: Making bots aim for the head

Postby lemeshovich » Sun Mar 25, 2018 6:47 am

is there any way to avoid it?
User avatar
Ayuto
Project Leader
Posts: 2197
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Making bots aim for the head

Postby Ayuto » Sun Mar 25, 2018 9:09 am

The short term solution is to change PreEvent to Event. Then bots will aim on the head on the second shot.
manico
Junior Member
Posts: 1
Joined: Mon Mar 25, 2019 9:27 pm

Re: Making bots aim for the head

Postby manico » Mon Mar 25, 2019 9:35 pm

Is there any way to make them aim for the head even better? Like they used to do in CS: Source?
son21332
Junior Member
Posts: 2
Joined: Thu Nov 28, 2024 7:05 pm

Re: Making bots aim for the head

Postby son21332 » Fri Nov 29, 2024 1:47 pm

Ayuto wrote:Try this (untested):

Syntax: Select all

import memory

from memory import find_binary, DataType, Convention
from memory.hooks import PostHook
from players.entity import Player
from entities.helpers import pointer_from_index

server = memory.find_binary('server', False)

PICK_AIM_SPOT = server[b'\x55\x89\xE5\x57\x56\x53\x81\xEC\x9C\x00\x00\x00\x8B\x5D\x08\x8B\x0D\x2A\x2A\x2A\x2A\x8B\x83\x70\x5A\x00\x00'].make_function(
Convention.THISCALL,
(DataType.POINTER,),
DataType.VOID
)

@PostHook(PICK_AIM_SPOT)
def post_pick_aim_spot(args, return_value):

playerPointer = args[0]
index = playerPointer.get_ushort(23152)

if (index != -1 and index < 32):

entPointer = pointer_from_index(index)
enemy = memory.make_object(Player, entPointer)
eyeLocation = enemy.eye_location

botProfile = playerPointer.get_pointer(14484)
skillLevel = botProfile.get_float(8)

playerPointer.set_float(eyeLocation[0], 23072)
playerPointer.set_float(eyeLocation[1] - (1 - skillLevel), 23076)
playerPointer.set_float(eyeLocation[2], 23080)

I got an error like this:
Access violation while reading address '37348'.
Can you help me ?
Thank you~
User avatar
Ayuto
Project Leader
Posts: 2197
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Making bots aim for the head

Postby Ayuto » Fri Nov 29, 2024 4:59 pm

On which game are you trying this? The code was made for CS:GO, which does not exist anymore.
son21332
Junior Member
Posts: 2
Joined: Thu Nov 28, 2024 7:05 pm

Re: Making bots aim for the head

Postby son21332 » Fri Nov 29, 2024 5:47 pm

Ayuto wrote:On which game are you trying this? The code was made for CS:GO, which does not exist anymore.

I tried it on CS:GO legacy.
Is there any problem with that version ?

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 5 guests