Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSS[L4D2] Zombie Class Select Redux


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
I might add a few features but this fixes bugs that ruined my stock of the upcoming Point System API

Code:


// bNoPick = cannot press mouse2 to change to another SI in a ghost spawn by the plugin l4d2_zcs.smx

stock bool PSAPI_SpawnInfectedBossByClassname(int client, const char[] name, bool bGhost=false, bool bNoPick = false)
{       
        if(StrEqual(name, "survivor") || StrEqual(name, "witch"))
                return false;
       
        // Multi tanks will create utter chaos if we don't first swap to a non-tank class prior to spawning the player.
       
        L4D_SetClass(client, view_as<int>(L4D2ZombieClass_Charger));
        L4D2_SetPlayerZombieClass(client, L4D2ZombieClass_Charger);

        // Safety measurements.
        L4D_State_Transition(client, STATE_DEATH_WAIT_FOR_KEY);

        float fOrigin[3];
        GetEntPropVector(client, Prop_Data, "m_vecOrigin", fOrigin);

        // Regardless of bGhost, we switch to ghost. If not ghost, we materialize.
        // We must become ghost prior to sending the event or zcs will wait another 0.1 seconds until we're alive.
        L4D_State_Transition(client, STATE_GHOST);

        if(bGhost)
        {
                // ZCS is really really annoying with its demands.
                Event event = CreateEvent("ghost_spawn_time");

                event.SetInt("userid", GetClientUserId(client));
                event.SetFloat("spawntime", 0.0);
                event.Fire();
        }



        // isRelocating and isCulling are not a solution to make a no pick, you can only respawn yourself and then swap to ghost as the only solution.
        // isRelocating is not 100% grasped by me, but isCulling checks if a living player can teleport and become ghost for being too far away from survivors.
        // isCulling is not a player that already pressed E to teleport as a living player.
        //SetEntProp(client, Prop_Send, "m_isCulling", bNoPick);
        //SetEntProp(client, Prop_Send, "m_isRelocating", bNoPick);

        if(bNoPick)
        {
                // Respawn is required to make ZCS think we relocated. Must put state transition above to ensure spec2ghost take the OnEnterGhostState
                L4D_RespawnPlayer(client);

                // Since we must switch to ghost again, we must recreate the spectator origin to activate spec2ghost
                TeleportEntity(client, fOrigin);

                // On top of state transition required to negate RespawnPlayer, you must switch state twice to remove a fake message of "You are too far away from survivors" caused by either isRelocating or isCulling
                L4D_State_Transition(client, STATE_GHOST);
        }

        for (int i = 0; i < sizeof(g_sBossClassnames);i++)
        {
                if(StrEqual(g_sBossClassnames[i], name))
                {
                        L4D_SetClass(client, i);
                        L4D2_SetPlayerZombieClass(client, view_as<L4D2ZombieClassType>(i));
                }
        }
       
        PSAPI_FullHeal(client); // I don't know how, but I once spawned as a tank health smoker.
       
        if(!bGhost)
                L4D_MaterializeFromGhost(client);

        return true;
}

Do not expect me to help you with less than a 1.11 compiler & server.

Attached Files
File Type: txt l4d2_zcs.txt (551 Bytes)
File Type: sp Get Plugin or Get Source (l4d2_zcs_redux.sp - 42.4 KB)

Wyświetl pełny artykuł

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...