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

SDK Hooks 2.1 - Updated 2011-9-10


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Thraka
AlliedModders Donor
Join Date: Aug 2005
Old 10-19-2010 , 11:33   Re: [EXTENSION] SDK Hooks 1.3 (Updated 2010-05-12)
#901

*sigh*

Is there a hook that could be added for predeath?
Thraka is offline
jameless
Veteran Member
Join Date: Jan 2010
Old 10-19-2010 , 19:51   Re: [EXTENSION] SDK Hooks 1.3 (Updated 2010-05-12)
#902

HookEvent("player_death", PlayerDeath, EventHookMode_Pre)

Do you mean like this?
jameless is offline
Lange
Member
Join Date: Apr 2009
Old 10-20-2010 , 12:00   Re: [EXTENSION] SDK Hooks 1.3 (Updated 2010-05-12)
#903

It seems that FireBullets does not work in TF2. Is there another way to detect when a player shoots, other than TF2_CalcIsAttackCritical() or checking ammo count OnGameFrame()? Is it possible to make FireBullets work, or is it simply not a part of TF2?

Last edited by Lange; 10-20-2010 at 12:13.
Lange is offline
psychonic

BAFFLED
Join Date: May 2008
Old 10-20-2010 , 12:49   Re: [EXTENSION] SDK Hooks 1.3 (Updated 2010-05-12)
#904

Quote:
Originally Posted by Lange View Post
It seems that FireBullets does not work in TF2. Is there another way to detect when a player shoots, other than TF2_CalcIsAttackCritical() or checking ammo count OnGameFrame()? Is it possible to make FireBullets work, or is it simply not a part of TF2?
TF2 doesn't use FireBullets.
psychonic is offline
leonil7
BANNED
Join Date: May 2009
Location: GB
Old 10-21-2010 , 08:49   Re: [EXTENSION] SDK Hooks 1.3 (Updated 2010-05-12)
#905

any gamedata updates for L4D2-linux?
currently some mod that depends on SdHooks crashes the L4D2 linux server.

Quote:
Originally Posted by P4rD0nM3 View Post
When you update a gamedata like sdkhooks.games.txt. Do you just change the map? Or do you need to restart the server?
leonil7 is offline
Send a message via ICQ to leonil7 Send a message via AIM to leonil7 Send a message via Yahoo to leonil7 Send a message via Skype™ to leonil7
psychonic

BAFFLED
Join Date: May 2008
Old 10-21-2010 , 10:15   Re: [EXTENSION] SDK Hooks 1.3 (Updated 2010-05-12)
#906

Quote:
Originally Posted by leonil7 View Post
any gamedata updates for L4D2-linux?
currently some mod that depends on SdHooks crashes the L4D2 linux server.
SDK Hooks gamedata for L4D2 hasn't changed or needed to be changed since the 'The Passing' update.
psychonic is offline
AnIHiL
Member
Join Date: Sep 2009
Old 10-22-2010 , 14:32   Re: [EXTENSION] SDK Hooks 1.3 (Updated 2010-05-12)
#907

Can someone show me how to implement SDKHook_ShouldCollide ?

I have now:
Code:
public Action:Command_abc(client, args)
{
    new bool:ress;
    ress= SDKHookEx(client, SDKHook_ShouldCollide, SDK_ShouldCollide);
    PrintToChat(client, "ress=%i", ress);
}

public Action:SDK_ShouldCollide(entity, &collisiongroup, &contentsmask, &bool:result)
{
    PrintToChatAll("entity=%i collisiongroup=%i contentsmask=%i result=%i", entity, collisiongroup, contentsmask, result);
    
    return Plugin_Handled;
}
When I use on server !abc I get: ress=1. Plugin never enters SDK_ShouldCollide callback.
From source I found that 1 = HookRet_InvalidEntity so why it's bad entity ?
What entity I should use ?
Why it has callback with arguments:
Code:
Action:public(entity, &collisiongroup, &contentsmask, &bool:result)
when on SDK source I found:
Code:
// Called by physics to see if we should avoid a collision test....
    virtual    bool            ShouldCollide( int collisionGroup, int contentsMask ) const;
