Raised This Month: $ Target: $400
 0% 

Change entity owner


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 07-19-2015 , 12:40   Change entity owner
Reply With Quote #1

I need to set entity owner for hegrenade_projectile (CSS)

PHP Code:
int *CHelper::getOwnerEntity(CBaseEntity *pEntity//function is the same for getThrower
{
    
IServerNetworkable *pNetWeapon = ((IServerUnknown *)pEntity)->GetNetworkable();
    
ServerClass *pServerClass pNetWeapon->GetServerClass();
    if (!
pServerClass)
    {
        
g_pSM->LogError(myself"Invalid server class.");
    }

    
sm_sendprop_info_t info;
    if (!
gamehelpers->FindSendPropInfo(pServerClass->GetName(), "m_hOwnerEntity", &info))  // m_hThrower for getThrower
    
{
        
g_pSM->LogError(myself"Could not find m_hOwnerEntity on %s"pServerClass->GetName());
    }
    
    return (
int *)(((intptr_t)pEntity) + info.actual_offset);

Here is the way I change these values:
PHP Code:
    int *owner CHelper::getOwnerEntity(explosion);
    if(
owner) {
        *
owner newowner;
    }
    
int *thrower CHelper::getThrower(explosion);
    if(
thrower) {
        *
thrower newowner;
    } 
But after these manipulations the grenade still remains own to the world (all the player killed by this HE are killed by the world)

Last edited by kadet.89; 07-19-2015 at 12:42.
kadet.89 is offline
Send a message via Skype™ to kadet.89
 



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 12:23.


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