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

[L4D & L4D2] Left 4 DHooks Direct (1.144) [05-Mar-2024]


Post New Thread Reply   
 
Thread Tools Display Modes
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 04-06-2021 , 03:42   Re: [L4D & L4D2] Left 4 DHooks Direct (1.34) [23-Mar-2021]
Reply With Quote #281

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
__________________
cry

Last edited by BHaType; 04-06-2021 at 03:54.
BHaType is offline
Send a message via AIM to BHaType
Forgetest
Member
Join Date: Aug 2020
Old 04-09-2021 , 06:32   Re: [L4D & L4D2] Left 4 DHooks Direct (1.34) [23-Mar-2021]
Reply With Quote #282

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.

Last edited by Forgetest; 04-09-2021 at 07:26.
Forgetest is offline
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
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-09-2021 , 13:05   Re: [L4D & L4D2] Left 4 DHooks Direct (1.34) [23-Mar-2021]
Reply With Quote #284

Silvers, I think he means the text displayed in the error stack.
Quote:
Accepted values: 0 or 1.
Must be:
Quote:
Accepted values: 1 or 2.
I worked with those recently. It was a bit of madness for novice.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Forgetest
Member
Join Date: Aug 2020
Old 04-09-2021 , 13:53   Re: [L4D & L4D2] Left 4 DHooks Direct (1.34) [23-Mar-2021]
Reply With Quote #285

Quote:
Originally Posted by Silvers View Post
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.
To save you time, I ran the test regarding your hints about using only fake client indexes, and it proved that you're right.
Both survivor bots and infected bots are fine to be used (as well as world index, but seems retuning no false). However, server immediately crashed when I tried to target real client.

There's another weird scenario though. I was thinking the position may be the issue, so I created a command to test some origins and mine, whilst using my index. And it'd seldom crashed the server if I was self-testing.
Forgetest is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 04-10-2021 , 14:06   Re: [L4D & L4D2] Left 4 DHooks Direct (1.35) [10-Apr-2021]
Reply With Quote #286

Code:
1.35 (10-Apr-2021)
    - Fixed native "L4D_GetTeamScore" error message when using the wrong team values. Thanks to "BHaType" for reporting.
    - Restricted native "L4D2_IsReachable" client index to bots only. Attempts to find a valid bot otherwise it will throw an error. Thanks to "Forgetest" for reporting.
__________________
Silvers is offline
GoGetSomeSleep
Senior Member
Join Date: Dec 2018
Location: Miami/Florida
Old 04-11-2021 , 12:07   Re: [L4D & L4D2] Left 4 DHooks Direct (1.35) [10-Apr-2021]
Reply With Quote #287

how to make useful with this? https://forums.alliedmods.net/showthread.php?t=128581 or any alterantives?
GoGetSomeSleep is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 04-13-2021 , 09:29   Re: [L4D & L4D2] Left 4 DHooks Direct (1.35) [10-Apr-2021]
Reply With Quote #288

Quote:
Originally Posted by GoGetSomeSleep View Post
how to make useful with this? https://forums.alliedmods.net/showthread.php?t=128581 or any alterantives?
I done this for someone a while back:

Quote:
To make the srs mod scripts work with Left4DHooks, modify the following in all files where found:
Change "#include <left4downtown>" to "#include <left4dhooks>"
Change "left4downtown.l4d2" to "left4dhooks.l4d2"

Due to new reserved keywords:
In "versioning.sp" changed "throw" to "throww"
In "debug.sp" changed "in" to "inn"
I think that's the only stuff required.
__________________

Last edited by Silvers; 04-13-2021 at 09:29.
Silvers is offline
Gold Fish
Senior Member
Join Date: Mar 2020
Old 04-14-2021 , 12:52   Re: [L4D & L4D2] Left 4 DHooks Direct (1.35) [10-Apr-2021]
Reply With Quote #289

crashes the server after use L4D_FindRandomSpot

l4d2
SourceMod Version: 1.10.0.6502
Metamod:Source version 1.11.0-dev+1144

