Raised This Month: $51 Target: $400
 12% 

[cstrike] new functions ... reminder for bailopan


  
 
 
Thread Tools Display Modes
Author Message
Ronkkrop
Member
Join Date: May 2004
Old 12-19-2004 , 02:24   [cstrike] new functions ... reminder for bailopan
#1

I found the offsets for shield, and armor type, and they are as follows;

cstrike.h:

Code:
#if !defined __amd64__
	#define OFFSET_SHIELD	510 + EXTRAOFFSET
	#define OFFSET_ARMOR_TYPE	112 + EXTRAOFFSET
#else
	#define OFFSET_SHIELD	559 + EXTRAOFFSET
	#define OFFSET_ARMOR_TYPE	137 + EXTRAOFFSET
#endif

#define HAS_SHIELD		(1<<24) //16777216
cstrike.cpp:
Code:
static cell AMX_NATIVE_CALL cs_get_user_armortype(AMX *amx, cell *params) 
{
	//Returns 0= no armor, 1=vest(kevlar), 2=vesthelm(assaultsuit)
	//simply returns the value at the offset
	//params[1] = user id
	
	// Valid entity should be within range
	CHECK_PLAYER(params[1]);

	// Make into edict pointer
	edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
	
	return *((int *)pPlayer->pvPrivateData + OFFSET_ARMOR_TYPE);
	
}
Code:
static cell AMX_NATIVE_CALL cs_user_has_shield(AMX *amx, cell *params)
{
	//Return 1 if user has a shield.
	//params[1] = user id
	
	//Check player
	CHECK_PLAYER(params[1]);
	
	// Make into edict pointer
	edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
	
	if ((int)*((int *)pPlayer->pvPrivateData + OFFSET_SHIELD) & HAS_SHIELD)
		return 1;

	return 0;	
}
__________________
"I refuse to join any club that would have me as a member."
--Groucho Marx
Ronkkrop is offline
Send a message via ICQ to Ronkkrop Send a message via AIM to Ronkkrop Send a message via MSN to Ronkkrop Send a message via Yahoo to Ronkkrop
BAILOPAN
Join Date: Jan 2004
Old 01-30-2005 , 00:10  
#2

Thanks, these changes have been merged in.
__________________
egg
BAILOPAN 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 02:12.


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