RSSy MYGO.pl Opublikowano Marzec 6, 2022 o 13:00 RSSy Udostępnij Opublikowano Marzec 6, 2022 o 13:00 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 l4d2_zcs.txt (551 Bytes) 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 Więcej opcji udostępniania...
Rekomendowane odpowiedzi