11#![ allow( unused) ]
22
3+ use rrplug:: bindings:: class_types:: cplayer:: CPlayer ;
34use rrplug:: prelude:: * ;
45use rrplug:: {
56 bindings:: {
@@ -8,7 +9,7 @@ use rrplug::{
89 } ,
910 mid:: utils:: from_char_ptr,
1011} ;
11- use shared:: utils:: lookup_ent;
12+ use shared:: utils:: { is_alive , lookup_ent, nudge_type } ;
1213
1314use crate :: admin_abuse:: completion_append_player_names;
1415use crate :: bindings:: CLIENT_FUNCTIONS ;
@@ -44,6 +45,14 @@ pub fn register_teleport_command(engine_data: &EngineData, token: EngineToken) {
4445 FCVAR_CLIENTDLL as i32 ,
4546 token,
4647 ) ;
48+
49+ _ = engine_data. register_concommand (
50+ "angles" ,
51+ print_player_angles,
52+ "" ,
53+ FCVAR_CLIENTDLL as i32 ,
54+ token,
55+ ) ;
4756}
4857
4958#[ rrplug:: concommand]
@@ -57,6 +66,13 @@ fn print_player_position() -> Option<()> {
5766 None
5867}
5968
69+ #[ rrplug:: concommand]
70+ fn print_player_angles ( ) -> Option < ( ) > {
71+ log:: info!( "angles: catornot should find the function in c_player lol" ) ;
72+
73+ None
74+ }
75+
6076#[ rrplug:: concommand]
6177fn teleport_server_command ( command : CCommandResult ) -> Option < ( ) > {
6278 if command. get_arg ( 1 ) . is_none ( ) {
@@ -84,9 +100,12 @@ fn teleport_server_command(command: CCommandResult) -> Option<()> {
84100 ) )
85101 } )
86102 . find_map ( |( player, name) | {
103+ unsafe {
104+ ( funcs. calc_origin ) ( player, & nudge_type :: < * const CPlayer > ( player) , 0 , 0 ) ;
105+ }
87106 name_target
88107 . starts_with ( name. as_str ( ) )
89- . then_some ( unsafe { * player. get_origin ( & mut v ) } )
108+ . then_some ( player. m_vecAbsOrigin )
90109 } ) ?;
91110
92111 // if unsafe { !(funcs.check_position)(&tp_location).is_null() } {
@@ -97,7 +116,7 @@ fn teleport_server_command(command: CCommandResult) -> Option<()> {
97116 execute_for_matches (
98117 command. get_arg ( 0 ) ,
99118 |player| {
100- if lookup_ent ( player. m_hMoveParent , funcs) . is_none ( ) {
119+ if lookup_ent ( player. m_hMoveParent , funcs) . is_none ( ) && is_alive ( player ) {
101120 unsafe { ( funcs. set_origin ) ( player, & tp_location) }
102121 }
103122 } ,
0 commit comments