View Single Post
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 04-09-2021 , 10:36   Re: [L4D & L4D2] Left 4 DHooks Direct (1.34) [23-Mar-2021]
Reply With Quote #283

Quote:
Originally Posted by BHaType View Post
23 "[L4D & L4D2] Left 4 DHooks Direct" (1.34) by SilverShot

Spoiler


Edit: I didn't notice it but still need to fix the message

PHP Code:
1.24 (27-Sep-2020)
    - 
Reverted changenative "L4D_GetTeamScore" now accepts values 1 and 2 again
I have no idea which values should be used anymore. I've seen older plugins using both 0/1 and 1/2. I thought the revert fixed this but maybe I overwrote the change, will review again.



Quote:
Originally Posted by Forgetest View Post
PHP Code:
/**
 * @brief Checks if a world position is accessible to a player.
 * @remarks You can pass any client index into this (real or fake players, survivors or special infected).
 * @remarks If the clients flow distance is too far away from the position to test it will return false.
 *
 * @param client    Client id to use for testing
 * @param vecPos    Vector coordinate to test
 *
 * @return            True if accessible, false otherwise
 */
// L4D2 only.
native bool L4D2_IsReachable(int client, const float vecPos[3]); 
Seems crashing server in some cases.
It sometimes happened even when I passed a position of my AbsOrigin.

I was trying to make a L4D2 plugin that fixes entities out of bounds. A partial sample using this is below:

PHP Code:
public void OnVPhysicsUpdatePost(int entity)
{
    if (!
IsValidEntity(entity)) return;
    
    if (
g_hTrackTimer[entity]) delete g_hTrackTimer[entity];
    
g_hTrackTimer[entity] = CreateTimer(0.5Timer_VPhysicsUpdateEndentity);
}

public 
Action Timer_VPhysicsUpdateEnd(Handle timerint entity)
{
    
g_hTrackTimer[entity] = null;
    
    
float vecOrigin[3];
    
GetEntPropVector(entityProp_Send"m_vecOrigin"vecOrigin);
    
    if (
GetVectorLength(vecOrigin) == 0.0)
    {
        return;
    }
    
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && GetClientTeam(i) == && IsPlayerAlive(i))
        {
            if (!
L4D2_IsReachable(ivecOrigin))
            {
                
Stuff(entity);
                return;
            }
        }
    }

Edit: Maybe gamemode related? Was running a scavenge game.
Thanks, this test case causes the server to crash? I did write down a note in my ToDo list about this but haven't had time to check. It might be IsReachable is only good for Survivor bots and not actual players and this is what's causing the crash. I would test by adding IsFakeClient into the list, and only selecting real players if no bots are alive. Will test at some point when I have time.
__________________
Silvers is offline