Raised This Month: $ Target: $400
 0% 

Get real player view angles


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
karaulov
Senior Member
Join Date: Jul 2018
Old 01-18-2022 , 07:10   Get real player view angles
Reply With Quote #1

Code:
static cell AMX_NATIVE_CALL test_view_angles(AMX* amx, cell* params) // 1 pararam
{
	int index = params[1];
	if (!IsPlayerSafe(index))
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Cannot access player %d, it's not safe enough!", index);
		return 0;
	}

	edict_t* pPlayer = MF_GetPlayerEdict(index);

	char msg[256];
	snprintf(msg, sizeof(msg), "Angle %f %f %f", pPlayer->v.v_angle[0], pPlayer->v.v_angle[1], pPlayer->v.v_angle[2]);

	UTIL_TextMsg(index, msg);

	
	return 0;
}
And

Code:
public PrintViewAngles(Index)
{
	test_view_angles(Index)
	new msg[256];
	new Float:Angles[3];
	pev(Index,pev_v_angle,Angles);
	client_print_color(Index,Index,"Amxx Angles: %f %f %f", Angles[0],Angles[1],Angles[2]);
	get_entvar(Index,var_v_angle,Angles);
	client_print_color(Index,Index,"Amxx Angles 2: %f %f %f", Angles[0],Angles[1],Angles[2]);
}
I got next result:

Metamod module:
Angle 1.664429 -157.615356 0.000000
pev:
Amxx Angles: 1.664428 -106.303710 0.000000
get_entvar:
Amxx Angles 2: 1.664428 -106.303710 0.000000
karaulov is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode