ok, i am in csgo.
i do create_fake_client
Code: Select all
newfakeclient = engines.server.engine_server.create_fake_client(name)
bot_ptr = entities.helpers.pointer_from_edict(newfakeclient)
bot = memory.make_object(players.entity.Player, bot_ptr)
i spawn the "Player"
then i listen in on
Code: Select all
@OnPlayerRunCommand
def PlayerRunCommand(player, ucmd):
if player.is_bot():
ucmd.buttons = random.choice([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,PlayerButtons.JUMP])
the issue:
1) this command "seems to work" with playerbuttons.JUMP. but if i replace "JUMP with PlayerButtons.ATTACK, it will not always works.
2) moreover, if i reload the script the ucmd doesn't work at all. ( so it basically only works for the first scriptload after i started the server and only after an unknown amount of time ).
ive found that
https://github.com/Source-Python-Dev-Te ... n.cpp#L360(on scriptload)
is when the runcommandlistener gets assigned to the player
https://github.com/Source-Python-Dev-Te ... s.cpp#L194but i don't know where that usercmd
https://github.com/Source-Python-Dev-Te ... s.cpp#L190comes from, so i am wondering , if i have to initiate/assign a usercmd from sourcepython for the newly create fake_client object.
but idk if the issue is with the usercmd at all.
in the end all i'd want is for @OnPlayerRunCommand to work with create_fake_client correctly.