Thread: CollisionHook
View Single Post
Mirandor
Senior Member
Join Date: Jun 2006
Location: Ile de France
Old 03-14-2013 , 13:51   Re: CollisionHook
Reply With Quote #15

Works on cs:s but get random crashs...

Code:
#include <sourcemod>
#include <collisionhook>


#define VERSION "1.0"

#pragma semicolon 1

public Plugin:myinfo =
{
    name = "NoCollide using CollisionHook (with Team Filter)",
    author = "",
    description = "Players dont collide with team-mates.",
    version = VERSION,
    url = ""
};

public OnPluginStart()
{
    CreateConVar( "sm_nocollideteam_version", VERSION, "Version of NoCollide Team Filter", FCVAR_PLUGIN | FCVAR_REPLICATED | FCVAR_NOTIFY );
}

public Action:CH_PassFilter( ent1, ent2, &bool:result)
{
    if ( IsValidClient( ent1 ) && IsValidClient( ent2 ) )
        {
        if( GetClientTeam( ent1 ) != GetClientTeam( ent2 ) )
        {
            result = true;
            return Plugin_Handled;
        }
        result = false;
        return Plugin_Handled;
    }
    return Plugin_Continue;
}

stock bool:IsValidClient( client ) 
{
    if ( 0 < client <= MaxClients && IsClientInGame(client) ) 
        return true; 
     
    return false; 
}
SM 1.5dev MM1.10.0dev - linux

Last edited by Mirandor; 03-14-2013 at 14:04.
Mirandor is offline