Raised This Month: $32 Target: $400
 8% 

Private Data


Post New Thread Reply   
 
Thread Tools Display Modes
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 12-20-2004 , 12:12  
Reply With Quote #11

It's weird this actually doesn't work

Code:
void CPlayer::set_user_defuser( bool bValue )
{
	int initialItem = *((int *)pEnt->GetUnknown() + OFFSET_ITEM);
	int initialIcon = *((int *)pEnt->GetUnknown() + OFFSET_ITEM_ICON);

	if( bValue )
	{
		*((int *)pEnt->GetUnknown() + OFFSET_ITEM) &= (1<<0);
		*((int *)pEnt->GetUnknown() + OFFSET_ITEM_ICON) &= (1<<0);
	}
	else
	{
		*((int *)pEnt->GetUnknown() + OFFSET_ITEM) &= ~(1<<0);
		*((int *)pEnt->GetUnknown() + OFFSET_ITEM_ICON) &= ~(1<<0);
	}
}
But it I change the &= to = then it works, but that is basically erasing other data that is in that offset
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
BAILOPAN
Join Date: Jan 2004
Old 12-20-2004 , 12:54  
Reply With Quote #12

You can also do -= probably
__________________
egg
BAILOPAN is offline
Fruchtzwerg
Member
Join Date: Dec 2004
Old 12-20-2004 , 13:18  
Reply With Quote #13

Quote:
Originally Posted by Pimp Daddy
But it I change the &= to = then it works, but that is basically erasing other data that is in that offset
That is because you use int pointers, but the data isn't int. Use the correct data size and it will not change other parameters.
__________________
Fruchtzwerg is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 12-20-2004 , 13:26  
Reply With Quote #14

Quote:
Originally Posted by Fruchtzwerg
Quote:
Originally Posted by Pimp Daddy
But it I change the &= to = then it works, but that is basically erasing other data that is in that offset
That is because you use int pointers, but the data isn't int. Use the correct data size and it will not change other parameters.
How do I determine the correct data size?

this also worked after initial testing:


Code:
void CPlayer::set_user_defuser( bool bValue )
{

	if( bValue )
	{
		*((int *)pEnt->GetUnknown() + OFFSET_ITEM) |= (1<<0);
		*((int *)pEnt->GetUnknown() + OFFSET_ITEM_ICON) |= (1<<0);
	}
	else
	{
		*((int *)pEnt->GetUnknown() + OFFSET_ITEM) -= (1<<0);
		*((int *)pEnt->GetUnknown() + OFFSET_ITEM_ICON) -= (1<<0);
	}
}
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
vancelorgin
Senior Member
Join Date: Dec 2004
Location: san frandisco
Old 12-20-2004 , 16:03  
Reply With Quote #15

Code:
void CPlayer::set_user_defuser(bool bValue){ 
   if(bValue){ 
      *((unsigned long*)pEnt->GetUnknown() + OFFSET_ITEM) |= (1<<0); 
      *((unsigned long*)pEnt->GetUnknown() + OFFSET_ITEM_ICON) |= (1<<0); 
   }else{ 
      *((unsigned long*)pEnt->GetUnknown() + OFFSET_ITEM) &= ~(1<<0); 
      *((unsigned long*)pEnt->GetUnknown() + OFFSET_ITEM_ICON) &= ~(1<<0); 
   } 
}
Use that. Most things are DWORD's =/

(8 bits here because I'm lazy - 8 for BYTE / char, 16 for WORD, 32 for DWORD / int, 64 for QWORD / double)

value<<x shifts value left x times, so
(1<<0) = 00000001
(1<<5) = 00100000

NEG (~) returns the inverse of a value:
~00000001 = 11111110
~01010101 = 10101010

AND (&) results in a value who's bits are only on in both - it, combined with negation, can turn off a bit or bits:
00000001 & 11111110 = 00000000
00101001 & 11111110 = 00101000

OR (|) results in a value who's bits are on in either - it can turn on a bit or bits:
00000001 | 10000000 = 10000001
01010101 | 10101010 = 11111111

XOR (^) results in a value who's bits are only different in both - it, in practice, toggles a bit or bits:
00001001 ^ 00000001 = 00001000
00001000 ^ 00000001 = 00001001

The problem with -= is that it carries over to other bits.
__________________
Avoid like the plague.
vancelorgin is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 12-20-2004 , 19:06  
Reply With Quote #16

sweet thanks vancel

Here are some more nice things Player origin vector and velocity vector (floats):


#define OFFSET_ORIGIN_X 812 // Player Origin in X Axis
#define OFFSET_ORIGIN_Y 813 // Player Origin in Y Axis
#define OFFSET_ORIGIN_Z 814 // Player Origin in Z Axis
#define OFFSET_VELOCITY_X 648
#define OFFSET_VELOCITY_Y 649
#define OFFSET_VELOCITY_Z 650
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
vancelorgin
Senior Member
Join Date: Dec 2004
Location: san frandisco
Old 12-20-2004 , 21:52  
Reply With Quote #17

You may as well just use CBaseEntity dude - you're reversing it when you've already got it defined for you like 2 folders away Everything down to at least rendercolor hasn't changed for CS:S or HL2DM - CBasePlayer works in HL2DM as well - haven't tried in CS:S. I'm also using some of the AI classes for.. uhh.. summoned things (remote control npc_strider, anyone?)
__________________
Avoid like the plague.
vancelorgin is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 12-21-2004 , 08:01  
Reply With Quote #18

Are you talking about using CBasePlayer by pointing to the offset in memory?
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
theqizmo
Member
Join Date: Oct 2004
Old 12-22-2004 , 23:14  
Reply With Quote #19

No, he means use it something like this, this isn't a real life example, just showing you how you would use it;

Code:
PLUGIN_RESULT CPlugin::ClientCommand( edict_t *pEntity )
{
	CBaseEntity *pCBaseEntity = NULL;
	pCBaseEntity = pEntity->GetUnknown()->GetBaseEntity();

	if (pCBaseEntity)
	{
		int iCurrHealth = pCBaseEntity->GetHealth();
		pCBaseEntity->SetHealth(iCurrHealth - 5);
	}
	else
	{
		// Wasn't able to find the pointer
		return PLUGIN_CONTINUE;		
	}
}
theqizmo is offline
Send a message via ICQ to theqizmo Send a message via AIM to theqizmo Send a message via MSN to theqizmo
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 12-22-2004 , 23:34  
Reply With Quote #20

Quote:
Originally Posted by theqizmo
No, he means use it something like this, this isn't a real life example, just showing you how you would use it;

Code:
PLUGIN_RESULT CPlugin::ClientCommand( edict_t *pEntity )
{
	CBaseEntity *pCBaseEntity = NULL;
	pCBaseEntity = pEntity->GetUnknown()->GetBaseEntity();

	if (pCBaseEntity)
	{
		int iCurrHealth = pCBaseEntity->GetHealth();
		pCBaseEntity->SetHealth(iCurrHealth - 5);
	}
	else
	{
		// Wasn't able to find the pointer
		return PLUGIN_CONTINUE;		
	}
}
thats possible? To find the pointer to a class like that?
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Reply


Thread Tools
Display Modes

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:18.


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