ShouldCollide function from hl2sdk-ob-valve:
Code:
bool CGameRules::ShouldCollide( int collisionGroup0, int collisionGroup1 )
{
    if ( collisionGroup0 > collisionGroup1 )
    {
        // swap so that lowest is always first
        swap(collisionGroup0,collisionGroup1);
    }

#ifndef HL2MP
    if ( (collisionGroup0 == COLLISION_GROUP_PLAYER || collisionGroup0 == COLLISION_GROUP_PLAYER_MOVEMENT) &&
        collisionGroup1 == COLLISION_GROUP_PUSHAWAY )
    {
        return false;
    }
#endif

    if ( collisionGroup0 == COLLISION_GROUP_DEBRIS && collisionGroup1 == COLLISION_GROUP_PUSHAWAY )
    {
        // let debris and multiplayer objects collide
        return true;
    }
    
    // --------------------------------------------------------------------------
    // NOTE: All of this code assumes the collision groups have been sorted!!!!
    // NOTE: Don't change their order without rewriting this code !!!
    // --------------------------------------------------------------------------

    // Don't bother if either is in a vehicle...
    if (( collisionGroup0 == COLLISION_GROUP_IN_VEHICLE ) || ( collisionGroup1 == COLLISION_GROUP_IN_VEHICLE ))
        return false;

    if ( ( collisionGroup1 == COLLISION_GROUP_DOOR_BLOCKER ) && ( collisionGroup0 != COLLISION_GROUP_NPC ) )
        return false;

    if ( ( collisionGroup0 == COLLISION_GROUP_PLAYER ) && ( collisionGroup1 == COLLISION_GROUP_PASSABLE_DOOR ) )
        return false;

    if ( collisionGroup0 == COLLISION_GROUP_DEBRIS || collisionGroup0 == COLLISION_GROUP_DEBRIS_TRIGGER )
    {
        // put exceptions here, right now this will only collide with COLLISION_GROUP_NONE
        return false;
    }

    // Dissolving guys only collide with COLLISION_GROUP_NONE
    if ( (collisionGroup0 == COLLISION_GROUP_DISSOLVING) || (collisionGroup1 == COLLISION_GROUP_DISSOLVING) )
    {
        if ( collisionGroup0 != COLLISION_GROUP_NONE )
            return false;
    }

    // doesn't collide with other members of this group
    // or debris, but that's handled above
    if ( collisionGroup0 == COLLISION_GROUP_INTERACTIVE_DEBRIS && collisionGroup1 == COLLISION_GROUP_INTERACTIVE_DEBRIS )
        return false;

#ifndef HL2MP
    // This change was breaking HL2DM
    // Adrian: TEST! Interactive Debris doesn't collide with the player.
    if ( collisionGroup0 == COLLISION_GROUP_INTERACTIVE_DEBRIS && ( collisionGroup1 == COLLISION_GROUP_PLAYER_MOVEMENT || collisionGroup1 == COLLISION_GROUP_PLAYER ) )
         return false;
#endif

    if ( collisionGroup0 == COLLISION_GROUP_BREAKABLE_GLASS && collisionGroup1 == COLLISION_GROUP_BREAKABLE_GLASS )
        return false;

    // interactive objects collide with everything except debris & interactive debris
    if ( collisionGroup1 == COLLISION_GROUP_INTERACTIVE && collisionGroup0 != COLLISION_GROUP_NONE )
        return false;

    // Projectiles hit everything but debris, weapons, + other projectiles
    if ( collisionGroup1 == COLLISION_GROUP_PROJECTILE )
    {
        if ( collisionGroup0 == COLLISION_GROUP_DEBRIS || 
            collisionGroup0 == COLLISION_GROUP_WEAPON ||
            collisionGroup0 == COLLISION_GROUP_PROJECTILE )
        {
            return false;
        }
    }

    // Don't let vehicles collide with weapons
    // Don't let players collide with weapons...
    // Don't let NPCs collide with weapons
    // Weapons are triggers, too, so they should still touch because of that
    if ( collisionGroup1 == COLLISION_GROUP_WEAPON )
    {
        if ( collisionGroup0 == COLLISION_GROUP_VEHICLE || 
            collisionGroup0 == COLLISION_GROUP_PLAYER ||
            collisionGroup0 == COLLISION_GROUP_NPC )
        {
            return false;
        }
    }

    // collision with vehicle clip entity??
    if ( collisionGroup0 == COLLISION_GROUP_VEHICLE_CLIP || collisionGroup1 == COLLISION_GROUP_VEHICLE_CLIP )
    {
        // yes then if it's a vehicle, collide, otherwise no collision
        // vehicle sorts lower than vehicle clip, so must be in 0
        if ( collisionGroup0 == COLLISION_GROUP_VEHICLE )
            return true;
        // vehicle clip against non-vehicle, no collision
        return false;
    }

    return true;
}
Collision groups:
Code:
enum Collision_Group_t
{
    COLLISION_GROUP_NONE  = 0,
    COLLISION_GROUP_DEBRIS,            // Collides with nothing but world and static stuff
    COLLISION_GROUP_DEBRIS_TRIGGER, // Same as debris, but hits triggers
    COLLISION_GROUP_INTERACTIVE_DEBRIS,    // Collides with everything except other interactive debris or debris
    COLLISION_GROUP_INTERACTIVE,    // Collides with everything except interactive debris or debris
    COLLISION_GROUP_PLAYER,
    COLLISION_GROUP_BREAKABLE_GLASS,
    COLLISION_GROUP_VEHICLE,
    COLLISION_GROUP_PLAYER_MOVEMENT,  // For HL2, same as Collision_Group_Player, for
                                        // TF2, this filters out other players and CBaseObjects
    COLLISION_GROUP_NPC,            // Generic NPC group
    COLLISION_GROUP_IN_VEHICLE,        // for any entity inside a vehicle
    COLLISION_GROUP_WEAPON,            // for any weapons that need collision detection
    COLLISION_GROUP_VEHICLE_CLIP,    // vehicle clip brush to restrict vehicle movement
    COLLISION_GROUP_PROJECTILE,        // Projectiles!
    COLLISION_GROUP_DOOR_BLOCKER,    // Blocks entities not permitted to get near moving doors
    COLLISION_GROUP_PASSABLE_DOOR,    // Doors that the player shouldn't collide with
    COLLISION_GROUP_DISSOLVING,        // Things that are dissolving are in this group
    COLLISION_GROUP_PUSHAWAY,        // Nonsolid on client and server, pushaway in player code

