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

Allow certain player to walk through closed doors [CSGO]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eNciiik
New Member
Join Date: Oct 2019
Old 07-20-2022 , 14:38   Allow certain player to walk through closed doors [CSGO]
Reply With Quote #1

Hi,
is it possible to allow certain player to walk through closed doors?

We would like to enable this for ghosts on our JailBreak server.

I tried setting doors to ignoredebris and changing player's collision group to debris, but they still collide.
IDK what to do

Last edited by eNciiik; 07-20-2022 at 14:38.
eNciiik is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 07-21-2022 , 09:30   Re: Allow certain player to walk through closed doors [CSGO]
Reply With Quote #2

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

bool IsPlayerGhost[MAXPLAYERS+1] = {false, ...};

public 
void OnPluginStart()
{
    
RegConsoleCmd("ghost"Command_GhostToggle);    
}

public 
void OnMapStart()
{
    
int ent = -1;

    while ((
ent FindEntityByClassname(ent"func_door")) != -1)
        
SDKHook(entSDKHook_ShouldCollideShouldCollide);
    
    while ((
ent FindEntityByClassname(ent"func_door_rotating")) != -1)
        
SDKHook(entSDKHook_ShouldCollideShouldCollide);
    
    while ((
ent FindEntityByClassname(ent"func_lookdoor")) != -1)
        
SDKHook(entSDKHook_ShouldCollideShouldCollide);
    
    while ((
ent FindEntityByClassname(ent"prop_door_rotating")) != -1)
        
SDKHook(entSDKHook_ShouldCollideShouldCollide);
}

public 
void OnEntityCreated(int entity, const char[] classname)
{
    if(
StrEqual(classname"prop_door_rotating"false) || StrEqual(classname"func_lookdoor"false) || StrEqual(classname"func_door_rotating"false) || StrEqual(classname"func_door"false))
        
SDKHook(entitySDKHook_ShouldCollideShouldCollide ); 
}

public 
Action Command_GhostToggle(int clientint args)
{
    
IsPlayerGhost[client] = !IsPlayerGhost[client];
    
    if(
IsPlayerGhost[client])
        
PrintToChat(client"\x01\x02 \x10You have became a ghost");
    else
        
PrintToChat(client"\x01\x02 \x02You are no longer a ghost");
}

int GetClosestPlayerNear(int ent)
{
    
float entPos[3];
    
GetEntPropVector(entProp_Data"m_vecAbsOrigin"entPos);
    
    
float closestDistance 9999999.0;
    
int closestPlayer = -1;
    
    for(
int client 1;client<MaxClients+1;client++)
    {
        if(
IsValidClient(client) && IsPlayerAlive(client))
        {
            
float playerPos[3];
            
GetClientAbsOrigin(clientplayerPos);
    
            
float dist GetVectorDistance(entPosplayerPos);
            if(
dist closestDistance)
            {
                
closestDistance dist;
                
closestPlayer client;
            }
        }
    }
    return 
closestPlayer;
}

public 
bool ShouldCollide(entitycollisiongroupcontentsmaskbool result)
{
    
int player GetClosestPlayerNear(entity);
    
    if(
player != -1)
        if(
IsPlayerGhost[player])
            return 
false;
            
    return 
true;
}

bool IsValidClient(int client

    if (!(
<= client <= MaxClients) || !IsClientConnected(client) || !IsClientInGame(client) || IsClientSourceTV(client) || IsClientReplay(client)) 
        return 
false
         
    return 
true

It's not the best solution but it should be good enough for a ghost dm that works cross source engine games without specfic detour hooks.
backwards is offline
PuNko
Junior Member
Join Date: Apr 2022
Old 11-14-2022 , 19:01   Re: Allow certain player to walk through closed doors [CSGO]
Reply With Quote #3

It works when Ghost is alive, however when i tried to change it and put !IsPlayerAlive it works for dead ghosts, but for alive players aswell, even when they are not “ghosts”, any idea?
PuNko is offline
Reply



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 03:42.


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