fbef0102 / L4D1_2-Plugins

L4D1/2 help server to record, make server more fun, and more useful plugins for adm.
GNU General Public License v3.0
169 stars 69 forks source link

spawn_infected_nolimit not working #50

Closed dewobedil closed 10 months ago

dewobedil commented 11 months ago

it seems NoLimit_CreateInfected() doesnt work on Last Stand campaign for some reason. When special spawned they will die instantly. Here is the code if you want to test. You can spawn normally by using left4dhooks

#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <leftdhooks>
#include <spawn_infected_nolimit>

public Plugin myinfo = 
{
    name        = "[L4D2] Test",
    author      = "dewobedil",
    description = "",
    version     = "1.0",
    url         = ""
};

public void OnPluginStart()
{
    RegAdminCmd ("sm_test", CommandTest, ADMFLAG_ROOT);
    RegAdminCmd ("sm_test2", CommandTest2, ADMFLAG_ROOT);
}

public Action CommandTest(int client, int args)
{
    float vecPos[3];
    if(L4D_GetRandomPZSpawnPosition(L4D_GetHighestFlowSurvivor(), 1, 5, vecPos))
    {
        L4D2_SpawnSpecial(1, vecPos, NULL_VECTOR);
    }
    return Plugin_Handled;
}

public Action CommandTest2(int client, int args)
{
    float vecPos[3];
    if(L4D_GetRandomPZSpawnPosition(L4D_GetHighestFlowSurvivor(), 1, 5, vecPos))
    {
        NoLimit_CreateInfected("smoker", vecPos, NULL_VECTOR);
    }
    return Plugin_Handled;
}
fbef0102 commented 11 months ago

I use your code and type !test2 image

it seems NoLimit_CreateInfected() doesnt work on Last Stand campaign for some reason. When special spawned they will die instantly.

Where exactly, what gamemode?

fbef0102 commented 11 months ago

Is probably because game failed to find a spawn position sometimes and return false, you can try

Action CommandTest(int client, int args)
{
    float vecPos[3];
    if(L4D_GetRandomPZSpawnPosition(L4D_GetHighestFlowSurvivor(), 1, 5, vecPos))
    {
        L4D2_SpawnSpecial(1, vecPos, NULL_VECTOR);
    }
    else
    {
        PrintToServer("[CommandTest] Couldn't find a Smoker Spawn position in 5 tries");
        PrintToChatAll("[CommandTest] Couldn't find a Smoker Spawn position in 5 tries");
    }
    return Plugin_Handled;
}

Action CommandTest2(int client, int args)
{
    float vecPos[3];
    if(L4D_GetRandomPZSpawnPosition(L4D_GetHighestFlowSurvivor(), 1, 5, vecPos))
    {
        NoLimit_CreateInfected("smoker", vecPos, NULL_VECTOR);
    }
    else
    {
        PrintToServer("[CommandTest2] Couldn't find a Smoker Spawn position in 5 tries");
        PrintToChatAll("[CommandTest2] Couldn't find a Smoker Spawn position in 5 tries");
    }

    return Plugin_Handled;
}

image

Reason: It means that the game can not find a position to spawn special infected, usually happen when director stops spawning special infected (C1m4 before evelator) or NAV problem (can't find any valid nav area to spawn infected near survivors)

dewobedil commented 10 months ago

I will check again later on, since it having weird problems on my site about spawn area problems it should okay, since it spawned its just die instanly