    COLLISION_GROUP_NPC_ACTOR,        // Used so NPCs in scripts ignore the player.
    COLLISION_GROUP_NPC_SCRIPTED,    // USed for NPCs in scripts that should not collide with each other

    LAST_SHARED_COLLISION_GROUP
};
From: CCollisionProperty
Code:
CBaseEntity::m_CollisionGroup determines which other entities will collide with this one. The rules for which collision groups collide are in CGameRules::ShouldCollide() and can be customized to suit the needs of a particular mod.
This function is testing if one group of entities should colide with other group of entites.

In my it should look like this:
Code:
public bool:SDK_ShouldCollide(collisionGroup0, collisionGroup1)
{
    if ((collisionGroup0 == MY_GROUP_1) && (collisionGroup1 == MY_GROUP_2))
        return true; // collide
}
than I would be able to write my own rules or even overload groups 'cos there are only about 30 groups.

I would be really grateful if someone could manage to create this hook.
AnIHiL is offline
Send a message via MSN to AnIHiL
Hey Koolaid
Junior Member
Join Date: Oct 2010
Location: My computer
Old 10-22-2010 , 15:05   Re: [EXTENSION] SDK Hooks 1.3 (Updated 2010-05-12)
#908

Not to whine and complain but is there any news on a update fix? Thanks.
__________________
When all else fails... Kick the thing until it does it right.

Just kidding.
Hey Koolaid is offline
psychonic

BAFFLED
Join Date: May 2008
Old 10-22-2010 , 15:17   Re: [EXTENSION] SDK Hooks 1.3 (Updated 2010-05-12)
#909

Quote:
Originally Posted by Hey Koolaid View Post
Not to whine and complain but is there any news on a update fix? Thanks.
Not sure what game/update you're talking about, but everything works fine as usual if you're using the correct download and the updated gamedata from a page or two back (also linked on the first post).
psychonic is offline
strontiumdog
Veteran Member
Join Date: Jan 2007
Location: BC, Canada
Old 10-22-2010 , 16:45   Re: [EXTENSION] SDK Hooks 1.3 (Updated 2010-05-12)
#910

@AnIHiL

This works:
PHP Code:
public Action:OnCollide(entity, &collisiongroup, &contentsmask, &bool:result)
{
    
//Check if it's a player
    
if ((contentsmask CONTENTS_TEAM1 == CONTENTS_TEAM1 || contentsmask CONTENTS_TEAM2 == CONTENTS_TEAM2))
    {
        
//Does that player have the flag set to walk through?
        
if (g_noCollide[entity])
        {
            
result false;
            return 
Plugin_Changed;
        }
    }
    
    return 
Plugin_Continue;

I've never seen ShouldCollide used with a bool...only with an Action.
__________________
Plugins | TheVille
Zombie Mod for DoD:S - l4dod.theville.org
strontiumdog is offline
Closed Thread



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


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