Quote:
Originally Posted by BHaType
23 "[L4D & L4D2] Left 4 DHooks Direct" (1.34) by SilverShot
Spoiler
PHP Code:
L 04/06/2021 - 19:39:11: [SM] Exception reported: Logical team 0 is invalid. Accepted values: 0 or 1.
L 04/06/2021 - 19:39:11: [SM] Blaming: left4dhooks.smx
L 04/06/2021 - 19:39:11: [SM] Call stack trace:
L 04/06/2021 - 19:39:11: [SM] [0] ThrowNativeError
L 04/06/2021 - 19:39:11: [SM] [1] Line 4098, C:\Servers\L4D2\left4dead2\addons\sourcemod\scripting\left4dhooks.sp::Native_GetTeamScore
Edit: I didn't notice it but still need to fix the message
PHP Code:
1.24 (27-Sep-2020)
- Reverted change: native "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
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.5, Timer_VPhysicsUpdateEnd, entity);
}
public Action Timer_VPhysicsUpdateEnd(Handle timer, int entity)
{
g_hTrackTimer[entity] = null;
float vecOrigin[3];
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", vecOrigin);
if (GetVectorLength(vecOrigin) == 0.0)
{
return;
}
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i))
{
if (!L4D2_IsReachable(i, vecOrigin))
{
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.
__________________