Code:
CRASH: Wed Apr 14 19:49:31 MSK 2021
Start Line: ./srcds_linux -game left4dead2 +map c2m1_highway -ip 46.174.48.18 -port 27220 +tv_port 37220 -maxplayers 8 -nobots +sv_pure 0 -debug -tickrate 66 -timeout 60 +fps_max 500 -console -usercon -noipx -norestart -net_port_try 1 -pidfile ../game.pid
[New LWP 10647]
[New LWP 10666]
[New LWP 13058]
[New LWP 10665]
[New LWP 13060]
[New LWP 13086]
[New LWP 16500]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `./srcds_linux -game left4dead2 +map c2m1_highway -ip 46.174.48.18 -port 27220 +'.
Program terminated with signal 11, Segmentation fault.
#0  0xede8ac42 in CTerrorPlayer::UpdateActiveSet(CNavArea*, CNavArea*) () from /game/left4dead2/bin/server_srv.so
#0  0xede8ac42 in CTerrorPlayer::UpdateActiveSet(CNavArea*, CNavArea*) () from /game/left4dead2/bin/server_srv.so
#1  0xede8f188 in CTerrorPlayer::ChangeTeam(int) () from /game/left4dead2/bin/server_srv.so
#2  0xede847e4 in CTerrorPlayer::TakeOverBot(bool) () from /game/left4dead2/bin/server_srv.so
#3  0xedd35e5d in CDirector::TryToTakeOverCharacter(DirectorNewPlayerType_t&, SurvivorCharacterType) () from /game/left4dead2/bin/server_srv.so
#4  0xedd38208 in CDirector::JoinNewPlayer(DirectorNewPlayerType_t&) () from /game/left4dead2/bin/server_srv.so
#5  0xedd73efb in CDirectorSessionManager::UpdateNewPlayers() () from /game/left4dead2/bin/server_srv.so
#6  0xedd74a1d in CDirectorSessionManager::UpdateSession() () from /game/left4dead2/bin/server_srv.so
#7  0xedd40ce4 in CDirector::Update() () from /game/left4dead2/bin/server_srv.so
UPD:

found an error

instead
PHP Code:
StartPrepSDKCall(SDKCall_Raw);
    if( 
PrepSDKCall_SetFromConf(hGameDataSDKConf_Signature"FindRandomSpot") == false )
    {
        
LogError("Failed to find signature: FindRandomSpot");
    } else {
        
PrepSDKCall_AddParameter(SDKType_VectorSDKPass_ByRef_VENCODE_FLAG_COPYBACK);
        
g_hSDK_Call_FindRandomSpot EndPrepSDKCall();
        if( 
g_hSDK_Call_FindRandomSpot == null )
            
LogError("Failed to create SDKCall: FindRandomSpot");
    } 
wrote

PHP Code:
StartPrepSDKCall(SDKCall_Raw);
    if( 
PrepSDKCall_SetFromConf(hGameDataSDKConf_Signature"FindRandomSpot") == false )
    {
        
LogError("Failed to find signature: FindRandomSpot");
    } else {
        
PrepSDKCall_SetReturnInfo(SDKType_VectorSDKPass_ByValue);
        
g_hSDK_Call_FindRandomSpot EndPrepSDKCall();
        if( 
g_hSDK_Call_FindRandomSpot == null )
            
LogError("Failed to create SDKCall: FindRandomSpot");
    } 
judging by the disassembled code:
Spoiler



the function must return float [3] and not accept it as an argument, (Silvers, please correct your code)
__________________
-

PHP Code:
public OnClientConnect(int Client) {
    
KickClient(Client"sorry");


Last edited by Gold Fish; 04-14-2021 at 16:01.
Gold Fish is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-15-2021 , 10:31   Re: [L4D & L4D2] Left 4 DHooks Direct (1.35) [10-Apr-2021]
Reply With Quote #290

Hi, Silvers!

Can you please update the signatures with the following verified ones:
PHP Code:
"Games"
{
    
"left4dead"
    
{
        
"Signatures"
        
{
            
/*
             * void CTerrorPlayer::OnLedgeGrabbed(CTerrorPlayer *this, const Vector *)
             * Search: "%s grabs a ledge - last standing at %s."
             */
            
"OnLedgeGrabbed"
            
{
                
"library"    "server"
                "linux"        "@_ZN13CTerrorPlayer14OnLedgeGrabbedERK6Vector"
                "windows"    "\x2A\x2A\x2A\x2A\x2A\x2A\x81\xEC\x2A\x2A\x2A\x2A\x53\x56\x8B\xF1\x8B\x06\x8B\x90\x2A\x2A\x2A\x2A\x57\xFF\xD2\x84\xC0"
                
/* ? ? ? ? ? ? 81 EC ? ? ? ? 53 56 8B F1 8B 06 8B 90 ? ? ? ? 57 FF D2 84 C0 */
            
}

            
// Search: "ledge_hang" or "RevivedByFriend"
            
"OnRevived"
            
{
                
"library"    "server"
                "linux"        "@_ZN13CTerrorPlayer9OnRevivedEv"
                "windows"    "\x2A\x2A\x2A\x2A\x2A\x56\x57\x8B\xF9\x8B\x07\x8B\x90\x2A\x2A\x2A\x2A\xFF\xD2\x84\xC0\x0F\x84"
                
/* ? ? ? ? ? 56 57 8B F9 8B 07 8B 90 ? ? ? ? FF D2 84 C0 0F 84 */
            
}
        }
    }
    
    
"left4dead2"
    
{
        
"Signatures"
        
{
            
/*
             * void CTerrorPlayer::OnLedgeGrabbed(CTerrorPlayer *this, const Vector *)
             * Search: "%s grabs a ledge - last standing at %s."
             */
            
"OnLedgeGrabbed"
            
{
                
"library"    "server"
                "linux"        "@_ZN13CTerrorPlayer14OnLedgeGrabbedERK6Vector"
                "windows"    "\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x33\x2A\x89\x2A\x2A\x53\x56\x8B\x2A\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x57\x2A\x2A\x84\x2A\x0F\x84\x2A\x2A\x2A\x2A\x8B"
                
/* ? ? ? ? ? ? ? ? ? A1 ? ? ? ? 33 ? 89 ? ? 53 56 8B ? 8B ? 8B ? ? ? ? ? 57 ? ? 84 ? 0F 84 ? ? ? ? 8B */
            
}
            
            
// OnRevived - not required. Already wildcarded.
        
}
    }

because I broke them with DHooks in my recent plugin.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Reply


Thread Tools
Display Modes

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 09:48.


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