Page 1 of 1

setting player crosshair

Posted: Mon Apr 25, 2016 8:19 am
by D3CEPTION
was looking around at some engine functions and couldnt get this one to work in csgo, but it wasnt marked as such?

Code: Select all

import players
import random
@OnTick
def aa():
   engine_server.crosshair_angle(players.entity.Player(1).edict,random.randint(-90,90),random.randint(0,360))

Re: setting player crosshair

Posted: Mon Apr 25, 2016 10:29 am
by Ayuto
Just tried that method in CS:S and wasn't able to get it working neither. Do you want the player to look at something specific? If yes, the Player class has a few properties to do that (view_angle, view_coordinates, view_player and view_entity).

Re: setting player crosshair

Posted: Mon Apr 25, 2016 10:54 am
by D3CEPTION
it should do the same as set view_angle anyway :/ i was trying to see if i could set view to another entity and yet adopt its crosshairdata.
ofc this would be limited to tickrate, butim generally trying to understand the engine module here, im also wondering why there is this function:

Code: Select all

.def("is_in_edit_mode",
         &IVEngineServer::IsInEditMode,
         "Returns false if the engine is not in hammer editing mode."
      )


i know that its just a return, but if you could set the server into hammer edit mode anywhere, imagine the things that were possible. so i guess, the engine module carries some unusable "left overs" from the sdk regarding source pythons' usage?

Re: setting player crosshair

Posted: Mon Apr 25, 2016 4:44 pm
by Ayuto
D3CEPTION wrote:so i guess, the engine module carries some unusable "left overs" from the sdk regarding source pythons' usage?

Yeah, we just exposed everything that the SDK provides and now slowly remove redundant functions. is_in_edit_mode() is probably a good candidate.